mirror of
https://gitea.com/gitea/act_runner.git
synced 2026-08-13 22:41:54 +02:00
The runner is an application, not a library. `act/model` and `act/exprparser` were the last packages anything outside this repository consumed and they now live in actionslib, so nothing needs the rest of `act` to be importable, and keeping it importable invites the coupling that was just removed. Import paths only, the files are unchanged. Assisted-by: Codet:GPT-5.1-Codex
30 lines
691 B
Go
30 lines
691 B
Go
// Copyright 2020 The Gitea Authors. All rights reserved.
|
|
// Copyright 2020 The nektos/act Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package common
|
|
|
|
import (
|
|
"context"
|
|
)
|
|
|
|
type dryrunContextKey string
|
|
|
|
const dryrunContextKeyVal = dryrunContextKey("dryrun")
|
|
|
|
// Dryrun returns true if the current context is dryrun
|
|
func Dryrun(ctx context.Context) bool {
|
|
val := ctx.Value(dryrunContextKeyVal)
|
|
if val != nil {
|
|
if dryrun, ok := val.(bool); ok {
|
|
return dryrun
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
// WithDryrun adds a value to the context for dryrun
|
|
func WithDryrun(ctx context.Context, dryrun bool) context.Context {
|
|
return context.WithValue(ctx, dryrunContextKeyVal, dryrun)
|
|
}
|