Skip to content

Job Run Attempt

Actions
Return the run attempt of the current job
v1.0.0
Latest
Star (0)

Job Run Attempt

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

How to Use the Action

action in workflow

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"

Output generated

Below screenshot shows the execution of the action.

  1. First execution - executed all steps

Screenshot 2023-01-04 at 3 59 05 PM

  1. Rerun of the 'second' job - executed only the action; subsequent steps skipped

Screenshot 2023-01-04 at 3 59 47 PM

Parameters

Name Required Input/Output Description
token Yes Input PAT Token for access
run-attempt Output Run attempt for the current job

License

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.

About

Return the run attempt of the current job
v1.0.0
Latest

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.