GitHub/rerun: Difference between revisions

From Omnia
Jump to navigation Jump to search
(Created page with "== auto-rerun == ref: https://github.com/orgs/community/discussions/67654#discussioncomment-8038649 === test.yml === <pre> test.yml: on: push jobs: fail: runs-on: ubuntu-latest steps: - run: false re-run: needs: fail if: failure() && fromJSON(github.run_attempt) < 3 runs-on: ubuntu-latest steps: - env: GH_REPO: ${{ github.repository }} GH_TOKEN: ${{ github.token }} GH_DEBUG: api run: gh wor...")
 
No edit summary
Line 1: Line 1:
== auto-rerun ==
== auto-rerun ==


ref: https://github.com/orgs/community/discussions/67654#discussioncomment-8038649
* ref: https://stackoverflow.com/questions/71574593/how-to-automatically-retry-github-action-jobs-on-failure
* ref: https://github.com/orgs/community/discussions/67654#discussioncomment-8038649


=== test.yml ===
=== test.yml ===

Revision as of 09:59, 20 July 2026

auto-rerun

test.yml

test.yml:

on: push
jobs:
  fail:
    runs-on: ubuntu-latest
    steps:
      - run: false
  re-run:
    needs: fail
    if: failure() && fromJSON(github.run_attempt) < 3
    runs-on: ubuntu-latest
    steps:
      - env:
          GH_REPO: ${{ github.repository }}
          GH_TOKEN: ${{ github.token }}
          GH_DEBUG: api
        run: gh workflow run rerun.yml -F run_id=${{ github.run_id }}

rerun.yml

on:
  workflow_dispatch:
    inputs:
      run_id:
        required: true
jobs:
  rerun:
    runs-on: ubuntu-latest
    steps:
      - name: rerun ${{ inputs.run_id }}
        env:
          GH_REPO: ${{ github.repository }}
          GH_TOKEN: ${{ github.token }}
          GH_DEBUG: api
        run: |
          gh run watch ${{ inputs.run_id }} > /dev/null 2>&1
          gh run rerun ${{ inputs.run_id }} --failed

keywords