|
| 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 | + |
| 7 | +# Credo is a static code analysis tool for the Elixir language with a focus on teaching and code consistency. |
| 8 | +# https://github.com/rrrene/credo |
| 9 | +# |
| 10 | +# To use this workflow, you must have GitHub Advanced Security (GHAS) enabled for your repository. |
| 11 | +# |
| 12 | +# Instructions: |
| 13 | +# 1. Add :credo as a dependency to your project's mix.exs with version ~> 1.7.0-rc.1 - https://github.com/rrrene/credo#installation-and-usage |
| 14 | +# 2. Follow the annotated workflow below and make any necessary modifications then save the workflow to your repository |
| 15 | +# and review the "Security" tab once the action has run. |
| 16 | + |
| 17 | +name: Credo |
| 18 | + |
| 19 | +on: |
| 20 | + push: |
| 21 | + branches: [ "master" ] |
| 22 | + pull_request: |
| 23 | + # The branches below must be a subset of the branches above |
| 24 | + branches: [ "master" ] |
| 25 | + schedule: |
| 26 | + - cron: '33 2 * * 5' |
| 27 | + |
| 28 | +permissions: |
| 29 | + contents: read |
| 30 | + |
| 31 | +jobs: |
| 32 | + security-scan: |
| 33 | + permissions: |
| 34 | + contents: read # for actions/checkout to fetch code |
| 35 | + security-events: write # for github/codeql-action/upload-sarif to upload SARIF results |
| 36 | + actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status |
| 37 | + runs-on: ubuntu-latest |
| 38 | + strategy: |
| 39 | + fail-fast: false |
| 40 | + matrix: |
| 41 | + otp: [version] |
| 42 | + elixir: [version] |
| 43 | + steps: |
| 44 | + - uses: actions/checkout@v3 |
| 45 | + - uses: erlef/setup-beam@988e02bfe678367a02564f65ca2e37726dc0268f |
| 46 | + with: |
| 47 | + otp-version: ${{matrix.otp}} |
| 48 | + elixir-version: ${{matrix.elixir}} |
| 49 | + - name: get dependencies |
| 50 | + run: mix deps.get |
| 51 | + - name: compile dependencies |
| 52 | + run: mix deps.compile |
| 53 | + - name: compile |
| 54 | + run: mix compile |
| 55 | + - name: credo-scan |
| 56 | + run: mix credo --format=sarif > credo_output.sarif |
| 57 | + - name: upload sarif |
| 58 | + uses: github/codeql-action/upload-sarif@v2 |
| 59 | + with: |
| 60 | + # Path to SARIF file relative to the root of the repository |
| 61 | + sarif_file: credo_output.sarif |
0 commit comments