Skip to content

12 - Run Workflow

12 - Run Workflow #140

name: 12 - Run Workflow
on:
workflow_run:
workflows: ["12 - Workflow Tester"]
types: [completed] #requested
jobs:
on-success:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- run: echo "First workflow was a success"
on-failure:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
steps:
- run: |
echo "First workflow was a failure"
echo "Let's dispatch another event for backup"
curl -X POST https://api.github.com/repos/GuillaumeFalourd/poc-github-actions/dispatches \
-H 'Accept: application/vnd.github.everest-preview+json' \
-u ${{ secrets.ACCESS_TOKEN }} \
--data '{"event_type": "Start Dispatch Event Workflow", "client_payload": { "repository": "'"$GITHUB_REPOSITORY"'" }}'
test:
runs-on: ubuntu-latest
steps:
- name: Show workflow_run
env:
WORKFLOW_CONTEXT: ${{ toJSON(github.event.workflow_run) }}
run: |
echo ${{ github.event.workflow_run }}
echo $WORKFLOW_CONTEXT