Skip to content

Commit dbbb1fd

Browse files
committed
Add dependency and security automation
Add Dependabot coverage for Python dependencies and GitHub Actions. Add a portable pre-commit configuration for Ruff, Bandit, and detect-secrets, and document local use. Add a dedicated CodeQL workflow with a stable codeql check name for branch protection. Validation: .venv/bin/pre-commit run --all-files; .venv/bin/ruff check .; .venv/bin/bandit -c pyproject.toml -r src; git ls-files -z | xargs -0 .venv/bin/detect-secrets-hook --baseline .secrets.baseline; PYTHONPATH=src python3 -m unittest discover -s tests; python3 -m compileall -q src tests.
1 parent 27d799d commit dbbb1fd

5 files changed

Lines changed: 83 additions & 0 deletions

File tree

.github/dependabot.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "pip"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
day: "monday"
8+
time: "04:00"
9+
timezone: "Europe/Berlin"
10+
open-pull-requests-limit: 5
11+
labels:
12+
- "dependencies"
13+
- "python"
14+
15+
- package-ecosystem: "github-actions"
16+
directory: "/"
17+
schedule:
18+
interval: "weekly"
19+
day: "monday"
20+
time: "04:30"
21+
timezone: "Europe/Berlin"
22+
open-pull-requests-limit: 5
23+
labels:
24+
- "dependencies"
25+
- "github-actions"

.github/workflows/codeql.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: CodeQL
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
schedule:
9+
- cron: "32 4 * * 1"
10+
11+
permissions:
12+
actions: read
13+
contents: read
14+
security-events: write
15+
16+
jobs:
17+
codeql:
18+
name: codeql
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Check out repository
22+
uses: actions/checkout@v4
23+
24+
- name: Initialize CodeQL
25+
uses: github/codeql-action/init@v4
26+
with:
27+
languages: python
28+
29+
- name: Perform CodeQL analysis
30+
uses: github/codeql-action/analyze@v4

.pre-commit-config.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
repos:
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
rev: v0.14.8
4+
hooks:
5+
- id: ruff-check
6+
7+
- repo: local
8+
hooks:
9+
- id: bandit
10+
name: bandit
11+
entry: bandit -c pyproject.toml -r src
12+
language: python
13+
pass_filenames: false
14+
additional_dependencies: ["bandit[toml]==1.8.6"]
15+
16+
- repo: https://github.com/Yelp/detect-secrets
17+
rev: v1.5.0
18+
hooks:
19+
- id: detect-secrets
20+
args: ["--baseline", ".secrets.baseline"]

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ PYTHONPATH=src python3 -m unittest discover -s tests
5959
python3 -m compileall -q src tests
6060
```
6161

62+
Optional local pre-commit checks use the same installed development tools:
63+
64+
```bash
65+
.venv/bin/pre-commit install
66+
.venv/bin/pre-commit run --all-files
67+
```
68+
6269
Plugins can run on independent schedules by setting `interval_seconds` on each
6370
`[[plugins]]` entry. If omitted, the global `poll_interval_seconds` is used.
6471
Set `interval_seconds = 0` to run a plugin every scheduler cycle.

requirements-dev.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
bandit[toml]==1.8.6
22
detect-secrets==1.5.0
3+
pre-commit==4.6.0
34
ruff==0.14.8

0 commit comments

Comments
 (0)