Skip to content

Commit 41f38dd

Browse files
Allow the WP update and changelog workflows to commit to trunk again (#2377)
## Motivation for the change, related issues The WP build and changelog update workflows are currently blocked from committing to trunk because it is a protected branch. ## Implementation details This PR fixes that by restoring use of GH_ACTOR and GH_TOKEN in those workflows. I previously removed use of the occasionally-expiring Personal Access Token (PAT), not understanding that it was required for pushing to protected branches. At the time we were not protecting trunk in the that repo, and using the default token provided in the GH workflow context worked just fine. Once we switched back to using branch protection, these workflows started breaking. For a GitHub Actions workflow to push to a protected branch we need to do one of the following: - Use a PAT and update it before it expires - Use a Deploy Key (doesn't expire but has a lot of power if it falls into the wrong hands) - Create a GitHub app at the organization level, add it to the repo, create an app token during workflow execution, and use that. This is a bit annoying since we don't (or at least I don't) have access to create an app within the WordPress GH org, so we'd have to request the app and then jump through hoops to use it in each workflow. - Create a PR within the workflow and use the GH REST API (even via GH CLI) to merge it Right now, we have a PAT that is working for the sqlite-database-integration update, so I'm just restoring that for the other workflows. ## Testing Instructions (or ideally a Blueprint) Merge and run workflows on trunk.
1 parent 49726a4 commit 41f38dd

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

.github/workflows/refresh-wordpress-major-and-beta.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
with:
3535
ref: ${{ github.event.pull_request.head.ref }}
3636
clean: true
37-
persist-credentials: true
37+
persist-credentials: false
3838
submodules: true
3939
- uses: ./.github/actions/prepare-playground
4040
with:
@@ -63,6 +63,7 @@ jobs:
6363
sudo chown -R "$(whoami):$(id -gn)" packages/playground/wordpress-builds/public
6464
git config --global user.name "deployment_bot"
6565
git config --global user.email "[email protected]"
66+
git remote set-url origin https://${{ secrets.GH_ACTOR }}:${{ secrets.GH_TOKEN }}@github.com/${{ github.repository }}
6667
git add -A
6768
git commit -a -m "Recompile WordPress major and beta versions"
6869
git pull --rebase

.github/workflows/refresh-wordpress-nightly.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
with:
2828
ref: ${{ github.event.pull_request.head.ref }}
2929
clean: true
30-
persist-credentials: true
30+
persist-credentials: false
3131
submodules: true
3232
- uses: ./.github/actions/prepare-playground
3333
with:
@@ -39,6 +39,7 @@ jobs:
3939
run: |
4040
git config --global user.name "deployment_bot"
4141
git config --global user.email "[email protected]"
42+
git remote set-url origin https://${{ secrets.GH_ACTOR }}:${{ secrets.GH_TOKEN }}@github.com/${{ github.repository }}
4243
git add -A
4344
git commit -a -m "Refresh WordPress Nightly"
4445
git pull --rebase

.github/workflows/update-changelog.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
submodules: recursive
4444
ref: trunk
4545
clean: true
46-
persist-credentials: true
46+
persist-credentials: false
4747
- name: 'Install bun (for the changelog)'
4848
run: |
4949
curl -fsSL https://bun.sh/install | bash
@@ -61,6 +61,7 @@ jobs:
6161
run: |
6262
git config --global user.name "deployment_bot"
6363
git config --global user.email "[email protected]"
64+
git remote set-url origin https://${{ secrets.GH_ACTOR }}:${{ secrets.GH_TOKEN }}@github.com/${{ github.repository }}
6465
if [[ -n $(git status --porcelain CHANGELOG.md) ]]; then
6566
git commit -m "chore: update changelog" \
6667
CHANGELOG.md \

0 commit comments

Comments
 (0)