From c6027f72e29ea62382159e831546d78417ca8f87 Mon Sep 17 00:00:00 2001 From: Matthew Rose Date: Sun, 24 Oct 2021 17:37:10 +1000 Subject: [PATCH] fix: continue when step doesn't have `uses` key --- pkg/parser/parser.go | 5 +++++ pkg/parser/testdata/uses.yaml | 4 ++++ pkg/types/{third_party_action.go => external_action.go} | 4 ++-- 3 files changed, 11 insertions(+), 2 deletions(-) rename pkg/types/{third_party_action.go => external_action.go} (100%) diff --git a/pkg/parser/parser.go b/pkg/parser/parser.go index d7ea551..9d75a51 100644 --- a/pkg/parser/parser.go +++ b/pkg/parser/parser.go @@ -124,6 +124,11 @@ func parseExternalActions(action *types.CompositeAction, data map[interface{}]in return errors.New("step does not have a valid structure") } + if _, ok := step["uses"].(string); !ok { + logrus.Debug("step uses key does not exist, or isn't a string, skipping") + continue + } + var ext types.ExternalAction if stepName, ok := step["name"].(string); ok { diff --git a/pkg/parser/testdata/uses.yaml b/pkg/parser/testdata/uses.yaml index 179eadf..1bf4741 100644 --- a/pkg/parser/testdata/uses.yaml +++ b/pkg/parser/testdata/uses.yaml @@ -12,6 +12,10 @@ runs: uses: actions/cache@v2 with: path: ./ + - name: dummy step + shell: bash + id: dummy + run: echo hello - name: Cache test uses: actions/cache@v2.1.6 with: diff --git a/pkg/types/third_party_action.go b/pkg/types/external_action.go similarity index 100% rename from pkg/types/third_party_action.go rename to pkg/types/external_action.go index 618f108..d10caa7 100644 --- a/pkg/types/third_party_action.go +++ b/pkg/types/external_action.go @@ -23,9 +23,9 @@ package types // ExternalAction represents a single external action that is used by the composite action. type ExternalAction struct { - StepName string - StepID string Creator string Name string Version string + StepName string + StepID string }