potiuk commented on pull request #12729: URL: https://github.com/apache/beam/pull/12729#issuecomment-685155548
@aaltay: It does cancel all previous, duplicate runs - including those from the forks. It works in a robust way and it removes the need of having a regular (every five minutes or so) cron job doing that. It was not possible previously to do it differently, because builds from fork did not have (for a good reason) permissions to cancel the jobs from the main repository. It has only be made possible by introducing the new `workflow_run` type of event by Github Actions: https://github.blog/2020-08-03-github-actions-improvements-for-fork-and-pull-request-workflows/ It works in the way, that every PR runs an accompanying "workflow_run" event that runs with the "write" permission to the "beam" project, and it runs from the "master" of the Beam repo (not the PR). This way you can run a cancel of duplicate runs for a build from fork without running any of the code coming from the fork. I've implemented [Cancel Workflow Runs](https://github.com/potiuk/cancel-workflow-runs/) action (based initially on the [cancel-previous-runs by n1hility](https://github.com/n1hility/cancel-previous-runs) that implements all that is need to have it nicely handled and used it in the Apache Airflow project where I am a committer and PMC member. This and general usage of 'workflow_run' helped us in Airflow to speed up our CI builds by ~25% and make it 10x more reliable). In your case it will optimise the use of jobs from GA for runs that are submitted from the same fork/branch in quick succession without having to rely on regular cron jobs run every few minutes. In the future you might also use some of the more complex features of my pluing (fast-fail for non-matrix jobs and killing heavy "workflow_run") - we utilise both in Apache Airflow and you might find it useful at some point in time in Beam. As I was helping @TobKed and @damgad as "consultant" in the project of improving Beam infrastructure, I also discussed the cancel one and since my action was ready to use, I helped @TobKed to get it configured and used. I hope you find it useful :) ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
