Description
When a workflow run is cancelled using the cancel button in the UI, the post-run cleanup steps (defined as post: in action metadata) are not executed. This is a significant issue because post-run steps are critical for:
- Resource cleanup (stopping containers, cleaning temporary files, releasing locks)
- Artifact publishing (uploading logs or reports even on cancellation)
- Notification systems (notifying external services that the workflow ended)
- State management (ensuring system consistency)
Current Behavior
- User clicks "Cancel workflow run" button on the UI
- The
Cancel() handler in routers/web/repo/actions/view.go is invoked
actions_model.CancelJobs() is called, which immediately sets job status to StatusCancelled
- The job is marked as done, and no post-run steps are executed
- Cleanup tasks that should run are skipped entirely
Expected Behavior (GitHub Actions)
GitHub Actions always executes post-run steps, regardless of:
- Workflow cancellation (user clicked cancel button)
- Job failure
- Timeout
- Step failure
This ensures resource cleanup and notification always occur.
Steps to Reproduce
- Create a workflow with at least one regular step and one post-run cleanup step
- Start the workflow run
- While the workflow is running, click the "Cancel" button
- Observe that post-run steps do not execute (they are skipped entirely)
- Resources that should be cleaned up remain uncleaned
Expected Result
Post-run steps should execute after cancellation, allowing proper cleanup before the job terminates.
Actual Result
Post-run steps are skipped when a workflow is cancelled, leaving resources in an inconsistent state.
Proposed Solution
Implement a state transition that allows post-run steps to execute even when a workflow is cancelled:
Running → Cancelling → PostRunning → Cancelled
Gitea Version
1.25.5
Can you reproduce the bug on the Gitea demo site?
Yes
Log Gist
No response
Screenshots
No response
Git Version
No response
Operating System
No response
How are you running Gitea?
independent of running gitea
Database
None
Description
When a workflow run is cancelled using the cancel button in the UI, the post-run cleanup steps (defined as
post:in action metadata) are not executed. This is a significant issue because post-run steps are critical for:Current Behavior
Cancel()handler inrouters/web/repo/actions/view.gois invokedactions_model.CancelJobs()is called, which immediately sets job status toStatusCancelledExpected Behavior (GitHub Actions)
GitHub Actions always executes post-run steps, regardless of:
This ensures resource cleanup and notification always occur.
Steps to Reproduce
Expected Result
Post-run steps should execute after cancellation, allowing proper cleanup before the job terminates.
Actual Result
Post-run steps are skipped when a workflow is cancelled, leaving resources in an inconsistent state.
Proposed Solution
Implement a state transition that allows post-run steps to execute even when a workflow is cancelled:
Gitea Version
1.25.5
Can you reproduce the bug on the Gitea demo site?
Yes
Log Gist
No response
Screenshots
No response
Git Version
No response
Operating System
No response
How are you running Gitea?
independent of running gitea
Database
None