Job Run Attempt
ActionsTags
(2)Return the run attempt of the current job.
The job-run-attempt action helps us to implement the workflow to Prevent/Block or Conditionally rerun the subsequent steps in the job based on the run attempt.
run-attempt == 1 : indicates the first run of the job
run-attempt > 1 : indicates the Rerun of the job
Include the job-run-attempt action in your workflow.
- name: Testing Job Run Attempt action
id: runst
uses: ambilykk/job-run-attempt@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Execute only first time; no rerun
if: ${{steps.runst.outputs.run-attempt == 1}}
run: |
echo " Execute only once; no rerun allowed"
Below screenshot shows the execution of the action.
- First execution - executed all steps
- Rerun of the 'second' job - executed only the action; subsequent steps skipped
Name | Required | Input/Output | Description |
---|---|---|---|
token | Yes | Input | PAT Token for access |
run-attempt | Output | Run attempt for the current job |
The scripts and documentation in this project are released under the MIT License
Job Run Attempt is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.