Run Scorecard analyzer #796
Workflow file for this run
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
| # Copyright 2026 Google LLC | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # https://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software | |
| # distributed under the License is distributed on an "AS IS" BASIS, | |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| # See the License for the specific language governing permissions and | |
| # limitations under the License. | |
| name: Scorecard analysis | |
| run-name: Run Scorecard analyzer | |
| # Scorecard (https://github.com/ossf/scorecard) is a repository-scanning tool | |
| # that evaluates a project's security practices. Its use is suggested by | |
| # Google's GitHub team. Scorecard's findings are reported in a repo's scanning | |
| # results page, https://github.com/quantumlib/REPO/security/code-scanning/. | |
| on: | |
| schedule: | |
| # Run weekly on Saturdays. | |
| - cron: '30 9 * * 6' | |
| pull_request: | |
| types: | |
| - opened | |
| - synchronize | |
| - reopened | |
| - ready_for_review | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| concurrency: | |
| cancel-in-progress: true | |
| group: ${{github.workflow}}-${{github.event.pull_request.number||github.ref}} | |
| permissions: {} | |
| jobs: | |
| run-scorecard: | |
| # Skip fork PRs to avoid "Analysis configuration not found" errors. | |
| if: >- | |
| github.repository_owner == 'quantumlib' && | |
| (github.event_name != 'pull_request' || | |
| github.event.pull_request.head.repo.fork == false) | |
| name: Scorecard analyzer | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| security-events: write | |
| id-token: write | |
| contents: read | |
| actions: read | |
| issues: read | |
| pull-requests: read | |
| checks: read | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Check out a copy of the git repository | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Run Scorecard analysis | |
| # yamllint disable rule:line-length | |
| uses: ossf/scorecard-action@2d1146689b8cda280b9bc96326124645441f03bc # v2.4.4 | |
| with: | |
| results_file: scorecard-results.sarif | |
| results_format: sarif | |
| publish_results: true | |
| - name: Upload results to code-scanning dashboard | |
| # yamllint disable rule:line-length | |
| uses: github/codeql-action/upload-sarif@cdf488f595d80d6e07e03d4674febd5ab45fa938 # v4.37.9 | |
| with: | |
| sarif_file: scorecard-results.sarif | |
| # Scorecard doesn't allow submissions from jobs having steps that use "run:". | |
| # Printing a summary needs to use "run:", so we have to use a separate job. | |
| write-summary: | |
| name: Scorecard results | |
| needs: run-scorecard | |
| runs-on: ubuntu-slim | |
| timeout-minutes: 5 | |
| permissions: | |
| actions: read | |
| steps: | |
| - name: Write the Scorecard report page link to the workflow summary | |
| run: | | |
| repo="${{github.repository}}" | |
| url="https://scorecard.dev/viewer/?uri=github.com/${repo}" | |
| { | |
| echo -n "The results are available on the OpenSSF Scorecard " | |
| echo "[report page for ${{github.repository}}]($url)." | |
| } >> "$GITHUB_STEP_SUMMARY" |