Skip to content

Commit c67cc87

Browse files
committed
fix: update DIRECTORY workflow for protected master branch
Fixes: #1219
1 parent 5c39e87 commit c67cc87

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed
Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1-
# This GitHub Action updates the DIRECTORY.md file (if needed) when doing a git push
1+
# This workflow keeps DIRECTORY.md up to date.
2+
# On protected default branches, it opens a pull request instead of pushing directly.
23
name: Update Directory
34

45
on:
56
push:
6-
branches-ignore:
7-
"master"
7+
branches:
8+
- master
9+
10+
permissions:
11+
contents: write
12+
pull-requests: write
813

914
jobs:
1015
updateDirectory:
@@ -23,16 +28,14 @@ jobs:
2328
- name: 🗄️ Create Directory from JS files
2429
run: node .github/workflows/UpdateDirectory.js
2530

26-
- name: Configure Github Action
27-
run: |
28-
git config --global user.name "$GITHUB_ACTOR"
29-
git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com"
30-
31-
- name: 🤓 Commit & push new Directory (if needed)
32-
run: |
33-
if [[ `git status --porcelain` ]]; then
34-
git commit -am "Updated Documentation in README.md"
35-
git push
36-
else
37-
echo "NO CHANGES DETECTED"
38-
fi
31+
- name: 🤓 Open pull request for DIRECTORY.md updates (if needed)
32+
uses: peter-evans/create-pull-request@v7
33+
with:
34+
branch: ci/update-directory
35+
delete-branch: true
36+
commit-message: "chore: update DIRECTORY.md"
37+
title: "chore: update DIRECTORY.md"
38+
body: |
39+
Automated update of `DIRECTORY.md` generated by `.github/workflows/UpdateDirectory.js`.
40+
add-paths: |
41+
DIRECTORY.md

0 commit comments

Comments
 (0)