mirror of
https://github.com/hanzoai/act.git
synced 2026-10-30 18:48:56 +00:00
The forge needs to PARSE and EVALUATE workflows: model, exprparser, and the two small helper packages they use. It does not need to run them — that is the runner process, and a container runtime is 12000 of the 15754 lines in the upstream act subtree. So this is the 3619 lines that a forge actually calls, not a fork of the whole engine. gitea.com/gitea/runner was the last gitea.com dependency in hanzoai/git. Pins match upstream (actionlint v1.7.12 with go.yaml.in/yaml/v4 v4.0.0-rc.3 — the two are version-coupled and a free resolution of actionlint does not build) and go 1.26, which exprparser needs for reflect.Fields. Upstream MIT notices retained; ours added above them. All four packages green. Co-authored-by: Hanzo Dev <[email protected]>
36 lines
975 B
Go
36 lines
975 B
Go
// Copyright 2026 Hanzo AI, Inc. All rights reserved.
|
|
// Copyright 2021 The Gitea Authors. All rights reserved.
|
|
// Copyright 2021 The nektos/act Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package common
|
|
|
|
import (
|
|
"context"
|
|
)
|
|
|
|
type jobErrorContextKey string
|
|
|
|
const jobErrorContextKeyVal = jobErrorContextKey("job.error")
|
|
|
|
// JobError returns the job error for current context if any
|
|
func JobError(ctx context.Context) error {
|
|
val := ctx.Value(jobErrorContextKeyVal)
|
|
if val != nil {
|
|
if container, ok := val.(map[string]error); ok {
|
|
return container["error"]
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func SetJobError(ctx context.Context, err error) {
|
|
ctx.Value(jobErrorContextKeyVal).(map[string]error)["error"] = err
|
|
}
|
|
|
|
// WithJobErrorContainer adds a value to the context as a container for an error
|
|
func WithJobErrorContainer(ctx context.Context) context.Context {
|
|
container := map[string]error{}
|
|
return context.WithValue(ctx, jobErrorContextKeyVal, container)
|
|
}
|