Skip to content

Commit 73606a3

Browse files
committed
GH Actions: prepare the workflow for auto-generating output snippets
1 parent 8a6e624 commit 73606a3

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

.github/workflows/publish-wiki.yml

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ on:
1414
# Allow running this workflow manually from the Actions tab.
1515
workflow_dispatch:
1616
# Allow this workflow to be triggered from outside.
17+
repository_dispatch:
18+
types:
19+
- 'phpcs-release'
1720

1821
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
1922
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
@@ -38,6 +41,37 @@ jobs:
3841
- name: Checkout code
3942
uses: actions/checkout@v4
4043

44+
- name: Install PHP
45+
uses: shivammathur/setup-php@v2
46+
with:
47+
php-version: 'latest'
48+
ini-values: error_reporting=-1, display_errors=On, log_errors_max_len=0
49+
tools: phpcs, phpcbf
50+
coverage: none
51+
52+
# Make sure we've gotten the latest PHPCS version from setup-php.
53+
- name: Retrieve latest release info
54+
uses: octokit/[email protected]
55+
id: get_latest_release
56+
with:
57+
route: GET /repos/PHPCSStandards/PHP_CodeSniffer/releases/latest
58+
env:
59+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60+
61+
- name: Grab latest tag name from API response
62+
id: latest_version
63+
run: |
64+
echo "TAG=${{ fromJson(steps.get_latest_release.outputs.data).tag_name }}" >> "$GITHUB_OUTPUT"
65+
66+
- name: Grab the version
67+
id: phar_version
68+
# yamllint disable-line rule:line-length
69+
run: echo "VERSION=$(phpcs --version | grep --only-matching --max-count=1 --extended-regexp '\b[0-9]+(\.[0-9]+)+')" >> "$GITHUB_OUTPUT"
70+
71+
- name: Fail the build if the PHAR is not the correct version
72+
if: ${{ steps.phar_version.outputs.VERSION != steps.latest_version.outputs.TAG }}
73+
run: exit 1
74+
4175

4276
# ################################################################################
4377
# Update Wiki files.
@@ -94,7 +128,7 @@ jobs:
94128
A dry-run has been executed on your PR, executing all markdown pre-processing for the wiki files.
95129
96130
Please review the resulting final markdown files via the [created artifact](${{ steps.artifact.outputs.artifact-url }}).
97-
This is especially important when adding new pages.
131+
This is especially important when adding new pages or updating auto-generated output blocks.
98132
99133
_N.B.: the above link will automatically be updated when this PR is updated._
100134

0 commit comments

Comments
 (0)