Restrict trigger push branch for GitHub Workflow#716
Conversation
| on: [push, pull_request] | ||
| on: | ||
| push: | ||
| branches: |
There was a problem hiding this comment.
Whilst I agree that it would be good to restrict the workflows. it seems to me that this approach is somewhat fragile, in that it depends on enumerating the branches where the check should always run.
The names of these branches can change, and it would be easy to overlook the need to update the workflow when renaming a branch or adding a new branch that must have push checks.
Also, when a branch associated with a PR is updated, surely one wants to run the checks again?
There was a problem hiding this comment.
Whilst I agree that it would be good to restrict the workflows. it seems to me that this approach is somewhat fragile, in that it depends on enumerating the branches where the check should always run.
The names of these branches can change, and it would be easy to overlook the need to update the workflow when renaming a branch or adding a new branch that must have push checks.
Given that it seems usually the branches are creating on branches of the contributors for this repo, we can also configure to ignore dependabot branches. it will cover most of the cases.
Also, when a branch associated with a PR is updated, surely one wants to run the checks again?
In this case, the checks are run again for the PR due to the pull_request event
There was a problem hiding this comment.
let me update the PR to use branches-ignore
There was a problem hiding this comment.
This would certainly help, as dependabot causes most of the builds.
However ideally workflows should only run once when a change is made to a branch that is part of a PR.
[I'm surprised that GH does not make this easy, as it could reduce their load considerably]
There was a problem hiding this comment.
However ideally workflows should only run once when a change is made to a branch that is part of a PR.
[I'm surprised that GH does not make this easy, as it could reduce their load considerably]
Totally agree!
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>
b9b1be9 to
79dbcf4
Compare
|
Thanks - let's see how this works out |
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
Thanks for your contribution to Apache Commons! Your help is appreciated!
Before you push a pull request, review this list:
mvn; that'smvnon the command line by itself.