diff --git a/.github/workflows/1-1-debug-message.yaml b/.github/workflows/1-1-debug-message.yaml index 021d49e..07b8c7a 100644 --- a/.github/workflows/1-1-debug-message.yaml +++ b/.github/workflows/1-1-debug-message.yaml @@ -10,7 +10,12 @@ jobs: runs-on: ubuntu-latest steps: - name: Print debug Step 1 - run: echo "Runner Debug Enabled => ${{ runner.debug }}" #RUNNER_DEBUG + run: | + if [ "$ACTIONS_STEP_DEBUG" = "true" ]; then + echo "Runner Debug Enabled" + else + echo "Runner Debug Disabled" + fi - name: Print debug Step 2 run: | diff --git a/.github/workflows/13-0-concurrency.yaml b/.github/workflows/13-0-concurrency.yaml new file mode 100644 index 0000000..90a9d4f --- /dev/null +++ b/.github/workflows/13-0-concurrency.yaml @@ -0,0 +1,20 @@ +name: Cancel_InProgress +run-name: Cancel In Progress Workflow +description: "This workflow cancels in-progress jobs when a new run is triggered." + +on: + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + cancel_in_progress_job: + runs-on: ubuntu-latest + steps: + - name: Cancel In Progress Jobs + run: echo "This job will cancel in-progress jobs for the same workflow and branch." + + + diff --git a/.github/workflows/13-1-jobs-concurrency.yaml b/.github/workflows/13-1-jobs-concurrency.yaml new file mode 100644 index 0000000..3141f6e --- /dev/null +++ b/.github/workflows/13-1-jobs-concurrency.yaml @@ -0,0 +1,13 @@ +name: Cancel_InProgress_Jobs +run-name: Cancel In Progress Jobs +description: "This workflow cancels in-progress jobs when a new run is triggered." + +on: + workflow_dispatch: + +jobs: + cancel_in_progress_job: + runs-on: ubuntu-latest + concurrency: + group: example-group + cancel-in-progress: true \ No newline at end of file diff --git a/README.md b/README.md index a51ce6d..990fefc 100644 --- a/README.md +++ b/README.md @@ -34,4 +34,8 @@ [![Fail_Job_By_Non_Zero](https://github.com/Albejr/github-workflow-learn/actions/workflows/11-0-action-fail.yaml/badge.svg?branch=main)](https://github.com/Albejr/github-workflow-learn/actions/workflows/11-0-action-fail.yaml) -[![Using_Matrix](https://github.com/Albejr/github-workflow-learn/actions/workflows/12-0-matrix.yaml/badge.svg?branch=main)](https://github.com/Albejr/github-workflow-learn/actions/workflows/12-0-matrix.yaml) \ No newline at end of file +[![Using_Matrix](https://github.com/Albejr/github-workflow-learn/actions/workflows/12-0-matrix.yaml/badge.svg?branch=main)](https://github.com/Albejr/github-workflow-learn/actions/workflows/12-0-matrix.yaml) + +[![Cancel_InProgress](https://github.com/Albejr/github-workflow-learn/actions/workflows/13-0-concurrency.yaml/badge.svg?branch=main)](https://github.com/Albejr/github-workflow-learn/actions/workflows/13-0-concurrency.yaml) + +[![Cancel_InProgress_Jobs](https://github.com/Albejr/github-workflow-learn/actions/workflows/13-1-jobs-concurrency.yaml/badge.svg?branch=main)](https://github.com/Albejr/github-workflow-learn/actions/workflows/13-1-jobs-concurrency.yaml) \ No newline at end of file