|
| 1 | + |
| 2 | +name: Scorecard supply-chain security |
| 3 | + |
| 4 | +on: |
| 5 | + branch_protection_rule: |
| 6 | + schedule: |
| 7 | + - cron: '29 23 * * 3' |
| 8 | + push: |
| 9 | + branches: [ "main", "master"] |
| 10 | + pull_request: |
| 11 | + branches: ["main", "master"] |
| 12 | + |
| 13 | +permissions: read-all |
| 14 | + |
| 15 | +jobs: |
| 16 | + visibility-check: |
| 17 | + # Bu job, deponun public/private olduğunu belirler |
| 18 | + outputs: |
| 19 | + visibility: ${{ steps.drv.outputs.visibility }} |
| 20 | + runs-on: ubuntu-latest |
| 21 | + steps: |
| 22 | + - name: Determine repository visibility |
| 23 | + id: drv |
| 24 | + run: | |
| 25 | + visibility=$(gh api /repos/$GITHUB_REPOSITORY --jq '.visibility') |
| 26 | + echo "visibility=$visibility" >> $GITHUB_OUTPUT |
| 27 | + env: |
| 28 | + GH_TOKEN: ${{ github.token }} |
| 29 | + |
| 30 | + analysis: |
| 31 | + if: ${{ needs.visibility-check.outputs.visibility == 'public' }} |
| 32 | + needs: visibility-check |
| 33 | + runs-on: ubuntu-latest |
| 34 | + permissions: |
| 35 | + security-events: write |
| 36 | + id-token: write |
| 37 | + steps: |
| 38 | + - name: "Checkout code" |
| 39 | + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 |
| 40 | + with: |
| 41 | + persist-credentials: false |
| 42 | + |
| 43 | + - name: "Run analysis" |
| 44 | + uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 |
| 45 | + with: |
| 46 | + results_file: results.sarif |
| 47 | + results_format: sarif |
| 48 | + publish_results: true |
| 49 | + |
| 50 | + - name: "Upload artifact" |
| 51 | + uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 |
| 52 | + with: |
| 53 | + name: SARIF file |
| 54 | + path: results.sarif |
| 55 | + retention-days: 5 |
| 56 | + |
| 57 | + # Upload the results to GitHub's code scanning dashboard (optional). |
| 58 | + # Commenting out will disable upload of results to your repo's Code Scanning dashboard |
| 59 | + - name: "Upload to code-scanning" |
| 60 | + uses: github/codeql-action/upload-sarif@f6091c0113d1dcf9b98e269ee48e8a7e51b7bdd4 # v3.28.5 |
| 61 | + with: |
| 62 | + sarif_file: results.sarif |
| 63 | + |
| 64 | + |
0 commit comments