Skip to content

Commit 62a0492

Browse files
AlexanderDokuchaevshumaari
authored andcommitted
Add CodeQL action (openvinotoolkit#3184)
### Changes Add CodeQL scan Triggers on: - pull_request - push to develop and release branch
1 parent fa9e2f0 commit 62a0492

File tree

2 files changed

+50
-4
lines changed

2 files changed

+50
-4
lines changed

.github/workflows/nightly.yml

+1
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,5 @@ jobs:
4848
run: pytest tests/tensorflow -m 'nightly'
4949

5050
weight-compression:
51+
if: github.repository_owner == 'openvinotoolkit'
5152
uses: ./.github/workflows/conformance_weight_compression.yml

.github/workflows/sdl.yml

+49-4
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,19 @@ name: sdl
22
permissions: read-all
33

44
on:
5+
workflow_dispatch:
6+
push:
7+
branches:
8+
- develop
9+
- release_v*
510
pull_request:
6-
types:
7-
- opened
8-
- reopened
9-
- synchronize
11+
paths:
12+
- '.github/workflows/sdl.yml'
13+
- '**.py'
1014

1115
jobs:
1216
bandit:
17+
name: Bandit
1318
runs-on: ubuntu-20.04
1419
timeout-minutes: 10
1520
defaults:
@@ -25,3 +30,43 @@ jobs:
2530
- name: Run bandit
2631
run: bandit -c pyproject.toml -r .
2732

33+
codeql:
34+
name: CodeQL
35+
runs-on: ubuntu-22.04
36+
timeout-minutes: 15
37+
permissions:
38+
security-events: write
39+
steps:
40+
- name: Checkout repository
41+
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
42+
with:
43+
lfs: true
44+
- name: Initialize CodeQL
45+
uses: github/codeql-action/init@47b3d888fe66b639e431abf22ebca059152f1eea # v3.24.5
46+
with:
47+
languages: python
48+
- name: Perform CodeQL Analysis
49+
uses: github/codeql-action/analyze@47b3d888fe66b639e431abf22ebca059152f1eea # v3.24.5
50+
with:
51+
category: "/language:python"
52+
53+
# pdf reports always empty for pull_request
54+
- name: Generate Security Report
55+
if: ${{ github.event_name != 'pull_request' }}
56+
uses: rsdmike/github-security-report-action@a149b24539044c92786ec39af8ba38c93496495d # v3.0.4
57+
with:
58+
template: report
59+
token: ${{ secrets.GITHUB_TOKEN }}
60+
- name: Rename Report
61+
shell: bash
62+
if: ${{ github.event_name != 'pull_request' }}
63+
run: |
64+
DATE=$(date +"%Y-%m-%d")
65+
REF_NAME="${{ github.ref_name }}"
66+
mv "report.pdf" "codeql_nncf_report_${DATE}_${REF_NAME//\//-}_${{ github.sha }}.pdf"
67+
- name: Upload CodeQL Artifacts
68+
if: ${{ github.event_name != 'pull_request' }}
69+
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b #v4.5.0
70+
with:
71+
name: codeql-scan-results
72+
path: "./codeql*.pdf"

0 commit comments

Comments
 (0)