Repository navigation
79 lines (70 loc) · 2 KB
/
Copy pathcodeql.yml
File metadata and controls
79 lines (70 loc) · 2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: CodeQL
on:
push:
branches: [main, dev]
paths:
- '**.java'
- 'pom.xml'
- 'src/**'
- '.github/workflows/codeql.yml'
pull_request:
branches: [main, dev]
paths:
- '**.java'
- 'pom.xml'
- 'src/**'
- '.github/workflows/codeql.yml'
schedule:
- cron: "0 3 * * 1"
workflow_dispatch:
permissions:
contents: read
security-events: write
actions: read
jobs:
# Early skip detection
changes:
name: Check for relevant changes
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
outputs:
should_run: ${{ steps.filter.outputs.relevant }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check for code changes
id: filter
uses: dorny/paths-filter@v3
with:
# Compare against previous commit, not base branch
base: ${{ github.event.pull_request.base.sha }}
ref: ${{ github.event.pull_request.head.sha }}
initial-fetch-depth: 2
filters: |
relevant:
- '**.java'
- 'pom.xml'
- 'src/**'
- '.github/workflows/codeql.yml'
- name: Skip notification
if: steps.filter.outputs.relevant == 'false'
run: |
echo "## ⏭️ CodeQL Skipped" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "No changes to code or build files detected." >> $GITHUB_STEP_SUMMARY
analyze:
name: Analyze
needs: [changes]
if: always() && (github.event_name != 'pull_request' || needs.changes.outputs.should_run == 'true' || needs.changes.result == 'skipped')
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: java
build-mode: autobuild
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3