ci(scorecard): keep a failing API call from taking the workflow down - #60
Merged
Conversation
The visibility step ran under `set -e` with a single `gh api` call, so a
rate limit or a blip failed the job and stopped Scorecard from running even on
a public repository. It now retries and, failing that, warns and treats the
repository as non-public.
Also wraps the job condition in `${{ }}` and says "non-public" where the
comment said "private", since the rule covers internal repositories too.
There was a problem hiding this comment.
Pull request overview
This PR hardens the Scorecard workflow’s “repository visibility” gate so transient GitHub API failures don’t fail the entire workflow, while still preventing Scorecard publication steps from running when repository visibility can’t be confirmed.
Changes:
- Reworks the visibility check to retry the
gh apicall up to 3 times with incremental backoff and degrade to “not public” with a warning if visibility can’t be determined. - Updates messaging to reflect “non-public” (covers internal + private) and simplifies the notice text.
- Wraps the
analysisjob condition in${{ }}to match the condition style it replaced.
Both raised in review. Dropping -e to let the retry loop run also disabled error checking for the rest of the step: a failed write to $GITHUB_OUTPUT would have gone unnoticed and skipped the scan silently. A command inside an `if` condition is exempt from -e, so the retry works with it still on, and the final attempt no longer sleeps before giving up. The skip notice said what happened but not why. The reason is a licensing one and is not obvious to whoever reads the run.
The repository checks formatting over workflow files, and the edit did not match what prettier produces. It took the Lint job and the aggregate gate down with it.
Raised in review. The notice said "licence"; GitHub's product term is "GitHub Code Security license", and these repositories use "license" everywhere else. A log line that spells the product differently reads as a typo and does not match a search for the term.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hardens the visibility gate added earlier in this sweep. Raised in review on the sibling pull requests, and applied everywhere the same step landed.
The defect
The step ran under
set -euo pipefailaround a singlegh apicall. A rate limit, a brief outage or a token hiccup failed the job — and with it Scorecard, on a public repository, where it should have run. The gate exists to skip work that cannot succeed; instead it could stop work that would have.The fix
Three attempts with a growing pause. If visibility still cannot be determined, the step emits a
::warning::and treats the repository as non-public rather than failing.A red workflow over a transient API error is noise that trains people to ignore red. A warning is visible in the run summary and does not.
Also
${{ }}, matching the condition it replacedJob names, permissions, the action pin and the trigger set are unchanged.