Skip to content

Add reusable PHPCS and AI-checklist workflows for plugin repos, PG-4897 - #45

Closed
snake14 wants to merge 10 commits into
mainfrom
PG-4897-shared-more-workflows
Closed

Add reusable PHPCS and AI-checklist workflows for plugin repos, PG-4897#45
snake14 wants to merge 10 commits into
mainfrom
PG-4897-shared-more-workflows

Conversation

@snake14

@snake14 snake14 commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Description

Extends the centralization started in #44 to the two remaining plugin workflows that are effectively identical across repositories:

  • plugin-phpcs.yml — the per-plugin phpcs.yml copies differ only in the lowercased plugin name passed to composer init and in drifted PHP versions (7.4 vs 8.1 across repos today); both become inputs. The setup-php action is pinned by hash, matching Add a reusable PHPStan workflow and the canonical pre-push hook, PG-4897 #44.
  • plugin-ai-checklist.yml — the per-plugin matomo-ai-checklist.yml is byte-identical in every repo that has one, and some repos simply lack it (ApiReference only gained it recently); a reusable workflow makes adoption a 7-line caller.

Caller shape, respectively:

name: PHPCS check
on: pull_request
jobs:
  phpcs:
    uses: matomo-org/github-action-tests/.github/workflows/plugin-phpcs.yml@main
    with:
      plugin-name: MyPlugin
name: AI Checklist
on:
  pull_request:
    types: [opened, synchronize, reopened, edited]
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
jobs:
  AiChecklist:
    uses: matomo-org/github-action-tests/.github/workflows/plugin-ai-checklist.yml@main

Deliberately excluded: matomo-tests.yml. It is generated by core's ./console generate:test-action and genuinely varies per plugin (custom PHP version matrices, --setup-script, --has-submodules, --protect-artifacts, per-repo cron schedules). Its centralization path is evolving the generator to emit a thin caller of a reusable workflow, which is a core change and should be its own ticket.

README documentation for these two will follow in #44 or after it merges, to avoid conflicting edits to the same README section.

Ticket: PG-4897.

Checklist

  • [✔] I have understood, reviewed, and tested all AI outputs before use
  • [✔] All AI instructions respect security, IP, and privacy rules

Review

snake14 added 8 commits August 4, 2026 14:18
matomo-tests.yml is deliberately excluded: it is produced by core's
generate:test-action and varies per plugin, so its centralization path
is through that generator.
Centralizing removes the reason the gate floated on main: an update is
now one SHA bump here instead of a change in every plugin repo. The
README section will conflict trivially with #44's; whichever merges
second rebases the append.
A called workflow cannot request more than its caller holds, so the
inherited blanket read scopes made every default-permission caller fail
at startup. PHPCS needs only contents: read; the checklist gate needs
pull-requests: read, which its callers grant explicitly.
@snake14 snake14 added the Needs Review For pull requests that need a code review. label Aug 4, 2026
lachiebol
lachiebol previously approved these changes Aug 4, 2026

@lachiebol lachiebol left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, do we have any plans to migrate our plugins over?

fail-fast: false
steps:
- name: Run tests
uses: matomo-org/github-action-checklist-gate@d5f101a2538ef30ddb3b06cc366f852c9851b588 # main as of 2026-08-04

Copy link
Copy Markdown

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?

Copy link
Copy Markdown

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

@snake14
snake14 marked this pull request as ready for review August 4, 2026 23:22
@snake14

snake14 commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

LGTM, do we have any plans to migrate our plugins over?

@lachiebol Yeah. I figured that I could have Claude open a bunch of PRs to migrate to shared workflows once these PRs are merged.

@snake14

snake14 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

Apologies @lachiebol . I realised that the workflow didn't have a name. Could you please give it another approval?

lachiebol
lachiebol previously approved these changes Aug 5, 2026
@snake14
snake14 requested a review from a team August 5, 2026 21:51
@snake14
snake14 removed request for a team and AltamashShaikh August 20, 2026 21:45
@snake14 snake14 removed the Needs Review For pull requests that need a code review. label Aug 20, 2026
@snake14

snake14 commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

Closing as this will go into a new repo.

@snake14 snake14 closed this Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants