Hi there, I would like to build a GitHub app that automatically marks deployment statuses based on the status of an action.
Say I have the below workflow file, if this is running a deployment I have to manually mark the deployment status as ‘pending’ and then when it’s finished, or failed, I have to have a step to mark the corresponding deployment with that status as well. I want to remove those extra steps from my workflow file.
What I think I can do here is listen for the check_run event and find out if this check run was triggered by a deployment. If it is, I should be able to add deployment_status events to the corresponding deployment for the action. What’s missing: Finding the event that triggered the check_run / action run. I don’t believe I can do this right now.
Anyone have any ideas? Much appreciated!
name: 'Deploy'
on: ['deployment']
jobs:
deployment:
runs-on: 'ubuntu-latest'
steps:
- name: 'Checkout'
uses: 'actions/checkout@v1'
- name: 'Deployment pending'
uses: 'deliverybot/deployment-status@master'
with:
state: 'pending'
token: '${{ github.token }}'
- name: 'Deploy ${{ github.event.deployment.environment }}'
run: 'echo "do deploy..."'
- name: 'Deployment success'
if: success()
uses: 'deliverybot/deployment-status@master'
with:
state: 'success'
token: '${{ github.token }}'
- name: 'Deployment failure'
if: failure()
uses: 'deliverybot/deployment-status@master'
with:
state: 'failure'
token: '${{ github.token }}'