Skip to content

Commit 66e894d

Browse files
JaclynCodesCopilot
andauthored
Add Codacy security scan workflow (#9)
* Add Codacy security scan workflow This workflow integrates Codacy security scans with GitHub Actions, checking code on push and pull requests to the main branch, and scheduling weekly scans. Signed-off-by: Misfit <218383634+JaclynCodes@users.noreply.github.com> * Update .github/workflows/codacy.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Misfit <218383634+JaclynCodes@users.noreply.github.com> * Update .github/workflows/codacy.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Misfit <218383634+JaclynCodes@users.noreply.github.com> * Update .github/workflows/codacy.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Misfit <218383634+JaclynCodes@users.noreply.github.com> --------- Signed-off-by: Misfit <218383634+JaclynCodes@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent d22da3e commit 66e894d

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

.github/workflows/codacy.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
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+
# This workflow checks out code, performs a Codacy security scan
7+
# and integrates the results with the
8+
# GitHub Advanced Security code scanning feature. For more information on
9+
# the Codacy security scan action usage and parameters, see
10+
# https://github.com/codacy/codacy-analysis-cli-action.
11+
# For more information on Codacy Analysis CLI in general, see
12+
# https://github.com/codacy/codacy-analysis-cli.
13+
14+
name: Codacy Security Scan
15+
16+
on:
17+
push:
18+
branches: [ "main" ]
19+
pull_request:
20+
# The branches below must be a subset of the branches above
21+
branches: [ "main" ]
22+
schedule:
23+
- cron: '43 17 * * 0'
24+
25+
permissions:
26+
contents: read
27+
28+
jobs:
29+
codacy-security-scan:
30+
permissions:
31+
contents: read # for actions/checkout to fetch code
32+
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
33+
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
34+
name: Codacy Security Scan
35+
runs-on: ubuntu-latest
36+
steps:
37+
# Checkout the repository to the GitHub Actions runner
38+
- name: Checkout code
39+
uses: actions/checkout@v5
40+
41+
# Execute Codacy Analysis CLI and generate a SARIF output with the security issues identified during the analysis
42+
- name: Run Codacy Analysis CLI
43+
# Pinned to a specific commit SHA for security; update this SHA when bumping the Codacy action version.
44+
# When updating, look up and note the corresponding release tag for this commit in Codacy's repository.
45+
uses: codacy/codacy-analysis-cli-action@d840f886c4bd4edc059706d09c6a1586111c540b
46+
with:
47+
# Check https://github.com/codacy/codacy-analysis-cli#project-token to get your project token from your Codacy repository
48+
# You can also omit the token and run the tools that support default configurations
49+
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
50+
verbose: true
51+
output: results.sarif
52+
format: sarif
53+
# Adjust severity of non-security issues
54+
gh-code-scanning-compat: true
55+
# Force 0 exit code to allow SARIF file generation
56+
# This will hand over control about PR rejection to the GitHub side
57+
max-allowed-issues: 2147483647
58+
59+
# Upload the SARIF file generated in the previous step
60+
- name: Upload SARIF results file
61+
uses: github/codeql-action/upload-sarif@v3
62+
with:
63+
sarif_file: results.sarif

0 commit comments

Comments
 (0)