mirror of
https://gitea.com/gitea/runner.git
synced 2026-11-12 02:44:10 +00:00
fix: composite pre/post conditions read the job status (#1242)
A composite action's child run context starts with empty step results, so a nested action's `post-if: success()` saw the composite's own result and still ran after the job had failed, which let `actions/cache` save caches from failed jobs. The `job` context now always comes from the job's run context. Only `success()` and `failure()` in a composite's own main steps read the composite's result, matching GitHub Actions. Assisted-by: Claude Code:claude-fable-5-1 Reviewed-on: https://gitea.com/gitea/runner/pulls/1242 Reviewed-by: bircni <[email protected]> Co-authored-by: silverwind <[email protected]>
This commit is contained in:
1 parent
d83fa77de4
commit
3962d0d970
4 files changed
+74
-16
No files matched your search
+6
-1
@@ -299,7 +299,12 @@ func isStepEnabled(ctx context.Context, expr string, step step, stage stepStage)
|
||||
defaultStatusCheck = exprparser.DefaultStatusCheckSuccess
|
||||
}
|
||||
|
||||
runStep, err := EvalBool(ctx, rc.NewStepExpressionEvaluator(ctx, step), expr, defaultStatusCheck)
|
||||
// success() and failure() in a composite's own main steps read the composite's result, other stages the job's
|
||||
jobContext := rc.getJobContext()
|
||||
if rc.Parent != nil && stage == stepStageMain && jobContext.Status != "cancelled" {
|
||||
jobContext.Status = rc.ownStatus()
|
||||
}
|
||||
runStep, err := EvalBool(ctx, rc.newStepExpressionEvaluator(ctx, step, rc.actionInputs, jobContext), expr, defaultStatusCheck)
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("if-expression %q evaluation failed: %s", expr, err)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user