potiuk commented on pull request #31104:
URL: https://github.com/apache/spark/pull/31104#issuecomment-758653641


   1) The cancelation worklfow must run in master branch in order to utlise 
GITHUB_TOKEN that has "write" capabilities (otherwise you have no rights to 
cancel workflo). This is how 'workflow_run' type of even works - it always runs 
using `master` code. See this stack-overflow question for example : 
https://stackoverflow.com/questions/63343937/how-to-use-the-github-actions-workflow-run-event#:~:text=The%20new%20workflow_run%20event%20enables,token%20as%20well%20as%20secrets.
   
   This is due to security reasons. Otherwise any person could make a PR where 
they could change the workflow and do whatever they want to your repository. 
Workflow_run always runs wtith the workflow that is defined in your master, not 
in the PR. In order to test any change in the workflow_run you have to push it 
as master (I, for example, test such changes by pushing the PR branch as 
"master" to my own fork `github push -f potiuk <branch>:master` (where `potiuk` 
is the remote which is my own private fork).
   
   2) Yes. The action is 'aggressive` because it is only useful if you are in 
the situation where your queue is "full" which means that any new action 
(including the cancel one) might take hours to even start executing. So if 
'any' of the cancel workflows starts running - even from PRs that were created 
hours ago (just to remind - it's always using a master code) - this action 
looks at ALL builds and cancel ALL duplicate ones. That by default includes all 
"push" events (any merge to master is 'push', "schedule" events, "pull_request" 
- both coming from forks and pull requests that are done inside the repo.
   
   The mode of cancelling 'cancelAllDuplicates` does exactly this. It does not 
even look at the original branch/PR that triggered it.
   
   3) The change I am opening changes it's behaviour - it will not look for 
duplicates when there is a "push" or "schedule" event. Which means it will be 
cancelling ALL duplicates in ALL PRs opened that have more than one build in 
progress. This means that whenever cancel workflow has a chance to run, only 
the latest PR push will continue executing, others will be cancelled.
   
   
   


----------------------------------------------------------------
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]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to