feat(actions)!: improve support for reusable workflows - #37478
Merged
Conversation
8 tasks
Zettat123
force-pushed
the
support-reusable-workflow
branch
14 times, most recently
from
May 6, 2026 04:05
ceb3282 to
44a71d4
Compare
Zettat123
force-pushed
the
support-reusable-workflow
branch
3 times, most recently
from
May 7, 2026 02:18
7a7f54f to
a8ba9e3
Compare
Zettat123
force-pushed
the
support-reusable-workflow
branch
from
May 7, 2026 05:25
a8ba9e3 to
e23763d
Compare
Zettat123
force-pushed
the
support-reusable-workflow
branch
6 times, most recently
from
May 8, 2026 04:00
707610e to
22c59d2
Compare
silverwind
added a commit
that referenced
this pull request
May 29, 2026
…#37894) (#37899) Backport #37894 by @Zettat123 Gitea now only allows `workflow_dispatch.inputs`. If a workflow contains `workflow_call.inputs`, the workflow cannot be triggered, even though the `on:` section contains other trigger events. https://github.com/go-gitea/gitea/blob/428ee9fcce7928bf5405900345d43e9ba1b01564/modules/actions/jobparser/model.go#L402-L405 For example, this workflow cannot be triggered due to `workflow_call.inputs`: ```yaml on: push: pull_request: workflow_call: inputs: name: type: string ``` --- This PR is extracted from #37478 for backport Co-authored-by: Zettat123 <zettat123@gmail.com> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Claude (Opus 4.8) <noreply@anthropic.com>
Contributor
Author
|
@silverwind @bircni @lunny UI updated. Please review again. |
… helper Clarify the CanReadWorkflowCrossRepo `run.Repo.IsPrivate` guard: the real reason is that the owner-level collaborative-owner grant would otherwise let a public caller expose a private reusable workflow's content in a public run, not GitHub parity (GitHub gates on the target repo). Add an integration test that isolates the gate: a public caller is denied a private target even with a collaborative-owner grant. Make createRepoWorkflowFile take the caller's existing token instead of logging in on every call, avoiding repeated bcrypt password verification. Tighten verbose comments across the branch's tests. Co-Authored-By: Claude (Opus 4.8) <noreply@anthropic.com>
silverwind
approved these changes
May 29, 2026
Member
|
Checking CI failure |
Member
|
CI failures are unrelated. |
Contributor
Author
|
Seems like an ES service issue, should we rerun the failed tests? |
Member
|
I'll make a new PR to fix them. Re-run here is likely to suceed. |
Member
|
ES fixes are on #37906. |
lunny
approved these changes
May 30, 2026
This was referenced Jul 16, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR improves reusable workflow support for Gitea Actions. The parsing of the called workflow now happens on Gitea side, not on the runner. When the caller becomes ready, Gitea fetches the called workflow source, parses it, and inserts each child job into the database as a
ActionRunJoblinked to the caller viaParentCallJobID. As a result, every callee job is dispatched as its own task and its logs surface as an independent job entry in the UI, rather than being inlined into the caller's "Set up job" step.This PR supports two kinds of
uses:uses: ./.gitea/workflows/foo.yamluses: OWNER/REPO/.gitea/workflows/foo.yaml@REFExternal reusable workflows (
uses: https://other-gitea-instance/OWNER/REPO/.gitea/workflows/test.yaml@REF) are no longer supported. To keep using them, clone the repositories to the local instance.Main changes
Execution model
IsReusableCaller=trueand won't be fetched by runners.ParentCallJobIDcan link a called job to its caller.Workflow syntax
jobparsernow supports parsingon: workflow_calltrigger withinputs:,outputs:, andsecrets:declarations.MaxReusableCallLevels = 9, which means a top-level caller may have at most 9 nested callers below it.checkCallerChainwalks the caller's ancestor chain viaParentCallJobIDand rejects if the sameuses:string appears anywhere upstream (reusable workflow call cycle detected). This catches both direct (A -> A) and indirect (A -> B -> A) cycles.Cross-repo access
Collaborative Ownersintroduced by Support actions and reusable workflows from private repos #32562Rerun semantics
expandRerunJobIDspartitions the latest attempt's jobs into:execRerunPlan:AttemptJobIDinrerunSet): none of its descendants are cloned. The caller is cloned withIsCallerExpanded=false, and re-expansion (which reinserts the children fresh) happens later when the resolver brings the caller toWaitingagain.Statuswill be updated by its fresh children). Its non-rerun descendants are also pass-through clones (pointSourceTaskIDat the original task). TheirParentCallJobIDis remapped to the new attempt's caller row.UI
RepoActionView.vueis now tree-shaped: callers indent their children. Callers default to collapsed.WorkflowGraphto show direct children only; the run summary'sWorkflowGraphshows top-level callers and their immediate descendants.Known trade-offs
Caller expansion runs inside the enclosing write transaction.
expandReusableWorkflowCallerperforms a git read of the called workflow while holding the row locks that update the caller and insert its children. This is intentional: the caller-row update and child-row inserts must commit atomically. None of the call sites is hot (each caller is expanded once per attempt), so the trade-off is acceptable.A malformed
if:expression on a job leaves itBlockedsilently.evaluateJobIfnow runs server-side as part of resolver passes; deterministic expression errors (typos, undefined context fields) are logged but do not surface in the UI. This is the same behavior the resolver already had for concurrency-expression errors. Distinguishing transient DB errors from user-authored expression errors and writing the latter back asStatusFailureis a follow-up.Screenshots
References
Replace #36388