Skip to content

Commit d14873f

Browse files
Automatically create pull requests for directory updates (#6322)
1 parent 67ccb62 commit d14873f

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

.github/workflows/update-directorymd.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Generate Directory Markdown
1+
name: Generate Directory Markdown
22

33
on:
44
push:
@@ -7,6 +7,7 @@ on:
77

88
permissions:
99
contents: write
10+
pull-requests: write
1011

1112
jobs:
1213
generate-directory:
@@ -22,12 +23,19 @@ jobs:
2223
extensions: .java
2324
show-extensions: false
2425

25-
- name: Commit and Push DIRECTORY.md
26+
- name: Commit changes
2627
run: |
27-
cat DIRECTORY.md
2828
git config --global user.name "$GITHUB_ACTOR"
2929
git config --global user.email "[email protected]"
30-
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
3130
git add DIRECTORY.md
32-
git commit -am "Update directory" || true
33-
git push origin HEAD:$GITHUB_REF
31+
git diff --cached --quiet || git commit -m "Update DIRECTORY.md"
32+
33+
- name: Create Pull Request
34+
uses: peter-evans/create-pull-request@v5
35+
with:
36+
branch: update-directory
37+
base: master
38+
title: "Update DIRECTORY.md"
39+
body: "Automatically generated update of the directory tree."
40+
commit-message: "Update DIRECTORY.md"
41+
draft: false

0 commit comments

Comments
 (0)