rerun job and check again exit code 1 error message #3
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: An action to test how to rerun jobs | |
on: | |
pull_request | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Fail | |
run: exit 1 | |
rerun-failed-jobs: | |
needs: build | |
if: failure() && fromJSON(github.run_attempt) < 3 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Import Secrets | |
id: vault-secrets | |
uses: hashicorp/vault-action@affa6f04da5c2d55e6e115b7d1b044a6b1af8c74 # v2.7.4 | |
with: | |
url: ${{ inputs.vault-addr }} | |
method: approle | |
roleId: ${{ inputs.vault-role-id }} | |
secretId: ${{ inputs.vault-secret-id }} | |
secrets: | | |
secret/data/products/test RETRIGGER_APP_ID; | |
secret/data/products/test RETRIGGER_APP_KEY; | |
- name: Generate a GitHub token | |
id: github-token | |
uses: tibdex/github-app-token@v2 | |
with: | |
app_id: ${{ steps.vault-secrets.outputs.RETRIGGER_APP_ID }} | |
private_key: ${{ steps.vault-secrets.outputs.RETRIGGER_APP_KEY }} | |
- name: Retrigger run | |
env: | |
GH_DEBUG: api | |
shell: bash | |
run: | | |
echo ${{ steps.github-token.outputs.token }} | gh auth login --with-token | |
gh workflow run rerunfailedjob.yml -R camunda/infra-test-retrying-failed-actions --ref=main -F run_id=${{ inputs.run-id }} -F repository=${{ inputs.repository }} -F error_message=${{ inputs.error-message }} |