-
Notifications
You must be signed in to change notification settings - Fork 8
Add reusable PHPCS and AI-checklist workflows for plugin repos, PG-4897 #45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
f1d4a00
Add reusable PHPCS and AI-checklist workflows for plugin repos, PG-4897
snake14 399573d
Pass the plugin name to the shell via env rather than template interp…
snake14 ea97f2e
Validate the plugin name up front
snake14 8add14a
Pin all actions to commit SHAs
snake14 b17ac7b
Pin the checklist gate by SHA and document both reusable workflows
snake14 74ca2cf
Document the pinning trade-off for the workflow references
snake14 d915c83
Grant callers-compatible minimal permissions
snake14 66feecf
Quote the derived composer package name
snake14 608b7b6
Give the checklist gate job a display name
snake14 b953b61
Merge remote-tracking branch 'origin/main' into PG-4897-shared-more-w…
snake14 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| name: AI Checklist | ||
|
|
||
| on: | ||
| workflow_call: {} | ||
|
|
||
| # The gate reads the pull request description; callers must grant these two | ||
| # scopes in their own permissions block. | ||
| permissions: | ||
| actions: read | ||
| pull-requests: read | ||
|
|
||
| jobs: | ||
| AiChecklist: | ||
| name: AI checklist gate | ||
| runs-on: ubuntu-24.04 | ||
| strategy: | ||
| fail-fast: false | ||
| steps: | ||
| - name: Run tests | ||
| uses: matomo-org/github-action-checklist-gate@d5f101a2538ef30ddb3b06cc366f852c9851b588 # main as of 2026-08-04 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| name: PHPCS check | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| plugin-name: | ||
| description: "Name of the plugin, e.g. LoginLdap" | ||
| required: true | ||
| type: string | ||
| php-version: | ||
| description: "PHP version the job runs on" | ||
| required: false | ||
| type: string | ||
| default: '7.4' | ||
|
|
||
| # The job only reads the repository; everything else stays at none so any caller | ||
| # with default workflow permissions can use this without granting scopes. | ||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| phpcs: | ||
| name: PHPCS | ||
| runs-on: ubuntu-24.04 | ||
| steps: | ||
| - name: Validate inputs | ||
| env: | ||
| PLUGIN_NAME: ${{ inputs.plugin-name }} | ||
| run: | | ||
| if [[ ! "$PLUGIN_NAME" =~ ^[A-Za-z0-9_]+$ ]]; then | ||
| echo "Invalid plugin-name: $PLUGIN_NAME" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 | ||
| with: | ||
| lfs: false | ||
| persist-credentials: false | ||
| - name: Setup PHP | ||
| uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2 | ||
| with: | ||
| php-version: ${{ inputs.php-version }} | ||
| tools: cs2pr | ||
| - name: Install dependencies | ||
| env: | ||
| PLUGIN_NAME: ${{ inputs.plugin-name }} | ||
| run: | ||
| composer init --name="matomo/$(echo "$PLUGIN_NAME" | tr '[:upper:]' '[:lower:]')" --quiet; | ||
| composer --no-plugins config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true -n; | ||
| composer config repositories.matomo-coding-standards vcs https://github.com/matomo-org/matomo-coding-standards -n; | ||
| composer require matomo-org/matomo-coding-standards:dev-master; | ||
| composer install --dev --prefer-dist --no-progress --no-suggest | ||
| - name: Check PHP code styles | ||
| id: phpcs | ||
| run: ./vendor/bin/phpcs --report-full --standard=phpcs.xml --report-checkstyle=./phpcs-report.xml | ||
| - name: Show PHPCS results in PR | ||
| if: ${{ always() && steps.phpcs.outcome == 'failure' }} | ||
| run: cs2pr ./phpcs-report.xml --prepend-filename |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason we use this d5f1 commit instead of main?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I see in the readme