Skip to content

Commit e447b55

Browse files
raklaptudirmgithub-actions
and
github-actions
authored
merge: Update directory workflow (TheAlgorithms#1000)
* chore: update directory workflow Workflow now only runs on `pull_request` to prevent pushing on the master branch. * chore: update commit mechanism * chore: remove rundundant script * Update UpdateDirectory.yml * Updated Documentation in README.md * Update UpdateDirectory.yml * fix: replace wrong variable * Updated Documentation in README.md Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
1 parent 01db0fb commit e447b55

File tree

4 files changed

+331
-354
lines changed

4 files changed

+331
-354
lines changed

.github/workflows/CommitAndPushDirectory.sh

Lines changed: 0 additions & 10 deletions
This file was deleted.

.github/workflows/UpdateDirectory.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function pathsToMarkdown (filePaths) {
3535

3636
for (let filepath of filePaths) {
3737
let filename = path.basename(filepath)
38-
filepath = path.dirname(path.sep)
38+
filepath = path.dirname(filepath)
3939

4040
if (filepath !== oldPath) {
4141
oldPath = printPath(oldPath, filepath, output)

.github/workflows/UpdateDirectory.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ name: Update Directory
33

44
on:
55
push:
6-
branches:
7-
- master
6+
branches-ignore:
7+
"master"
88

99
jobs:
1010
updateDirectory:
@@ -22,9 +22,16 @@ jobs:
2222
- name: 🗄️ Create Directory from JS files
2323
run: node .github/workflows/UpdateDirectory.mjs
2424

25-
- name: 🤓 Commit & push new Directory (if needed)
25+
- name: Configure Github Action
2626
run: |
2727
git config --global user.name github-actions
2828
git config --global user.email '${GITHUB_ACTOR}@users.noreply.github.com'
29-
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
30-
.github/workflows/CommitAndPushDirectory.sh
29+
30+
- name: 🤓 Commit & push new Directory (if needed)
31+
run: |
32+
if [[ `git status --porcelain` ]]; then
33+
git commit -am "Updated Documentation in README.md"
34+
git push
35+
else
36+
echo "NO CHANGES DETECTED"
37+
fi

0 commit comments

Comments
 (0)