Skip to content

Commit f9c89a7

Browse files
Panquesito7github-actions[bot]
and
github-actions[bot]
authored
feat: create a PR when building the LeetCode directory (#1231)
* updating DIRECTORY.md * feat: create a PR when building the LeetCode directory * updating DIRECTORY.md --------- Co-authored-by: github-actions[bot] <[email protected]>
1 parent f3a3e6d commit f9c89a7

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

.github/workflows/leetcode_directory_writer.yml

+16-7
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,22 @@ jobs:
1818
- name: Add python dependencies
1919
run: |
2020
pip install requests
21-
- name: Write leectode DIRECTORY.md
21+
- name: Write LeetCode DIRECTORY.md
2222
run: |
2323
python3 scripts/leetcode_directory_md.py 2>&1 | tee leetcode/DIRECTORY.md
24-
git config --global user.name github-actions[bot]
25-
git config --global user.email '[email protected]'
26-
- name: Update LeetCode's directory
24+
git pull || true
25+
- name: Commit and push changes
26+
uses: stefanzweifel/git-auto-commit-action@v4
27+
id: commit-push
28+
with:
29+
commit_message: "docs: updating `leetcode/DIRECTORY.md`"
30+
branch: "leetcode-directory-${{ github.sha }}"
31+
create_branch: true
32+
- name: Creating and merging the PR
33+
shell: bash
34+
if: steps.commit-push.outputs.changes_detected == 'true'
2735
run: |
28-
git add leetcode/DIRECTORY.md
29-
git commit -am "updating DIRECTORY.md" || true
30-
git push origin HEAD:$GITHUB_REF || true
36+
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).'
37+
gh pr merge --admin --merge --subject 'docs: updating `leetcode/DIRECTORY.md' --delete-branch
38+
env:
39+
GH_TOKEN: ${{ github.token }}

DIRECTORY.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
## Audio
33
* [Alaw](https://github.com/TheAlgorithms/C/blob/HEAD/audio/alaw.c)
44

5+
## Cipher
6+
* [Rot13](https://github.com/TheAlgorithms/C/blob/HEAD/cipher/rot13.c)
7+
58
## Client Server
69
* [Client](https://github.com/TheAlgorithms/C/blob/HEAD/client_server/client.c)
710
* [Remote Command Exec Udp Client](https://github.com/TheAlgorithms/C/blob/HEAD/client_server/remote_command_exec_udp_client.c)
@@ -359,7 +362,6 @@
359362
* [Poly Add](https://github.com/TheAlgorithms/C/blob/HEAD/misc/poly_add.c)
360363
* [Postfix Evaluation](https://github.com/TheAlgorithms/C/blob/HEAD/misc/postfix_evaluation.c)
361364
* [Quartile](https://github.com/TheAlgorithms/C/blob/HEAD/misc/quartile.c)
362-
* [Rot13](https://github.com/TheAlgorithms/C/blob/HEAD/misc/rot13.c)
363365
* [Rselect](https://github.com/TheAlgorithms/C/blob/HEAD/misc/rselect.c)
364366
* [Run Length Encoding](https://github.com/TheAlgorithms/C/blob/HEAD/misc/run_length_encoding.c)
365367
* [Shunting Yard](https://github.com/TheAlgorithms/C/blob/HEAD/misc/shunting_yard.c)

0 commit comments

Comments
 (0)