Test Cancellation Behavior #5
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: Test Cancellation Behavior | |
on: | |
workflow_dispatch: | |
inputs: | |
wait_time: | |
description: 'Wait time in seconds' | |
required: true | |
default: '300' | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
test-cancellation: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Intentional failure | |
run: exit 1 | |
- name: Wait step (runs on failure) | |
if: always() | |
run: | | |
sleep 300 | |
- name: Always run step | |
if: always() | |
run: | | |
echo "This step should always run, even after cancellation" | |
echo "Current status: ${{ job.status }}" | |
- name: Final step | |
run: | | |
echo "If you see this, the workflow was not cancelled" |