Skip to content

CI: Skip workflow jobs that should not run on forks#77081

Open
dd32 wants to merge 1 commit intoWordPress:trunkfrom
dd32:fix/claude/fork-workflow-runs
Open

CI: Skip workflow jobs that should not run on forks#77081
dd32 wants to merge 1 commit intoWordPress:trunkfrom
dd32:fix/claude/fork-workflow-runs

Conversation

@dd32
Copy link
Copy Markdown
Member

@dd32 dd32 commented Apr 7, 2026

What

Adds fork-repository guards to three workflow jobs that currently run (and in one case, fail) on every push to trunk in forked repositories.

Why

When syncing a fork of WordPress/gutenberg, every push to trunk triggers workflow runs. Most jobs are correctly gated with github.repository == 'WordPress/gutenberg' || github.event_name == 'pull_request', but three are not:

  1. unit-test.ymlunit-php aggregator job — gated only by if: always(). When test-php and phpcs are skipped on a fork, this job runs and evaluates needs.test-php.result != 'success'. Since skipped != success, it exits 1, marking every fork push as a failed Unit Tests run. This is the most visible problem — forks see a red ❌ on every commit synced from upstream.

  2. end2end-test.ymlmerge-artifacts job — gated only by if: !cancelled(). The upstream e2e-playwright job is correctly skipped on forks, but merge-artifacts still spins up a runner, checks out the repo, and runs npm install for nothing.

  3. sync-backport-changelog.yml — has no fork guard at all. On every push to trunk in a fork it attempts to look up an issue with the 🤖 Sync Backport Changelog label in the fork itself, which is meaningless outside of WordPress/gutenberg.

How

Each job now also checks github.repository == 'WordPress/gutenberg' || github.event_name == 'pull_request', matching the guard already used by the sibling jobs in the same workflows.

Testing instructions

  • Verify the unit-test workflow still passes on a PR (the pull_request branch of the condition is unchanged).
  • After merging, fork pushes to trunk should no longer show the failing Unit Tests run, the Merge Artifacts job should be skipped, and Sync Core Backport Issue should not run.

🤖 Generated with Claude Code

Several workflow jobs were running (and one was failing) on push events
to forked repositories despite their parent jobs being correctly gated.

- unit-test.yml: The unit-php aggregator job ran with `if: always()`,
  so when test-php and phpcs were skipped on forks it evaluated
  `needs.test-php.result != 'success'` and exited 1, marking every
  fork push as failed.
- end2end-test.yml: merge-artifacts ran with only `!cancelled()`, so
  it spun up a runner on every fork push for nothing.
- sync-backport-changelog.yml: had no fork guard at all and tried to
  update issues in the fork repository on every push to trunk.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@dd32 dd32 requested a review from desrosj as a code owner April 7, 2026 05:27
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 7, 2026

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: dd32 <dd32@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@dd32 dd32 added the [Type] Build Tooling Issues or PRs related to build tooling label Apr 7, 2026
@dd32
Copy link
Copy Markdown
Member Author

dd32 commented Apr 7, 2026

The above is Claude-generated.

The reason I was looking into this was that my personal free GitHub actions usage/actions-storage was being used up in a matter of days, Gutenberg (behind Playground) was the largest user of resources.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Build Tooling Issues or PRs related to build tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant