diff --git a/quality-gate/README.md b/quality-gate/README.md new file mode 100644 index 000000000..7991ab070 --- /dev/null +++ b/quality-gate/README.md @@ -0,0 +1,32 @@ +# Quality Gate + +GitHub Action to run quality gate analysis in your pipeline. + +### Usage + +Using the flag `[skip quality]` in you commit message will disable this action. + +The action will also not run if dependabot is the committer. + +Minimal configuration: +```yaml +steps: + - uses: ... + + - uses: extenda/actions/quality-gate@v0 + with: + token: ${{ secrets.QODANA_TOKEN }} + coverage-dir: './path/coverage' +``` + +Full configuration: +```yaml +steps: + - uses: ... + + - uses: extenda/actions/quality-gate@v0 + with: + token: ${{ secrets.QODANA_TOKEN }} + coverage-dir: './path/coverage' + baseline: 'qodana.sarif.json' +``` diff --git a/quality-gate/action.yml b/quality-gate/action.yml new file mode 100644 index 000000000..46a49d9bd --- /dev/null +++ b/quality-gate/action.yml @@ -0,0 +1,26 @@ +# action.yml +name: 'Quality Gate' +description: 'Assert code quality' +inputs: + coverage-dir: + description: 'The coverage information path' + required: true + baseline: + description: | + A baseline file path. It contains the current level of coverage and is + treated as a starting point from where to collect new coverage information. + required: false + default: 'qodana.sarif.json' + token: + description: 'The authorization token' + required: true +runs: + using: composite + steps: + - name: Scan with Qodana + uses: JetBrains/qodana-action@v2024.2 + if: github.actor != 'dependabot[bot]' && !contains(github.event.head_commit.message, '[skip quality]') + with: + args: --coverage-dir,${{ inputs.coverage-dir }},--baseline,${{ inputs.baseline }} + env: + QODANA_TOKEN: ${{ inputs.token }}