-
Notifications
You must be signed in to change notification settings - Fork 26.3k
Cancel redundant GHA workflows #54685
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
💊 CI failures summary and remediationsAs of commit 884af22 (more details on the Dr. CI page):
🕵️ 1 new failure recognized by patternsThe following CI failures do not appear to be due to upstream breakages:
|
|
@samestep has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
| workflow_run: | ||
| types: | ||
| - requested | ||
| workflows: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the most lightweight way for us to cancel redundant workflows, but it comes at the potential cost of needing to list out all the names of our workflows here. It would not be too difficult to write a script that would generate the names, but I wonder if there's a better, more GH supported way to accomplish the same thing. (e.g., if there were some way to just specify all workflows with a *).
janeyx99
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
woohoo 🧠
|
Unlanding this because I just realized that
are things we do not actually want to cancel (e.g. on Will follow up with a reland that filters this to only cancel redundant workflows from PRs. |
|
This pull request has been reverted by 0b0a5dd. |
Summary: We've been using [pytorch/add-annotations-github-action](https://github.com/pytorch/add-annotations-github-action) to add annotations to PRs when they fail Flake8 or clang-tidy. Up until now, though, that functionality has only worked on PRs in pytorch/pytorch itself, not on PRs from forks. This PR fixes that using a technique from [this GitHub blog post](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/) (also linked in a comment in this diff). Pull Request resolved: #54779 Test Plan: janeyx99 and I tested this in the same GitHub repo used to test #54685 and #54693, including with PRs from forks. Reviewed By: walterddr Differential Revision: D27364777 Pulled By: samestep fbshipit-source-id: a830d372d7bb3b2529fc633b707b44f2b6cf9baa
Summary: We've been using [pytorch/add-annotations-github-action](https://github.com/pytorch/add-annotations-github-action) to add annotations to PRs when they fail Flake8 or clang-tidy. Up until now, though, that functionality has only worked on PRs in pytorch/pytorch itself, not on PRs from forks. This PR fixes that using a technique from [this GitHub blog post](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/) (also linked in a comment in this diff). Pull Request resolved: #54779 Test Plan: janeyx99 and I tested this in the same GitHub repo used to test #54685 and #54693, including with PRs from forks. Reviewed By: seemethere, xuzhao9 Differential Revision: D27470866 Pulled By: samestep fbshipit-source-id: d165b8e875d412b910592aa897163fb938d23365
This PR adds a lightweight workflow which runs when any of our GitHub Actions lint or test workflows start (currently just the three listed in the YAML in this PR's diff), and cancels redundant ones (e.g. if a PR author pushes several commits in rapid succession). Currently this isn't particularly impactful, but it would become more so if/when we add heavier workflows that run on PRs.
Initially we tried using
technote-space/auto-cancel-redundant-workflowinstead ofpotiuk/cancel-workflow-runs, but for some reason it the former doesn't seem to work even if triggered byworkflow_runwith theTARGET_RUN_IDinput set appropriately.Test plan:
@janeyx99 and I tested this in a separate GitHub repo, and confirmed that it successfully cancels redundant
push-triggered workflows on the source repo andpull_request-triggered workflows from forks.