action-workflow-run-wait
                                
                                
                                
                                    action-workflow-run-wait copied to clipboard
                            
                            
                            
                        Include completed successful runs when deduplicating
This fixes the issue from https://github.com/ahmadnassri/action-workflow-run-wait/pull/3#issuecomment-784334866:

Basically, if you have 3 (or more) upstream workflows, each of them will trigger a run of the workflow calling this action (let's call it "Deploy", as in the image); the current code looks for other in progress or queued runs of the same workflow for the same hash as the current one, and cancels all but the first started one.
This creates a race condition, because:
- when the last of the upstream workflows finishes, it fires up a Deploy workflow, which gets queued for a random amount of time, depending on runner availability
 - in the mean time, the oldest Deploy figures out it can move forward because it checks every 5 seconds by default, moves on and finishes (in this case it fires a webhook payload to a Jenkins machine, but it could be anything that doesn't take much time)
 - when the last started Deploy finally gets to run, it looks for other runs in progress or queued, figures out it's alone and happily fires up a second time, because all conditions are met
 
This PR adds completed successful workflows of the same SHA as the current run to the list of cancellable runs, allowing the action to cancel the current workflow if it already ran successfully for the same commit before.
is everything ok with this?
is everything ok with this?
sorry I missed the notification for this, reviewed now
I'm also facing the same issue covered by this PR. Can this implementation be merged?