Skip to content

Commit c13d3a4

Browse files
committed
chore: Add CodeQL and semgrep
Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es>
1 parent 32d2556 commit c13d3a4

File tree

2 files changed

+85
-0
lines changed

2 files changed

+85
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request: {}
7+
8+
permissions:
9+
contents: read
10+
security-events: write
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
codeQl:
18+
name: Analyze CodeQL Go
19+
runs-on: ubuntu-latest
20+
container: ghcr.io/kedacore/keda-tools:1.25.6
21+
if: (github.actor != 'dependabot[bot]')
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
25+
- name: Register workspace path
26+
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
27+
28+
- name: Initialize CodeQL
29+
uses: github/codeql-action/init@5d4e8d1aca955e8d8589aabd499c5cae939e33c7 # v4.31.9
30+
with:
31+
languages: go
32+
queries: +security-and-quality
33+
34+
- name: Autobuild
35+
uses: github/codeql-action/autobuild@5d4e8d1aca955e8d8589aabd499c5cae939e33c7 # v4.31.9
36+
37+
- name: Perform CodeQL Analysis
38+
uses: github/codeql-action/analyze@5d4e8d1aca955e8d8589aabd499c5cae939e33c7 # v4.31.9
39+
with:
40+
category: "/language:go"
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: "Semgrep"
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request_target: {}
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
10+
cancel-in-progress: true
11+
12+
permissions:
13+
contents: read
14+
security-events: write
15+
16+
jobs:
17+
semgrep:
18+
name: Analyze Semgrep
19+
runs-on: ubuntu-latest
20+
container: returntocorp/semgrep
21+
if: (github.actor != 'dependabot[bot]')
22+
steps:
23+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
24+
- name: Register workspace path
25+
if: ${{ github.event.number > 0 }}
26+
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
27+
28+
- name: Checkout Pull Request
29+
env:
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
id: checkout
32+
if: ${{ github.event.number > 0 }}
33+
run: |
34+
apk add github-cli
35+
gh pr checkout ${{ github.event.number }}
36+
37+
- run: semgrep ci --exclude=test --exclude=test --sarif --output=semgrep.sarif
38+
env:
39+
SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }}
40+
41+
- name: Upload SARIF file for GitHub Advanced Security Dashboard
42+
uses: github/codeql-action/upload-sarif@5d4e8d1aca955e8d8589aabd499c5cae939e33c7 # v4.31.9
43+
with:
44+
sarif_file: semgrep.sarif
45+
if: ${{ github.event.number == '' && !cancelled() }}

0 commit comments

Comments
 (0)