mirror of
https://github.com/hanzo-git/runner.git
synced 2026-10-30 19:33:27 +00:00
Native runner: module github.com/hanzo-git/runner, wire proto github.com/hanzo-git/actions-proto-go, command git-runner, GIT_* env, git expr context, git_* task-context keys, ghcr.io/hanzoai/runner-ubuntu job images. Derived work — upstream attribution + MIT terms in NOTICE/LICENSE. Co-authored-by: Hanzo Dev <[email protected]>
30 lines
689 B
Go
30 lines
689 B
Go
// Copyright 2020 The Git 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)
|
|
}
|