Skip to content

Commit d152a72

Browse files
ci(scorecard): skip on private repos (GHAS not available)
1 parent a1dea31 commit d152a72

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

.github/workflows/scorecard.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# OpenSSF Scorecard — supply-chain security health metrics
22
# Docs: https://github.com/ossf/scorecard-action
3+
#
4+
# Note: Scorecard requires read access to the GitHub GraphQL API. On private
5+
# repos without GitHub Advanced Security this fails with "Resource not
6+
# accessible by integration". We skip the job on private repos until the
7+
# repo is made public or GHAS is enabled.
38
name: OpenSSF Scorecard
49

510
on:
@@ -15,10 +20,12 @@ permissions: read-all
1520
jobs:
1621
analysis:
1722
name: Scorecard analysis
23+
# Scorecard cannot run on private repos without GHAS — skip to keep CI green.
24+
if: github.event.repository.private == false
1825
runs-on: ubuntu-latest
1926
permissions:
20-
security-events: write # upload SARIF to Code Scanning (no-op on private repos without GHAS)
21-
id-token: write # publish to OSSF registry (optional)
27+
security-events: write
28+
id-token: write
2229
contents: read
2330
actions: read
2431

@@ -33,7 +40,7 @@ jobs:
3340
with:
3441
results_file: results.sarif
3542
results_format: sarif
36-
publish_results: false # private repo — keep results internal
43+
publish_results: false
3744

3845
- name: Upload artifact
3946
if: ${{ !cancelled() && hashFiles('results.sarif') != '' }}
@@ -44,8 +51,6 @@ jobs:
4451
retention-days: 30
4552

4653
- name: Upload to code-scanning
47-
# Code-scanning upload requires GHAS on private repos. Skip when
48-
# no SARIF was produced and tolerate the GHAS-not-available case.
4954
if: ${{ !cancelled() && hashFiles('results.sarif') != '' }}
5055
continue-on-error: true
5156
uses: github/codeql-action/upload-sarif@f411752efdf656cb71aa17b755b22c890960da1d # v3.35.5

0 commit comments

Comments
 (0)