Skip to content

Commit 548f25b

Browse files
committed
Better git logic for updating contributors in readme
1 parent b9d3596 commit 548f25b

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

.github/workflows/update-contributors.yml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,26 +24,27 @@ jobs:
2424
- name: Install dependencies
2525
run: npm ci
2626

27-
- name: Update contributors
28-
run: npm run update-contributors
27+
- name: Update contributors and check for changes
28+
run: |
29+
npm run update-contributors
30+
git diff --quiet README.md || echo "changes=true" >> $GITHUB_OUTPUT
31+
id: check-changes
2932
env:
3033
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31-
32-
- name: Check for changes
33-
id: check-changes
34+
35+
- name: Stage changes
36+
if: steps.check-changes.outputs.changes == 'true'
3437
run: |
35-
if [[ -n "$(git status --porcelain README.md)" ]]; then
36-
echo "changes=true" >> $GITHUB_OUTPUT
37-
else
38-
echo "No changes to README.md"
39-
fi
40-
38+
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
39+
git config --local user.name "github-actions[bot]"
40+
git add README.md
41+
git commit -m "docs: update contributors list [skip ci]"
42+
4143
- name: Create Pull Request
4244
if: steps.check-changes.outputs.changes == 'true'
4345
uses: peter-evans/create-pull-request@v5
4446
with:
4547
token: ${{ secrets.GITHUB_TOKEN }}
46-
commit-message: "docs: update contributors list"
4748
title: "Update contributors list"
4849
body: |
4950
Automated update of contributors list in README.md

0 commit comments

Comments
 (0)