Skip to content

Commit cbc4c36

Browse files
Log POST failures instead of failing entire action (#1625)
Previously, website issues would cause the entire action to fail, and users would complain. Now, failures are logged as warnings using GitHub's workflow command syntax: https://docs.github.com/actions/reference/workflows-and-actions/workflow-commands Afterwards, the rest of the workflow job, such as uploading to the code scanning dashboard, can continue. Signed-off-by: Spencer Schrock <sschrock@google.com>
1 parent 4a0b87a commit cbc4c36

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

signing/signing.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,9 @@ func (s *Signing) ProcessSignature(jsonPayload []byte, repoName, repoRef string)
166166

167167
// retries failed
168168
if err != nil {
169-
return fmt.Errorf("error sending scorecard results to webapp: %w", err)
169+
log.Printf("::warning::Unable to POST scorecard results to webapp: %v. "+
170+
"If this issue persists, check the repo issues for more information.\n", err)
171+
return nil
170172
}
171173

172174
return nil

signing/signing_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ func TestProcessSignature(t *testing.T) {
9595
name: "post failed",
9696
status: http.StatusBadRequest,
9797
payloadPath: "testdata/results.json",
98-
wantErr: true,
98+
wantErr: false,
9999
},
100100
}
101101
// use smaller backoffs for the test so they run faster
@@ -192,7 +192,7 @@ func TestProcessSignature_retries(t *testing.T) {
192192
name: "retry limit exceeded",
193193
nFailures: 4,
194194
wantNRequests: 3,
195-
wantErr: true,
195+
wantErr: false,
196196
},
197197
}
198198
// use smaller backoffs for the test so they run faster

0 commit comments

Comments
 (0)