| 1 | # This workflow uses actions that are not certified by GitHub. |
| 2 | # They are provided by a third-party and are governed by |
| 3 | # separate terms of service, privacy policy, and support |
| 4 | # documentation. |
| 5 | |
| 6 | # This workflow checks out code, performs a Codacy security scan |
| 7 | # and integrates the results with the |
| 8 | # GitHub Advanced Security code scanning feature. For more information on |
| 9 | # the Codacy security scan action usage and parameters, see |
| 10 | # https://github.com/codacy/codacy-analysis-cli-action. |
| 11 | # For more information on Codacy Analysis CLI in general, see |
| 12 | # https://github.com/codacy/codacy-analysis-cli. |
| 13 | |
| 14 | name: Codacy Security Scan |
| 15 | |
| 16 | on: |
| 17 | push: |
| 18 | branches: [ "master" ] |
| 19 | pull_request: |
| 20 | # The branches below must be a subset of the branches above |
| 21 | branches: [ "master" ] |
| 22 | schedule: |
| 23 | - cron: '24 1 * * 6' |
| 24 | |
| 25 | permissions: |
| 26 | contents: read |
| 27 | |
| 28 | jobs: |
| 29 | codacy-security-scan: |
| 30 | permissions: |
| 31 | contents: read # for actions/checkout to fetch code |
| 32 | security-events: write # for github/codeql-action/upload-sarif to upload SARIF results |
| 33 | actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status |
| 34 | name: Codacy Security Scan |
| 35 | runs-on: ubuntu-latest |
| 36 | steps: |
| 37 | # Checkout the repository to the GitHub Actions runner |
| 38 | - name: Checkout code |
| 39 | uses: actions/checkout@v4 |
| 40 | |
| 41 | # Execute Codacy Analysis CLI and generate a SARIF output with the security issues identified during the analysis |
| 42 | - name: Run Codacy Analysis CLI |
| 43 | uses: codacy/codacy-analysis-cli-action@97bf5df3c09e75f5bcd72695998f96ebd701846e |
| 44 | with: |
| 45 | # Check https://github.com/codacy/codacy-analysis-cli#project-token to get your project token from your Codacy repository |
| 46 | # You can also omit the token and run the tools that support default configurations |
| 47 | project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} |
| 48 | verbose: true |
| 49 | output: results.sarif |
| 50 | format: sarif |
| 51 | # Adjust severity of non-security issues |
| 52 | gh-code-scanning-compat: true |
| 53 | # Force 0 exit code to allow SARIF file generation |
| 54 | # This will handover control about PR rejection to the GitHub side |
| 55 | max-allowed-issues: 2147483647 |
| 56 | |
| 57 | # Upload the SARIF file generated in the previous step |
| 58 | - name: Upload SARIF results file |
| 59 | uses: github/codeql-action/upload-sarif@v3 |
| 60 | with: |
| 61 | sarif_file: results.sarif |