Skip to content

Improve workflow logic checks for private repos - #12939

Open
desrosj wants to merge 1 commit into
WordPress:trunkfrom
desrosj:adjust/github-actions-run-conditions
Open

Improve workflow logic checks for private repos#12939
desrosj wants to merge 1 commit into
WordPress:trunkfrom
desrosj:adjust/github-actions-run-conditions

Conversation

@desrosj

@desrosj desrosj commented Aug 7, 2026

Copy link
Copy Markdown
Member

This expands the conditional checks attached to GitHub Actions workflow jobs to further limit when pull_request events spawn workflow runs within forks and private mirrors.

When the repository is not WordPress/wordpress-develop, the workflow now must be triggered by a pull request that is marked ready for review for all private repositories.

In case someone wishes to run workflows in a draft PR, the Draft Workflow Runs label could be added to the pull request and all future workflows will run.

Trac ticket: Core-64893.

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code

Used for creating the initial PR. All changes were manually reviewed by me.


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@desrosj desrosj self-assigned this Aug 7, 2026
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

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.

Core Committers: Use this line as a base for the props when committing in SVN:

Props desrosj, jorbin.

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

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@aaronjorbin aaronjorbin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

  1. Is there a reason that this logic shouldn't also apply to draft PRs in this repo? It's something that could reduce the number of jobs which get spawned.

  2. I assume this is something that is backported down to 4.7, agree?

@desrosj

desrosj commented Aug 7, 2026

Copy link
Copy Markdown
Member Author
  1. Is there a reason that this logic shouldn't also apply to draft PRs in this repo? It's something that could reduce the number of jobs which get spawned.

The main motivation behind this PR was to reduce unexpectedly high usage in private repositories while creating pull requests as these have a monetary cost associated with them and can lead to high bills. Public workflow minutes are free, so I had not yet considered this.

The conditions are currently configured to say "everything always runs on WordPress/wordpress-develop, but only for pull_requests everywhere else" to avoid push events (which are most often associated with syncing a fork with the upstream repository) from running workflows unexpectedly.

It's possible to expand this to this public repo and public forks, I think something like this would work:

if: |
  (
    github.repository == 'WordPress/wordpress-develop' &&
    github.event_name != 'pull_request'
  ) || (
    github.event_name == 'pull_request' && (
      ! github.event.repository.private ||
      ! github.event.pull_request.draft ||
      contains( github.event.pull_request.labels.*.name, 'Draft Workflow Runs' )
    )
  )

However, a side effect of also targeting this repository is that contributors who are not org members would be unable to add the override label to a pull request since they lack the needed privileges. Instead, they would forced to mark a pull request "Ready for Review" to receive automated feedback on their work (even if the PR is not actually ready for a review from other contributors).

The maximum concurrent job limit for the WordPress GitHub organization was also just doubled from 500 to 1000, so it's less likely that a queue will build up. For these reasons, I think we should not require a PR to be marked Ready for Review to run GH Actions in this repo at this time.

2. I assume this is something that is backported down to 4.7, agree?

There were a number of tooling improvements during the 7.1 cycle that I think should be backported to all branches eligible to receive security updates. I agree that this should be added to the list.

@aaronjorbin

Copy link
Copy Markdown
Member

However, a side effect of also targeting this repository is that contributors who are not org members would be unable to add the override label to a pull request since they lack the needed privileges. Instead, they would forced to mark a pull request "Ready for Review" to receive automated feedback on their work (even if the PR is not actually ready for a review from other contributors).

That's a good point and makes a lot of sense to me. I think that overrides the benefits of reducing the number of jobs.

@aaronjorbin aaronjorbin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Confirmed that these are all the relevant workflows by grepping for "github.repository == 'WordPress/wordpress-develop'" in the workflows directory and checking each one that's not listed him. Each code block also looks generally correct to me.

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