fix: prevent premature token revocation in reusable workflows #1081
No reviewers
Labels
No labels
FreeBSD
Kind/Breaking
Kind/Bug
Kind/Chore
Kind/DependencyUpdate
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
Windows
linux-powerpc64le
linux-riscv64
linux-s390x
run-end-to-end-tests
run-forgejo-tests
run-multi-platform-tests
No milestone
No assignees
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
forgejo/runner!1081
Loading…
Reference in a new issue
No description provided.
Delete branch ":fix/reusable-workflow-finalization-and-token-revocation"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
When using reusable workflows, the Forgejo runner prematurely revokes
GITHUB_TOKENafter the first step completes, causing subsequent steps to fail with authentication errors.Reproduction
When the reusable workflow contains multiple steps that require authentication:
https://code.forgejo.org/forgejo/runner/actions/runs/11197/jobs/2/attempt/1#jobstep-5-1035 the CI failure is related.
@earl-warren wrote in #1081 (comment):
Fixed, should work now
@syncstack The change here looks to make sense to me, but it is still failing another integration test
TestRunner_RunEvent/uses-composite-check-for-input-in-if-uses.@mfenniak I deployed the exact
uses-composite-check-for-input-in-if-usesworkflow to my repository running the patched runner, and all steps pass successfully.I've retriggered the CI workflow to see if it's a transient failure.
This is very well done, impressive.
Thank you! It was a tricky one to debug, glad the solution works well.
Could you please create an associated bug report that includes a reproducer to run this against? It could be used to add a end-to-end test at https://code.forgejo.org/forgejo/end-to-end/src/branch/main/actions
This is a tricky part of the runner codebase: currently implemented more as a hack than a feature, which makes it hard to work with. Writing tests in such a context is very difficult kudos.
cascading-pr updated at actions/setup-forgejo#721
If this a reproducer matching this bug fix, there is no need to create another issue.
v13.next.forgejo.org/2franix/Test@01d365eb9f/.forgejo/workflows/reusable_first_failing.yaml@earl-warren Yes, this is the same bug. Initially I thought it was only a token issue, but this PR actually fixes a chain of related problems:
The core issue:
Manifestation:
It worked sometimes depending on job execution speed, making it look intermittent when it was actually systematic.
This PR should close all these behaviors.
P.S. I'm actively testing this while migrating from GitLab pipelines to Forgejo with full decomposition. Currently running complex real-world scenarios:
workflow_call+needschainsupload-artifact→download-artifactbetween jobs)Example structure:
Ghost referenced this pull request2026-02-10 19:28:56 +00:00