Skip to content

Add optional "same branch only" input#7

Merged
softprops merged 9 commits intosoftprops:masterfrom
GoProperly:add_same_branch_only_input
Jul 11, 2020
Merged

Add optional "same branch only" input#7
softprops merged 9 commits intosoftprops:masterfrom
GoProperly:add_same_branch_only_input

Conversation

@gavinsharp
Copy link

@gavinsharp gavinsharp commented Jun 23, 2020

This adds a same-branch-only input which can be set to false if you want to wait on pending runs regardless of which branch they're from.

I was trying to use this action to prevent simultaneous deploys, but realized it would only work to prevent deploys from the same branch. In our setup all non-main branches deploy to the same environment, so I need to wait on any pending run, even if it is from a different branch.

(Even more ideal would be a way to say "wait for all main or non-main branches, depending on whether this is a run from main or non-main", but that seemed too complex and also maybe too unique to our particular deploy setup to be worth supporting.)

This parameter defaults to true to preserve existing behaviour.

@gavinsharp
Copy link
Author

gavinsharp commented Jun 23, 2020

It looks like passing undefined as the branch param to OctokitGitHub.runs is not behaving the way I would expect (finds no runs rather than finds all runs). Let me find a way to fix that.

@gavinsharp
Copy link
Author

It looks like passing undefined as the branch param to OctokitGitHub.runs is not behaving the way I would expect (finds no runs rather than finds all runs). Let me find a way to fix that.

Fixed in 53c876b.

@gavinsharp
Copy link
Author

I was trying to figure out a way to write a test to capture the actual functionality better, but since the underlying behaviour that matters (filtering by branch) lives in Octokit, testing a mocked Octokit didn't seem that useful.

@gavinsharp gavinsharp requested a review from softprops June 24, 2020 00:33
@softprops
Copy link
Owner

I'm sorry. I've let this one go. If you'd still like this functionality can you rebase with latest version of the code? I can commit to taking a look this weekend.

@gavinsharp
Copy link
Author

I'm sorry. I've let this one go. If you'd still like this functionality can you rebase with latest version of the code? I can commit to taking a look this weekend.

No worries. I've merged in master (just required a rebuild for dist/index.js, merged cleanly otherwise)

@gavinsharp
Copy link
Author

I lied: trivial fix also needed for the new test (935b7e2)

@douglascamata
Copy link

I'm waiting for this, thanks! <3

@chenrui333
Copy link
Collaborator

This would be a great addon for terraform operations (which relies on shared resources)

@softprops softprops merged commit 26642b6 into softprops:master Jul 11, 2020
@softprops
Copy link
Owner

I'll update the tag for this today

@gavinsharp gavinsharp deleted the add_same_branch_only_input branch July 11, 2020 19:42
@softprops
Copy link
Owner

updated the latest tag with this change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants