Skip to content

Commit ce36f4d

Browse files
Update update-directorymd.yml
1 parent 67ccb62 commit ce36f4d

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

.github/workflows/update-directorymd.yml

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,25 @@ jobs:
2222
extensions: .java
2323
show-extensions: false
2424

25-
- name: Commit and Push DIRECTORY.md
25+
- name: Create branch, commit changes and open pull request
26+
env:
27+
BRANCH_NAME: update-directory-md-${{ github.run_id }}
2628
run: |
27-
cat DIRECTORY.md
28-
git config --global user.name "$GITHUB_ACTOR"
29-
git config --global user.email "[email protected]"
30-
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
29+
git config user.name "${{ github.actor }}"
30+
git config user.email "${{ github.actor }}@users.noreply.github.com"
31+
32+
git checkout -b $BRANCH_NAME
33+
3134
git add DIRECTORY.md
32-
git commit -am "Update directory" || true
33-
git push origin HEAD:$GITHUB_REF
35+
git commit -m "chore: update DIRECTORY.md" || echo "No changes to commit"
36+
git push origin $BRANCH_NAME
37+
38+
- name: Create Pull Request
39+
uses: peter-evans/create-pull-request@v6
40+
with:
41+
token: ${{ secrets.GITHUB_TOKEN }}
42+
branch: ${{ env.BRANCH_NAME }}
43+
title: "Update DIRECTORY.md"
44+
body: |
45+
This pull request updates the `DIRECTORY.md` file automatically.
46+
base: master

0 commit comments

Comments
 (0)