mirror of
https://gitea.com/gitea/act_runner.git
synced 2026-11-02 13:27:16 +08:00
`github.action_repository`/`github.action_ref` and their env vars now belong to the step executing an action, like on GitHub: set for remote actions, empty for `run`, `docker://` and local steps. Before, a local action nested in a remote composite resolved `$/` against the remote action instead of the workflow's repository. Updates actionslib to v1.5.1, which accepts `$/` as the repository root action. Co-authored-by: bircni <bircni@icloud.com> Reviewed-on: https://gitea.com/gitea/runner/pulls/1359 Reviewed-by: bircni <bircni@icloud.com> Co-authored-by: silverwind <me@silverwind.io>
68 lines
2.0 KiB
Go
68 lines
2.0 KiB
Go
// Copyright 2026 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package runner
|
|
|
|
import (
|
|
"context"
|
|
|
|
"gitea.com/gitea/runner/act/common"
|
|
"gitea.com/gitea/runner/internal/pkg/action"
|
|
"gitea.com/gitea/runner/internal/pkg/action/checkout"
|
|
|
|
"gitea.dev/actionslib/pkg/model"
|
|
)
|
|
|
|
var builtinActions = map[string]func(context.Context, *action.Context) error{
|
|
"checkout": checkout.Main,
|
|
}
|
|
|
|
type stepActionBuiltin struct {
|
|
Step *model.Step
|
|
RunContext *RunContext
|
|
run func(context.Context, *action.Context) error
|
|
env map[string]string
|
|
}
|
|
|
|
func (sab *stepActionBuiltin) pre() common.Executor { return common.NewPipelineExecutor() }
|
|
|
|
func (sab *stepActionBuiltin) main() common.Executor {
|
|
sab.env = map[string]string{}
|
|
return runStepExecutor(sab, stepStageMain, func(ctx context.Context) error {
|
|
if common.Dryrun(ctx) {
|
|
return nil
|
|
}
|
|
|
|
printRunActionHeader(ctx, sab.Step, nil, sab.env, sab.RunContext)
|
|
|
|
rc := sab.RunContext
|
|
rc.ApplyExtraPath(ctx, &sab.env)
|
|
return sab.run(ctx, &action.Context{
|
|
Container: rc.JobContainer,
|
|
Github: getStepGithubContext(ctx, sab),
|
|
Inputs: sab.Step.With,
|
|
HostWorkdir: rc.Config.Workdir,
|
|
Workspace: rc.JobContainer.ToContainerPath(rc.Config.Workdir),
|
|
BindWorkdir: rc.Config.BindWorkdir,
|
|
NoSkipCheckout: rc.Config.NoSkipCheckout,
|
|
UseGitIgnore: rc.Config.UseGitIgnore,
|
|
InsecureSkipTLS: rc.Config.InsecureSkipTLS,
|
|
ClientCertFile: rc.Config.ClientCertFile,
|
|
ClientKeyFile: rc.Config.ClientKeyFile,
|
|
Env: sab.env,
|
|
})
|
|
})
|
|
}
|
|
|
|
func (sab *stepActionBuiltin) post() common.Executor { return common.NewPipelineExecutor() }
|
|
|
|
func (sab *stepActionBuiltin) getRunContext() *RunContext { return sab.RunContext }
|
|
|
|
func (sab *stepActionBuiltin) getStepModel() *model.Step { return sab.Step }
|
|
|
|
func (sab *stepActionBuiltin) getEnv() *map[string]string { return &sab.env }
|
|
|
|
func (sab *stepActionBuiltin) getIfExpression(_ context.Context, _ stepStage) string {
|
|
return sab.Step.If.Value
|
|
}
|