Skip to content

chore(gha): Create self-hosted runner auto-retry action #4

chore(gha): Create self-hosted runner auto-retry action

chore(gha): Create self-hosted runner auto-retry action #4

Workflow file for this run

name: Hello World Action
on:
pull_request
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Print Hello World
run: |
echo "Hello, World!"
sleep 20
- name: Print something
if: ${{ cancelled() }}
run: |
# Fetch information about the workflow run
echo "fetching current workflow run"
API_URL="https://api.github.com/repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
WORKFLOW_RUN=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" $API_URL)
# Rerun failed jobs
echo "rerunning failed job"
RERUN_URL="https://api.github.com/repos/${GITHUB_REPOSITORY_OWNER}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/rerun-failed-jobs"
curl -X POST -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" $RERUN_URL