Skip to content

Commit aafdac3

Browse files
committed
post sarif to PR
Signed-off-by: Anas Nashif <[email protected]>
1 parent d436718 commit aafdac3

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

.github/workflows/codechecker.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: Codechecker
22
on:
3+
pull_request:
4+
branches:
5+
- main
36
push:
47
branches:
58
- main
@@ -15,6 +18,8 @@ concurrency:
1518
jobs:
1619
Codechecker:
1720
if: github.repository_owner == 'zephyrproject-rtos'
21+
permissions:
22+
pull-requests: write # to create/update pull request comments
1823
runs-on:
1924
group: zephyr-runner-v2-linux-x64-4xlarge
2025
container:
@@ -100,13 +105,26 @@ jobs:
100105
sudo apt-get install -y jq
101106
export PATH=/usr/lib/llvm-16/bin/:$PATH
102107
103-
./scripts/twister -i --force-color -N -v --build-only --timeout-multiplier 2 -p qemu_x86 -T tests/kernel/threads -T tests/lib/heap
108+
./scripts/twister -i --force-color -N -v --build-only --timeout-multiplier 2 -p qemu_x86 -T tests/kernel/threads/thread_apis/
104109
105110
#sarif copy --output results.sarif $(find twister-out -name "codechecker.sarif")
106111
jq -s '{ "$schema": "https://json.schemastore.org/sarif-2.1.0", "version": "2.1.0", "runs": map(.runs) | add }' $(find twister-out -name "codechecker.sarif") > results.sarif
107112
113+
- name: Post SARIF findings in the pull request
114+
if: github.event_name == 'pull_request'
115+
uses: sett-and-hive/[email protected]
116+
with:
117+
token: ${{ secrets.GITHUB_TOKEN }}
118+
branch: ${{ github.head_ref }}
119+
pr-number: ${{ github.event.number }}
120+
repository: ${{ github.repository }}
121+
sarif-file: "./results.sarif"
122+
title: My security issue
123+
dry-run: 'false'
124+
odc-sarif: true
125+
108126
- name: Upload SARIF as artifact
109-
if: always()
127+
if: always() && github.event_name == 'push'
110128
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
111129
with:
112130
name: sarif

0 commit comments

Comments
 (0)