mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-05 00:01:37 +08:00
merge: Update directory workflow (#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>
This commit is contained in:
10
.github/workflows/CommitAndPushDirectory.sh
vendored
10
.github/workflows/CommitAndPushDirectory.sh
vendored
@ -1,10 +0,0 @@
|
||||
if ! git diff --quiet DIRECTORY.md; then
|
||||
echo Changes found, attempting to commit and push...
|
||||
git add DIRECTORY.md
|
||||
git commit -am "Auto-update DIRECTORY.md" || true
|
||||
git push --force origin HEAD:$GITHUB_REF || true
|
||||
echo ... done.
|
||||
else
|
||||
echo No changes found, exiting.
|
||||
fi
|
||||
|
2
.github/workflows/UpdateDirectory.mjs
vendored
2
.github/workflows/UpdateDirectory.mjs
vendored
@ -35,7 +35,7 @@ function pathsToMarkdown (filePaths) {
|
||||
|
||||
for (let filepath of filePaths) {
|
||||
let filename = path.basename(filepath)
|
||||
filepath = path.dirname(path.sep)
|
||||
filepath = path.dirname(filepath)
|
||||
|
||||
if (filepath !== oldPath) {
|
||||
oldPath = printPath(oldPath, filepath, output)
|
||||
|
17
.github/workflows/UpdateDirectory.yml
vendored
17
.github/workflows/UpdateDirectory.yml
vendored
@ -3,8 +3,8 @@ name: Update Directory
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
branches-ignore:
|
||||
"master"
|
||||
|
||||
jobs:
|
||||
updateDirectory:
|
||||
@ -22,9 +22,16 @@ jobs:
|
||||
- name: 🗄️ Create Directory from JS files
|
||||
run: node .github/workflows/UpdateDirectory.mjs
|
||||
|
||||
- name: 🤓 Commit & push new Directory (if needed)
|
||||
- name: Configure Github Action
|
||||
run: |
|
||||
git config --global user.name github-actions
|
||||
git config --global user.email '${GITHUB_ACTOR}@users.noreply.github.com'
|
||||
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
|
||||
.github/workflows/CommitAndPushDirectory.sh
|
||||
|
||||
- name: 🤓 Commit & push new Directory (if needed)
|
||||
run: |
|
||||
if [[ `git status --porcelain` ]]; then
|
||||
git commit -am "Updated Documentation in README.md"
|
||||
git push
|
||||
else
|
||||
echo "NO CHANGES DETECTED"
|
||||
fi
|
||||
|
Reference in New Issue
Block a user