diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 1ba1f3bf..c15de116 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -5,11 +5,11 @@ version: 2 updates: - - package-ecosystem: "github-actions" - directory: "/" + - package-ecosystem: 'github-actions' + directory: '/' schedule: - interval: "weekly" - - package-ecosystem: "gomod" - directory: "/" + interval: 'weekly' + - package-ecosystem: 'gomod' + directory: '/' schedule: - interval: "weekly" + interval: 'weekly' diff --git a/.github/linters/.golangci.yml b/.github/linters/.golangci.yml deleted file mode 120000 index d531ead6..00000000 --- a/.github/linters/.golangci.yml +++ /dev/null @@ -1 +0,0 @@ -../../.golangci.yml \ No newline at end of file diff --git a/.github/linters/.markdown-lint.yml b/.github/linters/.markdown-lint.yml deleted file mode 120000 index 7e62b3d9..00000000 --- a/.github/linters/.markdown-lint.yml +++ /dev/null @@ -1 +0,0 @@ -../../.markdownlint.yml \ No newline at end of file diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index ae43ebd3..d34c472c 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -5,6 +5,7 @@ env: ACT_OWNER: ${{ github.repository_owner }} ACT_REPOSITORY: ${{ github.repository }} GO_VERSION: 1.17 + CGO_ENABLED: 0 jobs: lint: @@ -18,22 +19,15 @@ jobs: with: go-version: ${{ env.GO_VERSION }} - uses: golangci/golangci-lint-action@v2 - env: - CGO_ENABLED: 0 with: version: latest - - uses: github/super-linter@v3 + - uses: megalinter/megalinter/flavors/go@v5 env: DEFAULT_BRANCH: master GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - FILTER_REGEX_EXCLUDE: .*testdata/* VALIDATE_ALL_CODEBASE: false - VALIDATE_BASH: false - VALIDATE_DOCKERFILE: false - VALIDATE_DOCKERFILE_HADOLINT: false - VALIDATE_GO: false # it's broken, see commit message - VALIDATE_JSCPD: false - VALIDATE_SHELL_SHFMT: false + GITHUB_STATUS_REPORTER: ${{ !env.ACT }} + GITHUB_COMMENT_REPORTER: ${{ !env.ACT }} test-linux: name: test-linux @@ -55,8 +49,6 @@ jobs: restore-keys: | ${{ runner.os }}-go- - run: go test -v -cover -coverprofile=coverage.txt -covermode=atomic ./... - env: - CGO_ENABLED: 0 - name: Upload Codecov report uses: codecov/codecov-action@v2.1.0 with: diff --git a/act/container/docker_run.go b/act/container/docker_run.go index bf6d6f37..2077a8e0 100644 --- a/act/container/docker_run.go +++ b/act/container/docker_run.go @@ -88,8 +88,7 @@ func NewContainer(input *NewContainerInput) Container { // supportsContainerImagePlatform returns true if the underlying Docker server // API version is 1.41 and beyond -func supportsContainerImagePlatform(cli *client.Client) bool { - ctx := context.TODO() +func supportsContainerImagePlatform(ctx context.Context, cli *client.Client) bool { logger := common.Logger(ctx) ver, err := cli.ServerVersion(ctx) if err != nil { @@ -290,7 +289,7 @@ func (cr *containerReference) remove() common.Executor { } logger := common.Logger(ctx) - err := cr.cli.ContainerRemove(context.Background(), cr.id, types.ContainerRemoveOptions{ + err := cr.cli.ContainerRemove(ctx, cr.id, types.ContainerRemoveOptions{ RemoveVolumes: true, Force: true, }) @@ -333,7 +332,7 @@ func (cr *containerReference) create(capAdd []string, capDrop []string) common.E } var platSpecs *specs.Platform - if supportsContainerImagePlatform(cr.cli) && cr.input.Platform != "" { + if supportsContainerImagePlatform(ctx, cr.cli) && cr.input.Platform != "" { desiredPlatform := strings.SplitN(cr.input.Platform, `/`, 2) if len(desiredPlatform) != 2 { diff --git a/act/runner/expression.go b/act/runner/expression.go index ac024552..72ff56c3 100644 --- a/act/runner/expression.go +++ b/act/runner/expression.go @@ -158,24 +158,24 @@ func (*expressionEvaluator) advString(w *strings.Builder, r *strings.Reader) err return err } if c != '\'' { - w.WriteRune(c) //nolint + w.WriteRune(c) continue } // Handles a escaped string: ex. 'It''s ok' c, _, err = r.ReadRune() if err != nil { - w.WriteString("'") //nolint + w.WriteString("'") return err } if c != '\'' { - w.WriteString("'") //nolint + w.WriteString("'") if err := r.UnreadRune(); err != nil { return err } break } - w.WriteString(`\'`) //nolint + w.WriteString(`\'`) } return nil } @@ -192,7 +192,7 @@ func (*expressionEvaluator) advPropertyName(w *strings.Builder, r *strings.Reade } break } - w.WriteRune(c) //nolint + w.WriteRune(c) } return nil } diff --git a/act/runner/run_context.go b/act/runner/run_context.go index cfe37ac3..ea39dd01 100644 --- a/act/runner/run_context.go +++ b/act/runner/run_context.go @@ -342,7 +342,7 @@ func (rc *RunContext) newStepExecutor(step *model.Step) common.Executor { rc.ExprEval = exprEval common.Logger(ctx).Infof("\u2B50 Run %s", sc.Step) - err = sc.Executor()(ctx) + err = sc.Executor(ctx)(ctx) if err == nil { common.Logger(ctx).Infof(" \u2705 Success - %s", sc.Step) } else { diff --git a/act/runner/step_context.go b/act/runner/step_context.go index 00c1527e..1485f697 100644 --- a/act/runner/step_context.go +++ b/act/runner/step_context.go @@ -46,7 +46,7 @@ func (e formatError) Error() string { } // Executor for a step context -func (sc *StepContext) Executor() common.Executor { +func (sc *StepContext) Executor(ctx context.Context) common.Executor { rc := sc.RunContext step := sc.Step @@ -92,7 +92,7 @@ func (sc *StepContext) Executor() common.Executor { Token: github.Token, }) var ntErr common.Executor - if err := gitClone(context.TODO()); err != nil { + if err := gitClone(ctx); err != nil { if err.Error() == "short SHA references are not supported" { err = errors.Cause(err) return common.NewErrorExecutor(fmt.Errorf("Unable to resolve action `%s`, the provided ref `%s` is the shortened version of a commit SHA, which is not supported. Please use the full commit SHA `%s` instead", step.Uses, remoteAction.Ref, err.Error())) @@ -482,7 +482,6 @@ func (sc *StepContext) getContainerActionPaths(step *model.Step, actionDir strin return actionName, containerActionDir } -// nolint: gocyclo func (sc *StepContext) runAction(actionDir string, actionPath string, localAction bool) common.Executor { rc := sc.RunContext step := sc.Step @@ -704,7 +703,7 @@ func (sc *StepContext) execAsComposite(ctx context.Context, step *model.Step, _ stepContext.Step = &stepClone - executors = append(executors, stepContext.Executor()) + executors = append(executors, stepContext.Executor(ctx)) } return common.NewPipelineExecutor(executors...)(ctx) }