Skip to content

Commit 00226c6

Browse files
committed
ci: add concurrency groups, job timeouts, and extend CodeQL to Python
- Add concurrency groups to build, pull-request-lint, dependency-review, and merge-prevention workflows. PR-triggered runs cancel in-progress superseded runs; push and merge_group runs are allowed to complete. pull-request-lint keys on github.event.pull_request.number because pull_request_target's github.ref points to the base branch. - Add timeout-minutes to every job (5-30 min depending on workload) to replace the 6-hour default. - Extend CodeQL matrix to cover Python (build-mode: none) alongside the existing GitHub Actions analysis, so tools/validate.py and any future Python helpers are scanned. - Add a push trigger on main to build.yml so direct pushes to the protected branch still run lint/validate/security.
1 parent 09eec92 commit 00226c6

7 files changed

Lines changed: 33 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
name: Build
22

33
on:
4+
push:
5+
branches: [main]
46
pull_request:
57
branches: [main]
68
merge_group:
79
workflow_dispatch:
810

11+
# Cancel superseded PR runs; let push/merge_group runs complete.
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
15+
916
# Default to no permissions; grant minimally at the job level.
1017
permissions:
1118
actions: none
@@ -27,6 +34,7 @@ permissions:
2734
jobs:
2835
build:
2936
runs-on: ubuntu-latest
37+
timeout-minutes: 10
3038
permissions:
3139
contents: read
3240
steps:

.github/workflows/codeql.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ jobs:
3232
analyze:
3333
name: Analyze (${{ matrix.language }})
3434
runs-on: ubuntu-latest
35+
timeout-minutes: 30
3536
permissions:
3637
security-events: write # upload SARIF to code scanning
3738
packages: read # fetch internal CodeQL packs (no-op for public repos)
@@ -45,6 +46,9 @@ jobs:
4546
# (script injection, untrusted checkout patterns, over-broad tokens).
4647
- language: actions
4748
build-mode: none
49+
# Scans Python helpers (e.g. tools/validate.py).
50+
- language: python
51+
build-mode: none
4852
steps:
4953
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
5054

.github/workflows/dependency-review.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ on:
44
pull_request:
55
branches: [main]
66

7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.ref }}
9+
cancel-in-progress: true
10+
711
# Default to no permissions; grant minimally at the job level.
812
permissions:
913
actions: none
@@ -25,6 +29,7 @@ permissions:
2529
jobs:
2630
dependency-review:
2731
runs-on: ubuntu-latest
32+
timeout-minutes: 5
2833
permissions:
2934
contents: read
3035
steps:

.github/workflows/merge-prevention.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ on:
2626
types:
2727
- checks_requested
2828

29+
# Cancel superseded PR runs; never cancel merge_group runs (they gate a queued merge).
30+
concurrency:
31+
group: ${{ github.workflow }}-${{ github.ref }}
32+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
33+
2934
# Default to no permissions; grant minimally at the job level.
3035
permissions:
3136
actions: none
@@ -51,6 +56,7 @@ env:
5156
jobs:
5257
get-pr-info:
5358
runs-on: ubuntu-latest
59+
timeout-minutes: 5
5460
permissions:
5561
contents: read
5662
pull-requests: read
@@ -77,6 +83,7 @@ jobs:
7783
7884
check-halt-merges:
7985
runs-on: ubuntu-latest
86+
timeout-minutes: 5
8087
needs: get-pr-info
8188
if: always()
8289
steps:
@@ -106,6 +113,7 @@ jobs:
106113
107114
check-do-not-merge-label:
108115
runs-on: ubuntu-latest
116+
timeout-minutes: 5
109117
needs: get-pr-info
110118
if: always()
111119
steps:

.github/workflows/pull-request-lint.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ on:
55
types: [opened, edited, synchronize, reopened]
66
branches: [main]
77

8+
# Key on PR number because pull_request_target's github.ref is the base branch.
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
11+
cancel-in-progress: true
12+
813
# Default to no permissions; grant minimally at the job level.
914
permissions:
1015
actions: none
@@ -26,6 +31,7 @@ permissions:
2631
jobs:
2732
pr-title:
2833
runs-on: ubuntu-latest
34+
timeout-minutes: 5
2935
permissions:
3036
pull-requests: read
3137
steps:

.github/workflows/scorecard-analysis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ jobs:
1414
analysis:
1515
name: Scorecard analysis
1616
runs-on: ubuntu-latest
17+
timeout-minutes: 10
1718
permissions:
1819
contents: read
1920
security-events: write # upload SARIF to code scanning

.github/workflows/stale.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ permissions:
2626
jobs:
2727
stale:
2828
runs-on: ubuntu-latest
29+
timeout-minutes: 10
2930
permissions:
3031
issues: write
3132
pull-requests: write

0 commit comments

Comments
 (0)