Skip to content

Instantly share code, notes, and snippets.

@xeioex
Created February 20, 2026 00:17
Show Gist options
  • Select an option

  • Save xeioex/f8607f929e0cae03b772680b3cadd9a3 to your computer and use it in GitHub Desktop.

Select an option

Save xeioex/f8607f929e0cae03b772680b3cadd9a3 to your computer and use it in GitHub Desktop.
---
# This workflow uses actions that are not certified by GitHub. They are provided by a third-party and are governed by separate terms of service, privacy policy, and support documentation.
name: OSSF Scorecard
on:
# For Branch-Protection check. Only the default branch is supported. See https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection.
branch_protection_rule:
# To guarantee Maintained check is occasionally updated. See https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained.
schedule:
- cron: "0 0 * * 1"
push:
branches: [main, master]
workflow_dispatch:
# Declare default permissions as read only.
permissions: read-all
jobs:
analysis:
name: Scorecard analysis
runs-on: ubuntu-24.04
# Delete the conditional below if you are using the OSSF Scorecard on a public repository.
if: ${{ github.event.repository.private == false }}
permissions:
# Needed if using Code Scanning alerts.
security-events: write
# Needed for GitHub OIDC token if publish_results is true.
id-token: write
# Uncomment the permissions below if you are using the OSSF Scorecard on a private repository.
# contents: read
# actions: read
# issues: read # To allow GraphQL ListCommits to work
# pull-requests: read # To allow GraphQL ListCommits to work
# checks: read # To detect SAST tools
steps:
- name: Check out the codebase
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Run analysis
uses: ossf/scorecard-action@4eaacf0543bb3f2c246792bd56e8cdeffafb205a # v2.4.3
with:
results_file: results.sarif
results_format: sarif
# (Optional) fine-grained personal access token. Uncomment the `repo_token` line below if you want to enable the Branch-Protection or Webhooks check on a *private* repository.
# To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-fine-grained-pat-optional.
# repo_token: ${{ secrets.SCORECARD_TOKEN }}
# Publish the results for public repositories to enable scorecard badges. For more details, see https://github.com/ossf/scorecard-action#publishing-results.
# For private repositories, `publish_results` will automatically be set to `false`, regardless of the value entered here.
publish_results: true
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF format to the repository Actions tab.
- name: Upload artifact
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: SARIF file
path: results.sarif
retention-days: 5
# Upload the results to GitHub's code scanning dashboard.
- name: Upload SARIF results to code scanning
uses: github/codeql-action/upload-sarif@9e907b5e64f6b83e7804b09294d44122997950d6 # v4.32.3
with:
sarif_file: results.sarif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment