| # |
| # Licensed to the Apache Software Foundation (ASF) under one or more |
| # contributor license agreements. See the NOTICE file distributed with |
| # this work for additional information regarding copyright ownership. |
| # The ASF licenses this file to you 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 |
| # |
| # http://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: scorecards-analysis |
| |
| on: |
| workflow_call: |
| |
| # Explicitly drop all permissions inherited from the caller for security. |
| # Reference: https://docs.github.com/en/actions/sharing-automations/reusing-workflows#access-and-permissions |
| permissions: { } |
| |
| jobs: |
| |
| analysis: |
| name: "Scorecards analysis" |
| runs-on: ubuntu-latest |
| # Permissions required to publish Security Alerts |
| permissions: |
| security-events: write |
| |
| steps: |
| |
| - name: "Checkout code" |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2 |
| with: |
| persist-credentials: false |
| |
| - name: "Run analysis" |
| uses: ossf/scorecard-action@05b42c624433fc40578a4040d5cf5e36ddca8cde # 2.4.2 |
| with: |
| results_file: results.sarif |
| results_format: sarif |
| # A read-only PAT token, which is sufficient for the action to function. |
| # The relevant discussion: https://github.com/ossf/scorecard-action/issues/188 |
| repo_token: ${{ secrets.GITHUB_TOKEN }} |
| # Publish the results for public repositories to enable scorecard badges. |
| # For more details: https://github.com/ossf/scorecard-action#publishing-results |
| publish_results: true |
| |
| - name: "Upload artifact" |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # 4.6.2 |
| with: |
| name: SARIF file |
| path: results.sarif |
| retention-days: 5 |
| |
| - name: "Upload to code-scanning" |
| uses: github/codeql-action/upload-sarif@ce28f5bb42b7a9f2c824e633a3f6ee835bab6858 # 3.29.0 |
| with: |
| sarif_file: results.sarif |