Skip to content

Commit d0a85d2

Browse files
authored
Update update-readme.yml
1 parent 3e3f025 commit d0a85d2

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

.github/workflows/update-readme.yml

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,59 +8,49 @@ jobs:
88
runs-on: ubuntu-22.04
99

1010
steps:
11-
# Step 1: Checkout repository
1211
- name: Checkout repository
1312
uses: actions/checkout@v3
1413
with:
1514
fetch-depth: 0
1615

17-
# Step 2: Fetch badges.json content from gh-pages branch without tracking it
1816
- name: Fetch badges.json from gh-pages branch
1917
run: |
2018
git fetch origin gh-pages
2119
git show origin/gh-pages:badges.json > badges.json
2220
echo "::notice::Fetched badges.json from gh-pages branch."
2321
24-
# Step 3: Parse badges.json and save artifact
2522
- name: Parse badges.json and save artifact
2623
run: |
2724
node parse-badges.js
2825
echo "::notice::Parsed badges.json and saved artifact."
2926
30-
# Step 4: Remove badges.json after parsing
3127
- name: Clean up badges.json
3228
run: |
3329
rm -f badges.json
3430
echo "::notice::Removed badges.json after parsing."
3531
36-
# Step 5: Upload parsed badges artifact
3732
- name: Upload parsed badges artifact
3833
uses: actions/upload-artifact@v4
3934
with:
4035
name: parsed-badges
4136
path: parsed-badges.json
4237

43-
# Step 6: Download parsed badges artifact
4438
- name: Download parsed badges artifact
4539
uses: actions/download-artifact@v4
4640
with:
4741
name: parsed-badges
4842

49-
# Step 7: Update README if necessary
5043
- name: Update README if changes are found
5144
id: update-readme
5245
run: |
5346
node update-readme.js parsed-badges.json
5447
if [ $? -eq 0 ]; then
55-
echo "::set-output name=changes-found::true"
5648
echo "changes-found=true" >> $GITHUB_ENV
5749
else
58-
echo "::set-output name=changes-found::false"
5950
echo "changes-found=false" >> $GITHUB_ENV
6051
fi
6152
echo "::notice::Checked and updated README if changes were found."
6253
63-
# Step 8: Commit changes and create a new branch (only if changes were found)
6454
- name: Commit changes and create a new branch
6555
if: env.changes-found == 'true'
6656
run: |
@@ -70,7 +60,7 @@ jobs:
7060
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
7161
echo "$BRANCH_NAME" > branch-name.txt
7262
git checkout -b $BRANCH_NAME
73-
git add README.md # Explicitly add only README.md
63+
git add README.md
7464
git commit -m "Update README with latest download URLs"
7565
git push origin HEAD
7666
echo "::notice::Changes committed and branch pushed."
@@ -85,7 +75,7 @@ jobs:
8575
create-pr:
8676
runs-on: ubuntu-22.04
8777
needs: check-and-update-readme
88-
if: needs.check-and-update-readme.outputs['changes-found'] == 'true'
78+
if: always() && env.changes-found == 'true'
8979
steps:
9080
- name: Download branch name artifact
9181
uses: actions/download-artifact@v4

0 commit comments

Comments
 (0)