From 523ad078bac2610989b1162bdf884675843cbdce Mon Sep 17 00:00:00 2001 From: Justin Grote Date: Sat, 1 May 2021 22:45:47 -0700 Subject: [PATCH] Add known failing action blacklist --- pkg/runner/step_context.go | 17 +++++++++++++++++ pkg/runner/step_context_test.go | 1 + pkg/runner/testdata/uses-blacklist/push.yml | 9 +++++++++ 3 files changed, 27 insertions(+) create mode 100644 pkg/runner/testdata/uses-blacklist/push.yml diff --git a/pkg/runner/step_context.go b/pkg/runner/step_context.go index 5a3cede1a33..4feaa0fe8bc 100755 --- a/pkg/runner/step_context.go +++ b/pkg/runner/step_context.go @@ -70,6 +70,23 @@ func (sc *StepContext) Executor() common.Executor { if remoteAction == nil { return common.NewErrorExecutor(formatError(step.Uses)) } + + // TODO: Add as remoteAction method? + unsupportedActionBlacklist := []string{ + "actions/cache", + "actions/download-artifact", + "actions/upload-artifact", + } + actionName := remoteAction.Org + "/" + remoteAction.Repo + for _, blacklistItem := range unsupportedActionBlacklist { + if blacklistItem == actionName { + return func(ctx context.Context) error { + common.Logger(ctx).Warnf("SKIP: %v is not supported in act yet, sorry!", actionName) + return nil + } + } + } + if remoteAction.IsCheckout() && rc.getGithubContext().isLocalCheckout(step) { return func(ctx context.Context) error { common.Logger(ctx).Debugf("Skipping actions/checkout") diff --git a/pkg/runner/step_context_test.go b/pkg/runner/step_context_test.go index ffd46a92ce7..80a2810902c 100644 --- a/pkg/runner/step_context_test.go +++ b/pkg/runner/step_context_test.go @@ -14,6 +14,7 @@ func TestStepContextExecutor(t *testing.T) { "ubuntu-latest": "node:12.20.1-buster-slim", } tables := []TestJobFileInfo{ + {"testdata", "uses-blacklist", "push", "", platforms, "linux/amd64"}, {"testdata", "uses-and-run-in-one-step", "push", "Invalid run/uses syntax for job:test step:Test", platforms, "linux/amd64"}, {"testdata", "uses-github-empty", "push", "Expected format {org}/{repo}[/path]@ref", platforms, "linux/amd64"}, {"testdata", "uses-github-noref", "push", "Expected format {org}/{repo}[/path]@ref", platforms, "linux/amd64"}, diff --git a/pkg/runner/testdata/uses-blacklist/push.yml b/pkg/runner/testdata/uses-blacklist/push.yml new file mode 100644 index 00000000000..0c82bb19a52 --- /dev/null +++ b/pkg/runner/testdata/uses-blacklist/push.yml @@ -0,0 +1,9 @@ +name: blacklisted-actions +on: push + +jobs: + blacklist: + runs-on: ubuntu-latest + steps: + - uses: actions/cache@v2 + - uses: actions/download-artifact@v2 \ No newline at end of file