name: "[SAST] Codacy" on: # push: # branches: ["main"] # pull_request: # branches: ["main"] workflow_dispatch: inputs: Upload: description: 'Upload SARIF results file' default: true type: boolean permissions: contents: read jobs: codacy-security-scan: name: Codacy Security Scan runs-on: ubuntu-latest permissions: contents: read security-events: write actions: read steps: - uses: actions/checkout@v7 - name: Fix encoding to UTF-8 run: | find . -type f -name "*.go" | while read -r file; do if ! iconv -f UTF-8 -t UTF-8 "$file" >/dev/null 2>&1; then echo "File $file is not UTF-8" iconv -f CP1251 -t UTF-8 "$file" -o "$file.tmp" && mv "$file.tmp" "$file" fi done - name: Run Codacy Analysis CLI uses: codacy/codacy-analysis-cli-action@562ee3e92b8e92df8b67e0a5ff8aa8e261919c08 env: JAVA_TOOL_OPTIONS: "-Dfile.encoding=UTF-8" with: project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} verbose: true output: results.sarif format: sarif gh-code-scanning-compat: true max-allowed-issues: 2147483647 - name: Upload SARIF results file if: ${{ github.event.inputs.Upload == 'true' }} uses: github/codeql-action/upload-sarif@v4.39.1 with: sarif_file: results.sarif