diff --git a/.github/workflows/scorecard.yaml b/.github/workflows/scorecard.yaml new file mode 100644 index 000000000..5b760ce10 --- /dev/null +++ b/.github/workflows/scorecard.yaml @@ -0,0 +1,70 @@ +# +# Copyright 2026 The Dapr Authors +# 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 +# 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: OpenSSF Scorecard + +on: + push: + branches: + - main + schedule: + - cron: '17 3 * * 3' + branch_protection_rule: + types: [created, edited, deleted] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: read-all + +jobs: + analysis: + name: Scorecard analysis + # Scorecard does not support forks. + if: github.repository == 'dapr/python-sdk' + runs-on: ubuntu-latest + timeout-minutes: 20 + permissions: + contents: read + actions: read # Read workflow metadata for Scorecard checks. + security-events: write # Upload SARIF to code scanning. + id-token: write # Publish results using GitHub OIDC. + steps: + - name: Check out code + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: Run Scorecard analysis + uses: ossf/scorecard-action@fa7117db83c52d787ae5a89f350999701505d78e # v2.5.0 + with: + results_file: results.sarif + results_format: sarif + publish_results: true + + # Preserve generated results after a failure while respecting cancellation. + - name: Upload SARIF artifact + if: ${{ !cancelled() && hashFiles('results.sarif') != '' }} + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: scorecard-sarif + path: results.sarif + retention-days: 5 + + - name: Upload SARIF to code scanning + if: ${{ !cancelled() && hashFiles('results.sarif') != '' }} + uses: github/codeql-action/upload-sarif@24c54180a607b1449ed407dd24f251e4e9147c8d # v4.38.3 + with: + sarif_file: results.sarif + category: ossf-scorecard