Skip to content

Commit e100547

Browse files
committed
GH Actions: auto-trigger update of schema website
Adds a workflow job to send out a GH API request whenever a new release is tagged. The API request will trigger a workflow in the https://github.com/PHPCSStandards/schema.phpcodesniffer.com repository, which will update the schema.phpcodesniffer.com website. As this is a cross-repo request, the standard GH secret is not sufficient. A Personal Access Token has been created on the PHPCSStandards organisation to facilitate workflow dispatches. This PAT has been added to the repo actions secrets, so it can be safely used in this workflow. The PAT token is a fine-grained one and needs the following permissions for this dispatch to succeed: - contents: read & write - metadata: read only (automatically selected when selecting the contents permission) Note: The Personal Access Token needs to be renewed once a year. Fixes 1094 (together with the newly set up https://github.com/PHPCSStandards/schema.phpcodesniffer.com repo
1 parent 7ee9c2b commit e100547

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

.github/workflows/verify-release.yml

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,25 @@ concurrency:
2121
cancel-in-progress: true
2222

2323
jobs:
24+
###############################################################
25+
# Trigger an update of the schema.phpcodesniffer.com website. #
26+
###############################################################
27+
trigger-schema-site-update:
28+
runs-on: ubuntu-latest
29+
30+
# Only run this workflow in the context of this repo.
31+
if: github.repository_owner == 'PHPCSStandards'
32+
33+
name: "Trigger update of schema website"
34+
35+
steps:
36+
- name: Trigger schema website update
37+
uses: peter-evans/repository-dispatch@v3
38+
with:
39+
token: ${{ secrets.WORKFLOW_DISPATCH_PAT }}
40+
repository: PHPCSStandards/schema.phpcodesniffer.com
41+
event-type: phpcs-release
42+
2443
##################################################################################
2544
# Verify the release is available in all the right places and works as expected. #
2645
##################################################################################
@@ -129,9 +148,9 @@ jobs:
129148
if: ${{ steps.asset_version.outputs.VERSION != steps.version.outputs.TAG }}
130149
run: exit 1
131150

132-
# #########################################
133-
# Verify install via PHIVE.
134-
# #########################################
151+
#############################
152+
# Verify install via PHIVE. #
153+
#############################
135154
verify-phive:
136155
runs-on: ubuntu-latest
137156

0 commit comments

Comments
 (0)