security.yml 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. name: Release audit
  2. on:
  3. push:
  4. branches: [main]
  5. pull_request:
  6. concurrency:
  7. group: ${{ github.workflow }}-${{ github.ref }}
  8. cancel-in-progress: true
  9. permissions:
  10. contents: read
  11. jobs:
  12. source-history-artifact:
  13. runs-on: ubuntu-latest
  14. timeout-minutes: 10
  15. steps:
  16. - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
  17. with:
  18. fetch-depth: 0
  19. - uses: ./.github/actions/setup-gitleaks
  20. - name: Classify change
  21. id: changes
  22. run: node scripts/ci-changes.mjs
  23. - name: Scan complete history and source snapshot
  24. shell: bash
  25. run: |
  26. gitleaks git --redact --config .gitleaks.toml --log-opts=--all
  27. mkdir "$RUNNER_TEMP/source-audit"
  28. git archive HEAD | tar -x -C "$RUNNER_TEMP/source-audit"
  29. gitleaks dir "$RUNNER_TEMP/source-audit" --redact --config .gitleaks.toml
  30. - uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
  31. if: steps.changes.outputs.docs_only != 'true'
  32. with:
  33. version: 9.12.0
  34. - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
  35. if: steps.changes.outputs.docs_only != 'true'
  36. with:
  37. node-version: "22"
  38. cache: pnpm
  39. - run: pnpm install --frozen-lockfile
  40. if: steps.changes.outputs.docs_only != 'true'
  41. - run: pnpm build
  42. if: steps.changes.outputs.docs_only != 'true'
  43. - name: Scan built distribution
  44. if: steps.changes.outputs.docs_only != 'true'
  45. run: gitleaks dir dist --redact --config .gitleaks.toml