diff --git a/.github/workflows/leetcode_directory_writer.yml b/.github/workflows/leetcode_directory_writer.yml index e85c879b..e6d666ce 100644 --- a/.github/workflows/leetcode_directory_writer.yml +++ b/.github/workflows/leetcode_directory_writer.yml @@ -7,6 +7,7 @@ on: - "leetcode/src/**.c" jobs: build: + if: github.repository == 'TheAlgorithms/C' # We only need this to run in our repository. runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -21,17 +22,21 @@ jobs: - name: Write LeetCode DIRECTORY.md run: | python3 scripts/leetcode_directory_md.py 2>&1 | tee leetcode/DIRECTORY.md - - name: Commit and push changes - uses: stefanzweifel/git-auto-commit-action@v4 - id: commit-push - with: - commit_message: "docs: updating `leetcode/DIRECTORY.md`" - branch: "leetcode-directory-${{ github.sha }}" - create_branch: true - - name: Creating and merging the PR + - name: Setup Git configurations shell: bash - if: steps.commit-push.outputs.changes_detected == 'true' run: | + git config --global user.name github-actions[bot] + git config --global user.email 'github-actions@users.noreply.github.com' + - name: Committing changes + shell: bash + run: | + git checkout -b leetcode-directory-${{ github.sha }} + git commit -m "docs: updating `leetcode/DIRECTORY.md` + git push origin leetcode-directory-${{ github.sha }}:leetcode-directory-${{ github.sha }} + - name: Creating the pull request + shell: bash + run: | + if [[ `git status --porcelain` ]]; then 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).' env: GH_TOKEN: ${{ github.token }} diff --git a/DIRECTORY.md b/DIRECTORY.md index fc4a3c47..1493a480 100644 --- a/DIRECTORY.md +++ b/DIRECTORY.md @@ -107,6 +107,7 @@ * [Queue](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/queue/queue.c) * [Stack](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/stack.c) * Stack + * [Dynamic Stack](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/stack/dynamic_stack.c) * [Main](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/stack/main.c) * [Parenthesis](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/stack/parenthesis.c) * [Stack](https://github.com/TheAlgorithms/C/blob/HEAD/data_structures/stack/stack.c)