|
| 1 | +# |
| 2 | +# Licensed to the Apache Software Foundation (ASF) under one or more |
| 3 | +# contributor license agreements. See the NOTICE file distributed with |
| 4 | +# this work for additional information regarding copyright ownership. |
| 5 | +# The ASF licenses this file to you under the Apache License, Version 2.0 |
| 6 | +# (the "License"); you may not use this file except in compliance with |
| 7 | +# the License. You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, software |
| 12 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | +# See the License for the specific language governing permissions and |
| 15 | +# limitations under the License. |
| 16 | +# |
| 17 | + |
| 18 | +name: scorecards-analysis |
| 19 | + |
| 20 | +on: |
| 21 | + branch_protection_rule: |
| 22 | + schedule: |
| 23 | + - cron: "30 1 * * 6" # Weekly on Saturdays |
| 24 | + push: |
| 25 | + branches: [ "2.x", "main" ] |
| 26 | + |
| 27 | +permissions: read-all |
| 28 | + |
| 29 | +jobs: |
| 30 | + |
| 31 | + analysis: |
| 32 | + |
| 33 | + name: "Scorecards analysis" |
| 34 | + runs-on: ubuntu-latest |
| 35 | + permissions: |
| 36 | + # Needed to upload the results to the code-scanning dashboard. |
| 37 | + security-events: write |
| 38 | + actions: read |
| 39 | + id-token: write # This is required for requesting the JWT |
| 40 | + contents: read # This is required for actions/checkout |
| 41 | + |
| 42 | + steps: |
| 43 | + |
| 44 | + - name: "Checkout code" |
| 45 | + uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # 4.1.0 |
| 46 | + with: |
| 47 | + persist-credentials: false |
| 48 | + |
| 49 | + - name: "Run analysis" |
| 50 | + uses: ossf/scorecard-action@08b4669551908b1024bb425080c797723083c031 # 2.2.0 |
| 51 | + with: |
| 52 | + results_file: results.sarif |
| 53 | + results_format: sarif |
| 54 | + # A read-only PAT token, which is sufficient for the action to function. |
| 55 | + # The relevant discussion: https://github.com/ossf/scorecard-action/issues/188 |
| 56 | + repo_token: ${{ secrets.GITHUB_TOKEN }} |
| 57 | + # Publish the results for public repositories to enable scorecard badges. |
| 58 | + # For more details: https://github.com/ossf/scorecard-action#publishing-results |
| 59 | + publish_results: true |
| 60 | + |
| 61 | + - name: "Upload artifact" |
| 62 | + uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # 3.1.0 |
| 63 | + with: |
| 64 | + name: SARIF file |
| 65 | + path: results.sarif |
| 66 | + retention-days: 5 |
| 67 | + |
| 68 | + - name: "Upload to code-scanning" |
| 69 | + uses: github/codeql-action/upload-sarif@2cb752a87e96af96708ab57187ab6372ee1973ab # 2.1.22 |
| 70 | + with: |
| 71 | + sarif_file: results.sarif |
0 commit comments