@@ -285,6 +285,8 @@ jobs:
285285 OSSF-Scorecard :
286286 name : OSSF Scorecard
287287 runs-on : ubuntu-22.04
288+ # `publish_results: true` only works when run from the default branch. conditional can be removed if disabled.
289+ if : github.event.repository.default_branch == github.ref_name || github.event_name == 'pull_request'
288290 permissions :
289291 # Needed to upload the results to code-scanning dashboard.
290292 security-events : write
@@ -295,18 +297,13 @@ jobs:
295297 # actions: read
296298
297299 steps :
298- - name : Harden Runner
299- uses : step-security/harden-runner@v2
300- with :
301- egress-policy : audit
302-
303300 - name : " Checkout code"
304- uses : actions/checkout@v4
301+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
305302 with :
306303 persist-credentials : false
307304
308305 - name : " Run analysis"
309- uses : ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3 .1
306+ uses : ossf/scorecard-action@f49aabe0b5af0936a0987cfb85d86b75731b0186 # v2.4 .1
310307 with :
311308 results_file : results.sarif
312309 results_format : sarif
@@ -320,12 +317,18 @@ jobs:
320317 # - Publish results to OpenSSF REST API for easy access by consumers
321318 # - Allows the repository to include the Scorecard badge.
322319 # - See https://github.com/ossf/scorecard-action#publishing-results.
320+ # For private repositories:
321+ # - `publish_results` will always be set to `false`, regardless
322+ # of the value entered here.
323323 publish_results : true
324324
325+ # (Optional) Uncomment file_mode if you have a .gitattributes with files marked export-ignore
326+ # file_mode: git
327+
325328 # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
326329 # format to the repository Actions tab.
327330 - name : " Upload artifact"
328- uses : actions/upload-artifact@97a0fba1372883ab732affbe8f94b823f91727db # v3.pre.node20
331+ uses : actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
329332 with :
330333 name : SARIF file
331334 path : results.sarif
@@ -334,6 +337,6 @@ jobs:
334337 # Upload the results to GitHub's code scanning dashboard (optional).
335338 # Commenting out will disable upload of results to your repo's Code Scanning dashboard
336339 - name : " Upload to code-scanning"
337- uses : github/codeql-action/upload-sarif@1b1aada464948af03b950897e5eb522f92603cc2 # v3.24.9
340+ uses : github/codeql-action/upload-sarif@v3
338341 with :
339- sarif_file : results.sarif
342+ sarif_file : results.sarif
0 commit comments