Update the status of a deployment in your repo. Use in your workflows that react to the deployment event.
Create a new deployment, either from your tooling or from another workflow (using avakar/create-deployment, for example). Then include this action in your deployment workflow.
on: deploy
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: avakar/set-deployment-status@v1
with:
state: in_progress
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: |
echo 'Performing the deployment...'
sleep 10
- uses: avakar/set-deployment-status@v1
with:
state: success
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: avakar/set-deployment-status@v1
if: failure()
with:
state: failure
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Petition GitHub to allow success/failure context functions outside
of the if
entry and then you'll be able to replace the last
two steps with the following.
- uses: avakar/set-deployment-status@v1
if: always()
with:
state: ${{ success() }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Or, better yet, let actions retrieve the status on their own and then we can do the final update as a post-action.
See the Developer API documentation for an explanation of the
input parameters. Both ant-man
and flash
previews are enabled.
state
: required, one oferror
,failure
,inactive
,in_progress
,queued
,pending
, orsuccess
.deployment_id
: defaults togithub.event.deployment.id
; you don't have to specify it if you're being triggered by the "deployment" event.auto_inactive
: defaults totrue
description
environment_url
log_url
deployment_status_id
: the numeric ID of the new deployment statusdeployment_status_url
: the API url of the new deployment status