Skip to content

Commit 1e1632f

Browse files
Copilotcameri
andauthored
chore: add dependabot changeset workflow
Agent-Logs-Url: https://github.com/cameri/nostream/sessions/d4c27474-5e00-4668-ab36-b9ffe83a3c96 Co-authored-by: cameri <378886+cameri@users.noreply.github.com>
1 parent 8e9cb1c commit 1e1632f

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Dependabot Changeset
2+
3+
on:
4+
pull_request:
5+
types: [opened, reopened]
6+
7+
jobs:
8+
add-changeset:
9+
name: Add Changeset
10+
runs-on: ubuntu-latest
11+
if: github.actor == 'dependabot[bot]'
12+
permissions:
13+
contents: write
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v3
17+
with:
18+
ref: ${{ github.head_ref }}
19+
fetch-depth: 0
20+
21+
- name: Check for existing changeset
22+
id: check
23+
run: |
24+
count=$(find .changeset -maxdepth 1 -name '*.md' ! -name 'README.md' 2>/dev/null | wc -l)
25+
if [ "$count" -gt 0 ]; then
26+
echo "exists=true" >> "$GITHUB_OUTPUT"
27+
else
28+
echo "exists=false" >> "$GITHUB_OUTPUT"
29+
fi
30+
31+
- name: Create changeset
32+
if: steps.check.outputs.exists == 'false'
33+
env:
34+
PR_TITLE: ${{ github.event.pull_request.title }}
35+
run: |
36+
filename=".changeset/dependabot-pr-${{ github.event.pull_request.number }}.md"
37+
printf -- '---\n"nostream": patch\n---\n\n%s\n' "$PR_TITLE" > "$filename"
38+
39+
- name: Commit and push changeset
40+
if: steps.check.outputs.exists == 'false'
41+
run: |
42+
git config user.name "github-actions[bot]"
43+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
44+
git add .changeset/dependabot-pr-${{ github.event.pull_request.number }}.md
45+
git commit -m "chore: add changeset for dependabot PR #${{ github.event.pull_request.number }}"
46+
git push

0 commit comments

Comments
 (0)