Skip to content

Commit a82bb2c

Browse files
committed
Use peter-evans/create-pull-request instead of repo-sync/pull-request
1 parent e5f5268 commit a82bb2c

File tree

1 file changed

+8
-48
lines changed

1 file changed

+8
-48
lines changed

.github/workflows/reusable-regenerate-readme.yml

Lines changed: 8 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -44,61 +44,21 @@ jobs:
4444
# Bust the cache at least once a month - output format: YYYY-MM.
4545
custom-cache-suffix: $(date -u "+%Y-%m")
4646

47-
- name: Configure git user
48-
run: |
49-
git config --global user.email "github-actions[bot]@users.noreply.github.com"
50-
git config --global user.name "github-actions[bot]"
51-
52-
- name: Check if remote branch exists
53-
id: check_remote_branch
54-
run: |
55-
echo "exists=$(git ls-remote --exit-code --heads origin regenerate-readme &>/dev/null && echo "true" || echo "false")" >>"${GITHUB_OUTPUT}"
56-
57-
- name: Create branch to base pull request on
58-
if: ${{ steps.check_remote_branch.outputs.exists == 'false' }}
59-
run: |
60-
git checkout -b regenerate-readme
61-
62-
- name: Fetch existing branch to add commits to
63-
if: ${{ steps.check_remote_branch.outputs.exists == 'true' }}
64-
run: |
65-
git fetch --all --prune
66-
git checkout regenerate-readme
67-
git pull --no-rebase
68-
69-
- name: Install WP-CLI
70-
run: |
71-
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli-nightly.phar
72-
sudo mv wp-cli-nightly.phar /usr/local/bin/wp
73-
sudo chmod +x /usr/local/bin/wp
74-
7547
- name: Regenerate README.md file
7648
run: |
7749
wp package install "wp-cli/scaffold-package-command:^2"
7850
wp scaffold package-readme --branch=${{ github.event.repository.default_branch }} --force .
7951
80-
- name: Check if there are changes
81-
id: check_changes
82-
run: |
83-
echo "detected=$(test -n "$(git status --porcelain 2>/dev/null)" && echo "true" || echo "false")" >>"${GITHUB_OUTPUT}"
84-
85-
- name: Commit changes
86-
if: ${{ steps.check_changes.outputs.detected == 'true' }}
87-
run: |
88-
git add README.md
89-
git commit -m "Regenerate README file - $(date +'%Y-%m-%d')"
90-
git push origin regenerate-readme
91-
9252
- name: Create pull request
93-
if: ${{ steps.check_changes.outputs.detected == 'true' && steps.check_remote_branch.outputs.exists == 'false' }}
94-
uses: repo-sync/pull-request@7e79a9f5dc3ad0ce53138f01df2fad14a04831c5 # v2
53+
uses: peter-evans/create-pull-request@v7
9554
with:
96-
source_branch: regenerate-readme
97-
destination_branch: ${{ github.event.repository.default_branch }}
98-
github_token: ${{ secrets.GITHUB_TOKEN }}
99-
pr_title: Regenerate README file
100-
pr_body: |
55+
branch: regenerate-readme
56+
base: ${{ github.event.repository.default_branch }}
57+
token: ${{ secrets.GITHUB_TOKEN }}
58+
title: Regenerate README file
59+
body: |
10160
**This is an automated pull-request**
10261
10362
Refreshes the `README.md` file with the latest changes to the docblocks in the source code.
104-
pr_label: scope:documentation
63+
labels: scope:documentation
64+
commit-message: "Regenerate README file"

0 commit comments

Comments
 (0)