Skip to content

Commit 2e8374e

Browse files
Panquesito7github-actions[bot]
andauthored
chore: improve the LeetCode directory writer (#1276)
* chore: free-dependency LeetCode directory writer * updating DIRECTORY.md --------- Co-authored-by: github-actions[bot] <[email protected]>
1 parent b1a8da6 commit 2e8374e

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

.github/workflows/leetcode_directory_writer.yml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
- "leetcode/src/**.c"
88
jobs:
99
build:
10+
if: github.repository == 'TheAlgorithms/C' # We only need this to run in our repository.
1011
runs-on: ubuntu-latest
1112
steps:
1213
- uses: actions/checkout@v3
@@ -21,17 +22,21 @@ jobs:
2122
- name: Write LeetCode DIRECTORY.md
2223
run: |
2324
python3 scripts/leetcode_directory_md.py 2>&1 | tee leetcode/DIRECTORY.md
24-
- name: Commit and push changes
25-
uses: stefanzweifel/git-auto-commit-action@v4
26-
id: commit-push
27-
with:
28-
commit_message: "docs: updating `leetcode/DIRECTORY.md`"
29-
branch: "leetcode-directory-${{ github.sha }}"
30-
create_branch: true
31-
- name: Creating and merging the PR
25+
- name: Setup Git configurations
26+
shell: bash
27+
run: |
28+
git config --global user.name github-actions[bot]
29+
git config --global user.email '[email protected]'
30+
- name: Committing changes
31+
shell: bash
32+
run: |
33+
git checkout -b leetcode-directory-${{ github.sha }}
34+
git commit -m "docs: updating `leetcode/DIRECTORY.md`
35+
git push origin leetcode-directory-${{ github.sha }}:leetcode-directory-${{ github.sha }}
36+
- name: Creating the pull request
3237
shell: bash
33-
if: steps.commit-push.outputs.changes_detected == 'true'
3438
run: |
39+
if [[ `git status --porcelain` ]]; then
3540
gh pr create --base ${GITHUB_REF##*/} --head leetcode-directory-${{ github.sha }} --title 'docs: updating `leetcode/DIRECTORY.md`' --body 'Updated LeetCode directory (see the diff. for changes).'
3641
env:
3742
GH_TOKEN: ${{ github.token }}

DIRECTORY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@
107107
* [Queue](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/queue/queue.c)
108108
* [Stack](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/stack.c)
109109
* Stack
110+
* [Dynamic Stack](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/stack/dynamic_stack.c)
110111
* [Main](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/stack/main.c)
111112
* [Parenthesis](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/stack/parenthesis.c)
112113
* [Stack](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/stack/stack.c)

0 commit comments

Comments
 (0)