fix: return error on reusable workflows (#1093)

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
Ryan 2022-03-30 19:20:45 +02:00 committed by GitHub
parent 48db7d9c9d
commit b3bd268e45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 0 deletions

View File

@ -84,6 +84,7 @@ type Job struct {
RawContainer yaml.Node `yaml:"container"` RawContainer yaml.Node `yaml:"container"`
Defaults Defaults `yaml:"defaults"` Defaults Defaults `yaml:"defaults"`
Outputs map[string]string `yaml:"outputs"` Outputs map[string]string `yaml:"outputs"`
Uses string `yaml:"uses"`
Result string Result string
} }

View File

@ -116,6 +116,8 @@ func New(runnerConfig *Config) (Runner, error) {
return runner, nil return runner, nil
} }
// NewPlanExecutor ...
//nolint:gocyclo
func (runner *runnerImpl) NewPlanExecutor(plan *model.Plan) common.Executor { func (runner *runnerImpl) NewPlanExecutor(plan *model.Plan) common.Executor {
maxJobNameLen := 0 maxJobNameLen := 0
@ -128,6 +130,11 @@ func (runner *runnerImpl) NewPlanExecutor(plan *model.Plan) common.Executor {
for r, run := range stage.Runs { for r, run := range stage.Runs {
stageExecutor := make([]common.Executor, 0) stageExecutor := make([]common.Executor, 0)
job := run.Job() job := run.Job()
if job.Uses != "" {
return fmt.Errorf("reusable workflows are currently not supported (see https://github.com/nektos/act/issues/826 for updates)")
}
if job.Strategy != nil { if job.Strategy != nil {
strategyRc := runner.newRunContext(run, nil) strategyRc := runner.newRunContext(run, nil)
if err := strategyRc.NewExpressionEvaluator().EvaluateYamlNode(&job.Strategy.RawMatrix); err != nil { if err := strategyRc.NewExpressionEvaluator().EvaluateYamlNode(&job.Strategy.RawMatrix); err != nil {

View File

@ -123,6 +123,7 @@ func TestRunEvent(t *testing.T) {
{"testdata", "uses-composite", "push", "", platforms, ""}, {"testdata", "uses-composite", "push", "", platforms, ""},
{"testdata", "uses-composite-with-error", "push", "Job 'failing-composite-action' failed", platforms, ""}, {"testdata", "uses-composite-with-error", "push", "Job 'failing-composite-action' failed", platforms, ""},
{"testdata", "uses-nested-composite", "push", "", platforms, ""}, {"testdata", "uses-nested-composite", "push", "", platforms, ""},
{"testdata", "uses-workflow", "push", "reusable workflows are currently not supported (see https://github.com/nektos/act/issues/826 for updates)", platforms, ""},
{"testdata", "composite-fail-with-output", "push", "", platforms, ""}, {"testdata", "composite-fail-with-output", "push", "", platforms, ""},
{"testdata", "issue-597", "push", "", platforms, ""}, {"testdata", "issue-597", "push", "", platforms, ""},
{"testdata", "issue-598", "push", "", platforms, ""}, {"testdata", "issue-598", "push", "", platforms, ""},

View File

@ -0,0 +1,9 @@
on: push
jobs:
reusable-workflow:
uses: nektos/act-tests/.github/workflows/reusable-workflow.yml@master
with:
username: mona
secrets:
envPATH: ${{ secrets.envPAT }}