GitHub Deployments

No description specified

Warning: This section is under construction

Every gh CLI command below will rely on a few variables being set. Additionally, every command has a curl alternative. In my opinion, the curl alternative is a lot more cumbersome as you need to pass an Authorization header each time.

List deployments

https://docs.github.com/en/rest/deployments/deployments#list-deployments

Create a Deployment

https://docs.github.com/en/rest/deployments/deployments#create-a-deployment

Failures

If the ref doesn't exist:

If any commit status checks failed...

Resolving

Success

Deployment Statuses

List deployment statuses

https://docs.github.com/en/rest/deployments/statuses

Note: This will likely be empty until a deployment status has been created.

Create a deployment status

https://docs.github.com/en/rest/deployments/statuses#create-a-deployment-status

1 deployment's environment can be flipped to whatever.

You’ll get an audit log of changes at when you list deployment statuses


state can be one of: error, failure, inactive, in_progress, queued, pending, success The state of the status. When you set a transient deployment to inactive, the deployment will be shown as destroyed in GitHub.


When creating a success state, you'll see an entry like

f7a9870 was deployed by Avatar thiskevinwang 2 hours ago Active

  • deployed: the value that was passed into log_url. If no log_url was passed, the UI will not render a link.

Use cases?

With GitHub actions

https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#deployment

https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#deployment_status

You could run a GitHub action when a 3rd party platform like Vercel, Netlify, or Heroku