GitHub Actions¶
Using the Drape Action (Recommended)¶
The simplest way to integrate with GitHub Actions is the official Drape Action:
name: CI
on: [push, pull_request]
permissions:
contents: read
pull-requests: write # PR comments
id-token: write # upload without an API key
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run tests
run: pytest --junitxml=results.xml --cov --cov-report=xml:coverage.xml
continue-on-error: true
- name: Upload test results
uses: drape-io/drape-action@v2
if: always()
continue-on-error: true
with:
command: tests
file: results.xml
- name: Upload coverage
uses: drape-io/drape-action@v2
if: always()
continue-on-error: true
with:
command: coverage
file: coverage.xml
format: cobertura
Using the CLI Directly¶
If you prefer to use the CLI without the action, give the job id-token: write as above. With no API key set, the CLI (v0.10.0 or later) uploads with the job's GitHub OIDC token. The token decides the organization and repository:
- name: Install Drape CLI
run: |
curl -sL https://github.com/drape-io/drape-cli/releases/latest/download/drape_linux_amd64.tar.gz | tar xz
sudo mv drape /usr/local/bin/
- name: Upload test results
run: drape upload tests results.xml --wait
See No API key needed for what Drape checks and when you still need a key.
Security Scans¶
Run a vulnerability scanner and upload the SARIF output:
- name: Run Grype scan
uses: anchore/scan-action@v6
with:
image: my-app:latest
output-format: sarif
output-file: scan.sarif
- name: Upload scan results
uses: drape-io/drape-action@v2
if: always()
continue-on-error: true
with:
command: scan
file: scan.sarif
format: sarif
scan-name: my-app
scan-type: image
fail-on-vulnerabilities: 'true'
fail-on-severity: high