Skip to content

Commit ad3c594

Browse files
chore: update workflow to sort modrinth.index.json files and improve commit logic
1 parent 374086c commit ad3c594

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

.github/workflows/sort-modrinth-files.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
paths:
66
- '**/modrinth.index.json'
77

8+
permissions:
9+
contents: write
10+
811
jobs:
912
sort-files:
1013
runs-on: ubuntu-latest
@@ -29,15 +32,14 @@ jobs:
2932
node sort-modrinth-files.js "$file"
3033
done
3134
32-
- name: Commit changes
35+
- name: Commit and push changes
3336
run: |
3437
git config --local user.email "github-actions[bot]@users.noreply.github.com"
3538
git config --local user.name "github-actions[bot]"
3639
git add "**/modrinth.index.json"
37-
git diff --staged --quiet || git commit -m "chore: sort modrinth.index.json files alphabetically"
38-
39-
- name: Push changes
40-
uses: ad-m/github-push-action@master
41-
with:
42-
github_token: ${{ secrets.GITHUB_TOKEN }}
43-
branch: ${{ github.ref }}
40+
if ! git diff --staged --quiet; then
41+
git commit -m "chore: sort modrinth.index.json files alphabetically"
42+
git push
43+
else
44+
echo "No changes to commit"
45+
fi

0 commit comments

Comments
 (0)