Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 21d4096

Browse files
committed
Another proposal: Clean up "update directory" job, as well
relates to #TheAlgorithms#720 Cleaned up and updated the job description file a bit. Instead of attempting to commit every single time, we check if the DIRECTORY file actually has changes first.
1 parent 6f9b1f1 commit 21d4096

File tree

2 files changed

+25
-9
lines changed

2 files changed

+25
-9
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
if ! git diff --quiet DIRECTORY.md; then
2+
echo Changes found, attempting to commit and push...
3+
git add DIRECTORY.md
4+
git commit -am "Auto-update DIRECTORY.md" || true
5+
git push --force origin HEAD:$GITHUB_REF || true
6+
echo ... done.
7+
else
8+
echo No changes found, exiting.
9+
fi
10+
Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,24 @@
11
# This GitHub Action updates the DIRECTORY.md file (if needed) when doing a git push
2-
name: update_directory_md
2+
name: Update Directory
3+
34
on: [push]
5+
46
jobs:
5-
update_directory_md:
7+
updateDirectory:
68
runs-on: ubuntu-latest
79
steps:
8-
- uses: actions/checkout@master
9-
- uses: actions/setup-node@v1
10-
- run: |
11-
node .github/workflows/UpdateDirectory.js
10+
- uses: actions/checkout@v2
11+
- uses: actions/setup-node@v2
12+
with:
13+
node-version: '14'
14+
15+
- name: 🗄️ Create Directory from JS files
16+
run: node .github/workflows/UpdateDirectory.js
17+
18+
- name: 🤓 Commit & push new Directory (if needed)
19+
run: |
1220
cat DIRECTORY.md
1321
git config --global user.name github-actions
1422
git config --global user.email '${GITHUB_ACTOR}@users.noreply.github.com'
1523
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
16-
git add DIRECTORY.md
17-
git commit -am "updating DIRECTORY.md" || true
18-
git push --force origin HEAD:$GITHUB_REF || true
24+
.github/workflows/commitAndPushDirectory.sh

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /