Skip to content

Codacy Security Scan #775

Codacy Security Scan

Codacy Security Scan #775

Workflow file for this run

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow checks out code, performs a Codacy security scan
# and integrates the results with the
# GitHub Advanced Security code scanning feature. For more information on
# the Codacy security scan action usage and parameters, see
# https://github.com/codacy/codacy-analysis-cli-action.
# For more information on Codacy Analysis CLI in general, see
# https://github.com/codacy/codacy-analysis-cli.
name: Codacy Security Scan
on:
push:
branches: [ "master" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "master" ]
schedule:
- cron: '37 15 * * 5'
permissions:
contents: read
jobs:
codacy-security-scan:
permissions:
contents: read # for actions/checkout to fetch code
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
name: Codacy Security Scan
runs-on: ubuntu-latest
steps:
# Checkout the repository to the GitHub Actions runner
- name: Checkout code
uses: actions/checkout@v6
# Run Codacy Analysis CLI
- name: Run Codacy Analysis CLI
uses: codacy/codacy-analysis-cli-action@562ee3e92b8e92df8b67e0a5ff8aa8e261919c08
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
verbose: true
output: results.sarif
format: sarif
gh-code-scanning-compat: true
max-allowed-issues: 2147483647
- name: Merge SARIF runs into one
run: |
python3 <<'EOF'
import json
with open("results.sarif") as f:
sarif = json.load(f)
# Flatten multiple runs into a single run
all_results = []
for run in sarif["runs"]:
all_results.extend(run.get("results", []))
merged_run = sarif["runs"][0]
merged_run["results"] = all_results
sarif["runs"] = [merged_run]
with open("merged.sarif", "w") as f:
json.dump(sarif, f)
EOF
- name: Upload merged SARIF
uses: github/codeql-action/upload-sarif@v4
with:
sarif_file: merged.sarif