bobheadxi / deployments

🔖 GitHub Action for working painlessly with deployment statuses
https://github.com/marketplace/actions/github-deployments
MIT License
385 stars 64 forks source link

Add support for `auto_merge` and `required_contexts` #152

Open gjtorikian opened 1 year ago

gjtorikian commented 1 year ago

This PR extends the action to provide more configuration options when creating a deploy, by providing input support for auto_merge and required_contexts. More details can be found in the GitHub API docs: https://docs.github.com/en/rest/deployments/deployments?apiVersion=2022-11-28#create-a-deployment

auto_merge is fairly straightforward. It is currently defaulting to false, and we can preserve that in this change for backwards compatibility.

required_contexts, on the other hand, has three states:

  1. ["test", "lint"], which is a specific list of contexts to run
  2. [], which ignores all the contexts
  3. undefined, which means, "run the default list of contexts"

Currently, required_contexts is set to []. In order to preserve backwards compatibility, users will have to pass an explicit "null" string for this input (supporting case 3). Omitting this input will skip all the required checks (case 2, the current case). Providing a multiline string covers case 1:

      with:
        required_contexts: |-
          test
          lint
gjtorikian commented 1 year ago

I had to change the inputs logic a bit here:

bobheadxi commented 7 months ago

Thanks for the contribution - if you're still interested in landing this, could you resolve the conflicts and remove the extraneous docs formatting changes? Thank you!

gjtorikian commented 7 months ago

Sure, I've done that, and run prettier.