Description
When the prepare phase of the action fails (e.g., due to track_progress being used with an unsupported event type), the post-run cleanup step still attempts to delete the installation token, resulting in a confusing "Bad credentials" error in the logs.
Steps to Reproduce
- Configure workflow with
track_progress: true
- Trigger via
workflow_dispatch (unsupported event for track_progress)
- Observe prepare phase fails with:
##[error]Prepare step failed with error: track_progress is only supported for events: pull_request, issues, issue_comment, pull_request_review_comment, pull_request_review. Current event: workflow_dispatch
- Cleanup step then runs and shows:
curl -L \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer " \
...
{
"message": "Bad credentials",
"documentation_url": "https://docs.github.com/rest",
"status": "401"
}
Note the empty token value after "Authorization: Bearer ".
Expected Behavior
The cleanup step should check if a token was successfully acquired before attempting to delete it:
if [ -n "$TOKEN" ]; then
curl -L -X DELETE ...
fi
Actual Behavior
Cleanup runs unconditionally, resulting in a 401 error that can confuse users debugging workflow failures.
Impact
- Cosmetic/low severity - doesn't affect functionality
- Makes logs harder to interpret when debugging failures
- Users may think there's a credentials/permissions issue when the real error is elsewhere
Environment
- Action version: v1
- Event: workflow_dispatch
- Runner: ubuntu-latest
Description
When the prepare phase of the action fails (e.g., due to
track_progressbeing used with an unsupported event type), the post-run cleanup step still attempts to delete the installation token, resulting in a confusing "Bad credentials" error in the logs.Steps to Reproduce
track_progress: trueworkflow_dispatch(unsupported event for track_progress)Note the empty token value after
"Authorization: Bearer ".Expected Behavior
The cleanup step should check if a token was successfully acquired before attempting to delete it:
Actual Behavior
Cleanup runs unconditionally, resulting in a 401 error that can confuse users debugging workflow failures.
Impact
Environment