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"`
Defaults Defaults `yaml:"defaults"`
Outputs map[string]string `yaml:"outputs"`
Uses string `yaml:"uses"`
Result string
}

View file

@ -116,6 +116,8 @@ func New(runnerConfig *Config) (Runner, error) {
return runner, nil
}
// NewPlanExecutor ...
//nolint:gocyclo
func (runner *runnerImpl) NewPlanExecutor(plan *model.Plan) common.Executor {
maxJobNameLen := 0
@ -128,6 +130,11 @@ func (runner *runnerImpl) NewPlanExecutor(plan *model.Plan) common.Executor {
for r, run := range stage.Runs {
stageExecutor := make([]common.Executor, 0)
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 {
strategyRc := runner.newRunContext(run, 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-with-error", "push", "Job 'failing-composite-action' failed", 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", "issue-597", "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 }}