From 1ba076d32193a17319cd6426d18d00ec0607e3d9 Mon Sep 17 00:00:00 2001 From: Jason Song Date: Mon, 30 Jan 2023 11:42:19 +0800 Subject: [PATCH] Erase needs of job in SingleWorkflow (#9) Reviewed-on: https://gitea.com/gitea/act/pulls/9 Reviewed-by: Lunny Xiao Co-authored-by: Jason Song Co-committed-by: Jason Song --- pkg/jobparser/jobparser.go | 1 + pkg/jobparser/testdata/has_needs.out.yaml | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/pkg/jobparser/jobparser.go b/pkg/jobparser/jobparser.go index 33b900d..4165b46 100644 --- a/pkg/jobparser/jobparser.go +++ b/pkg/jobparser/jobparser.go @@ -50,6 +50,7 @@ func Parse(content []byte, options ...ParseOption) ([]*SingleWorkflow, error) { runsOn[i] = evaluator.Interpolate(v) } job.RawRunsOn = encodeRunsOn(runsOn) + job.EraseNeeds() // there will be only one job in SingleWorkflow, it cannot have needs ret = append(ret, &SingleWorkflow{ Name: workflow.Name, RawOn: workflow.RawOn, diff --git a/pkg/jobparser/testdata/has_needs.out.yaml b/pkg/jobparser/testdata/has_needs.out.yaml index a544aa2..959960d 100644 --- a/pkg/jobparser/testdata/has_needs.out.yaml +++ b/pkg/jobparser/testdata/has_needs.out.yaml @@ -10,7 +10,6 @@ name: test jobs: job2: name: job2 - needs: job1 runs-on: linux steps: - run: uname -a @@ -19,7 +18,6 @@ name: test jobs: job3: name: job3 - needs: [job1, job2] runs-on: linux steps: - run: uname -a