|  | 
|  | 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: '34 1 * * 4' | 
|  | 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 | + name: Codacy Security Scan | 
|  | 34 | + runs-on: ubuntu-latest | 
|  | 35 | + steps: | 
|  | 36 | + # Checkout the repository to the GitHub Actions runner | 
|  | 37 | + - name: Checkout code | 
|  | 38 | + uses: actions/checkout@v2 | 
|  | 39 | + | 
|  | 40 | + # Execute Codacy Analysis CLI and generate a SARIF output with the security issues identified during the analysis | 
|  | 41 | + - name: Run Codacy Analysis CLI | 
|  | 42 | + uses: codacy/codacy-analysis-cli-action@d840f886c4bd4edc059706d09c6a1586111c540b | 
|  | 43 | + with: | 
|  | 44 | + # Check https://github.com/codacy/codacy-analysis-cli#project-token to get your project token from your Codacy repository | 
|  | 45 | + # You can also omit the token and run the tools that support default configurations | 
|  | 46 | + project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} | 
|  | 47 | + verbose: true | 
|  | 48 | + output: results.sarif | 
|  | 49 | + format: sarif | 
|  | 50 | + # Adjust severity of non-security issues | 
|  | 51 | + gh-code-scanning-compat: true | 
|  | 52 | + # Force 0 exit code to allow SARIF file generation | 
|  | 53 | + # This will handover control about PR rejection to the GitHub side | 
|  | 54 | + max-allowed-issues: 2147483647 | 
|  | 55 | + | 
|  | 56 | + # Upload the SARIF file generated in the previous step | 
|  | 57 | + - name: Upload SARIF results file | 
|  | 58 | + uses: github/codeql-action/upload-sarif@v1 | 
|  | 59 | + with: | 
|  | 60 | + sarif_file: results.sarif | 
0 commit comments