diff --git a/.github/workflows/UpdateDirectory.yml b/.github/workflows/UpdateDirectory.yml index 437ab55b91..2343ac8368 100644 --- a/.github/workflows/UpdateDirectory.yml +++ b/.github/workflows/UpdateDirectory.yml @@ -1,10 +1,15 @@ -# This GitHub Action updates the DIRECTORY.md file (if needed) when doing a git push +# This workflow keeps DIRECTORY.md up to date. +# On protected default branches, it opens a pull request instead of pushing directly. name: Update Directory on: push: - branches-ignore: - "master" + branches: + - master + +permissions: + contents: write + pull-requests: write jobs: updateDirectory: @@ -23,16 +28,14 @@ jobs: - name: 🗄️ Create Directory from JS files run: node .github/workflows/UpdateDirectory.js - - name: Configure Github Action - run: | - git config --global user.name "$GITHUB_ACTOR" - git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com" - - - name: 🤓 Commit & push new Directory (if needed) - run: | - if [[ `git status --porcelain` ]]; then - git commit -am "Updated Documentation in README.md" - git push - else - echo "NO CHANGES DETECTED" - fi + - name: 🤓 Open pull request for DIRECTORY.md updates (if needed) + uses: peter-evans/create-pull-request@v7 + with: + branch: ci/update-directory + delete-branch: true + commit-message: "chore: update DIRECTORY.md" + title: "chore: update DIRECTORY.md" + body: | + Automated update of `DIRECTORY.md` generated by `.github/workflows/UpdateDirectory.js`. + add-paths: | + DIRECTORY.md