Skip to content

Commit 6503c19

Browse files
committed
Don't run scorecard on forks
1 parent bc3d230 commit 6503c19

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

template/.github/workflows/scorecard.yml renamed to template/.github/workflows/scorecard.yml.jinja

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{%- raw -%}
12
# This workflow uses actions that are not certified by GitHub. They are provided
23
# by a third-party and are governed by separate terms of service, privacy
34
# policy, and support documentation.
@@ -23,7 +24,10 @@ jobs:
2324
name: Scorecard analysis
2425
runs-on: ubuntu-latest
2526
# `publish_results: true` only works when run from the default branch. conditional can be removed if disabled.
26-
if: github.event.repository.default_branch == github.ref_name || github.event_name == 'pull_request'
27+
{%- endraw -%}
28+
{% set github_repo_url = github_url.split("/")[-2:].join("/") %}
29+
if: (github.event.repository.default_branch == github.ref_name || github.event_name == 'pull_request') && github.repository == '{{ github_repo_url }}'
30+
{%- raw -%}
2731
permissions:
2832
# Needed to upload the results to code-scanning dashboard.
2933
security-events: write
@@ -77,3 +81,4 @@ jobs:
7781
uses: github/codeql-action/upload-sarif@97a2bfd2a3d26d458da69e548f7f859d6fca634d # v3.28.15
7882
with:
7983
sarif_file: results.sarif
84+
{%- endraw -%}

0 commit comments

Comments
 (0)