Skip to content

Restrict trigger push branch for GitHub Workflow#6555

Open
apupier wants to merge 1 commit into
apache:mainfrom
apupier:configureTriggerPushForGitHubWorkflows
Open

Restrict trigger push branch for GitHub Workflow#6555
apupier wants to merge 1 commit into
apache:mainfrom
apupier:configureTriggerPushForGitHubWorkflows

Conversation

@apupier

@apupier apupier commented Jul 1, 2026

Copy link
Copy Markdown

Feature branches rarely need their own CI runs: the code is already tested when a pull request is opened against a release branch. If the push trigger has no branch restriction and pull_request is also configured, every push to a branch with an open PR runs the workflow twice: once for the push and once for the PR synchronisation.

Always give the push trigger an explicit list of branches: this stops branches created from a release branch from inheriting its workflow runs.

see https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=430408443#GitHubActionsRecommendedPractices-Restrictthepushtriggertospecificbranches

@apupier apupier force-pushed the configureTriggerPushForGitHubWorkflows branch from 6aad7d6 to 7b33314 Compare July 1, 2026 13:23
@gemmellr

gemmellr commented Jul 1, 2026

Copy link
Copy Markdown
Member

Personally I use CI runs on [fork] feature branches regularly so I'll find this rather annoying, though it can be worked around with the manual trigger (or some [ab]use of branch name conventions). I think its good to test things on forks before using the foundations shared resources with a run on a PR. If I need to update a PR I'll often tend to do it on a different fork branch before finally updating the PR branch when ready, though obviously that causes an extra fork run, and I know the same doesnt apply to everyone.

Cant read the wiki link currently as jira/confluence login is broken just now.

@apupier

apupier commented Jul 1, 2026

Copy link
Copy Markdown
Author

Cant read the wiki link currently as jira/confluence login is broken just now.

I copy-pasted the pointed chapter in the description, there isn't more information

Personally I use CI runs on [fork] feature branches regularly so I'll find this rather annoying, though it can be worked around with the manual trigger (or some [ab]use of branch name conventions). I think its good to test things on forks before using the foundations shared resources with a run on a PR. If I need to update a PR I'll often tend to do it on a different fork branch before finally updating the PR branch when ready, though obviously that causes an extra fork run, and I know the same doesnt apply to everyone.

Would it be suitable to provide another branch name for the ones you want to have workflow executed on your fork?

Otherwise, given that it doesn't seem that branches are created by committers directly on the Apache Artemis repo, the most often branches that are triggering the duplicated calls are the dependabot branches. So we could configure branches-ignore instead. We want for this solution on another repo apache/nifi#11376

@gemmellr

gemmellr commented Jul 1, 2026

Copy link
Copy Markdown
Member

Cant read the wiki link currently as jira/confluence login is broken just now.

I copy-pasted the pointed chapter in the description, there isn't more information

Personally I use CI runs on [fork] feature branches regularly so I'll find this rather annoying, though it can be worked around with the manual trigger (or some [ab]use of branch name conventions). I think its good to test things on forks before using the foundations shared resources with a run on a PR. If I need to update a PR I'll often tend to do it on a different fork branch before finally updating the PR branch when ready, though obviously that causes an extra fork run, and I know the same doesnt apply to everyone.

Would it be suitable to provide another branch name for the ones you want to have workflow executed on your fork?

Thats what I meant by "(or some [ab]use of branch name conventions)." yep, though it would still be a little annoying.

Otherwise, given that it doesn't seem that branches are created by committers directly on the Apache Artemis repo, the most often branches that are triggering the duplicated calls are the dependabot branches. So we could configure branches-ignore instead. We want for this solution on another repo apache/nifi#11376

Yep we dont use feature branches in the main repo, so I think the branches-ignore route to suppress duplicate runs for dependabot pushes might make the most sense here too. I always disliked that it doesnt use a fork, this is another reason to.

Feature branches rarely need their own CI runs: the code is already
tested when a pull request is opened against a release branch. If the
push trigger has no branch restriction and pull_request is also
configured, every push to a branch with an open PR runs the workflow
twice: once for the push and once for the PR synchronisation.

Always give the push trigger an explicit list of branches: this stops
branches created from a release branch from inheriting its workflow
runs.

see https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=430408443#GitHubActionsRecommendedPractices-Restrictthepushtriggertospecificbranches

Signed-off-by: Aurélien Pupier <apupier@ibm.com>
@apupier apupier force-pushed the configureTriggerPushForGitHubWorkflows branch from 7b33314 to 3fdac22 Compare July 1, 2026 15:01

@gemmellr gemmellr 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.

LGTM but lets give others some time to comment.

@clebertsuconic clebertsuconic requested review from clebertsuconic and removed request for clebertsuconic July 1, 2026 20:33
@clebertsuconic

Copy link
Copy Markdown
Contributor

LGTM

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.

3 participants