diff --git a/.github/workflows/build_commit.yaml b/.github/workflows/build_commit.yaml new file mode 100644 index 0000000..c980ec0 --- /dev/null +++ b/.github/workflows/build_commit.yaml @@ -0,0 +1,18 @@ +name: PR 15-Min Build Pass Job + +on: + pull_request: + branches: + - main # or your default target branch + types: [opened, synchronize, reopened] + +jobs: + run-if-branch-has-build: + if: contains(github.head_ref, 'build') + runs-on: ubuntu-latest + steps: + - name: Sleep for 15 minutes + run: sleep 900 # 900 seconds = 15 minutes + + - name: Done + run: echo "✅ Job passed after 15 minutes on branch '${{ github.head_ref }}'" diff --git a/.github/workflows/fail_commit.yaml b/.github/workflows/fail_commit.yaml new file mode 100644 index 0000000..8b5f8f3 --- /dev/null +++ b/.github/workflows/fail_commit.yaml @@ -0,0 +1,20 @@ +name: PR 5-Min Fail Job for 'fail' Commits + +on: + pull_request: + branches: + - main # or your default target branch + types: [opened, synchronize, reopened] + +jobs: + run-if-commit-has-fail: + if: contains(github.event.pull_request.head.commit.message, 'fail') + runs-on: ubuntu-latest + steps: + - name: Sleep for 5 minutes + run: sleep 300 + + - name: Fail on purpose + run: | + echo "❌ Failing the job after 5 minutes due to commit: '${{ github.event.pull_request.head.commit.message }}'" + exit 1 diff --git a/.github/workflows/pass.yaml b/.github/workflows/pass.yaml index 92bb21d..96d901e 100644 --- a/.github/workflows/pass.yaml +++ b/.github/workflows/pass.yaml @@ -1,4 +1,4 @@ -name: PR 5-Min Pass Job for 'pass' Commits +name: PR 5-Min Pass Job for 'pass' Branches on: pull_request: @@ -7,12 +7,12 @@ on: types: [opened, synchronize, reopened] jobs: - run-if-commit-has-pass: + run-if-branch-has-pass: + if: contains(github.head_ref, 'pass') runs-on: ubuntu-latest - if: contains(github.event.pull_request.head.commit.message, 'pass') steps: - name: Sleep for 5 minutes run: sleep 300 - name: Done - run: echo "✅ Passed after 5 minutes due to commit: ${{ github.event.pull_request.head.commit.message }}" + run: echo "✅ Passed after 5 minutes for branch '${{ github.head_ref }}'" diff --git a/.github/workflows/pass_commit.yaml b/.github/workflows/pass_commit.yaml new file mode 100644 index 0000000..92bb21d --- /dev/null +++ b/.github/workflows/pass_commit.yaml @@ -0,0 +1,18 @@ +name: PR 5-Min Pass Job for 'pass' Commits + +on: + pull_request: + branches: + - main # or your default branch + types: [opened, synchronize, reopened] + +jobs: + run-if-commit-has-pass: + runs-on: ubuntu-latest + if: contains(github.event.pull_request.head.commit.message, 'pass') + steps: + - name: Sleep for 5 minutes + run: sleep 300 + + - name: Done + run: echo "✅ Passed after 5 minutes due to commit: ${{ github.event.pull_request.head.commit.message }}"