File tree Expand file tree Collapse file tree 2 files changed +39
-9
lines changed Expand file tree Collapse file tree 2 files changed +39
-9
lines changed Original file line number Diff line number Diff line change
1
+ # The objective of this GitHub Action is to update the leetcode DIRECTORY.md file (if needed)
2
+ # when doing a git push
3
+ name : leetcode_directory_writer
4
+ on :
5
+ push :
6
+ paths :
7
+ - ' leetcode/src/**.cpp'
8
+ jobs :
9
+ build :
10
+ runs-on : ubuntu-latest
11
+ steps :
12
+ - uses : actions/checkout@v3
13
+ with :
14
+ fetch-depth : 0
15
+ - uses : actions/setup-python@v4
16
+ with :
17
+ python-version : 3.x
18
+ - name : Add python dependencies
19
+ run : |
20
+ pip install requests
21
+ - name : Write LeetCode DIRECTORY.md
22
+ run : |
23
+ python3 scripts/leetcode_directory_md.py 2>&1 | tee leetcode/DIRECTORY.md
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'
35
+ run : |
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 }}
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments