Skip to content

Commit 9340438

Browse files
committed
tests 3.10 and 3.12, adds dependabot automation
1 parent 29f1afd commit 9340438

File tree

3 files changed

+87
-1
lines changed

3 files changed

+87
-1
lines changed

.github/dependabot.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# .github/dependabot.yml
2+
version: 2
3+
updates:
4+
# Monitor GitHub Actions for updates
5+
- package-ecosystem: "github-actions"
6+
directory: "/"
7+
schedule:
8+
interval: "weekly"
9+
# Keeps actions like actions/checkout, actions/setup-python up to date
10+
11+
# Monitor Python dependencies in pyproject.toml
12+
- package-ecosystem: "pip"
13+
directory: "/"
14+
schedule:
15+
interval: "weekly"
16+
# Monitors dev dependencies: ruff, mypy, pytest, etc.

.github/workflows/ci.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,16 @@ on: [push, pull_request]
66
jobs:
77
checks:
88
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
python-version: ["3.10", "3.x"]
912
steps:
1013
- uses: actions/checkout@v4
1114
with:
1215
fetch-depth: 0 # Fetch all history for git rev-parse
1316
- uses: actions/setup-python@v5
1417
with:
15-
python-version: "3.12"
18+
python-version: ${{ matrix.python-version }}
1619
- uses: abatilo/actions-poetry@v2
1720
- run: poetry install
1821
- run: poetry run poe check
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# .github/workflows/dependabot-automation.yml
2+
#
3+
# Automates Dependabot PRs by:
4+
# 1. Updating poetry.lock to match new dependency versions in pyproject.toml
5+
# 2. Installing updated dependencies and running automated fixes (ruff format, type checks, tests)
6+
# 3. Committing any changes back to the Dependabot PR branch
7+
# 4. Waiting for CI checks (Python 3.10 and 3.x) to complete
8+
# 5. Auto-merging the PR if all checks pass
9+
#
10+
# Security: Only runs when github.actor == 'dependabot[bot]', which cannot be spoofed
11+
# by external users. This is a GitHub-guaranteed trusted identity.
12+
#
13+
name: Dependabot Automation
14+
15+
on:
16+
pull_request:
17+
paths:
18+
- 'pyproject.toml'
19+
20+
jobs:
21+
automate:
22+
if: github.actor == 'dependabot[bot]'
23+
runs-on: ubuntu-latest
24+
permissions:
25+
contents: write
26+
pull-requests: write
27+
steps:
28+
- uses: actions/checkout@v4
29+
with:
30+
ref: ${{ github.head_ref }}
31+
token: ${{ secrets.GITHUB_TOKEN }}
32+
33+
- uses: actions/setup-python@v5
34+
with:
35+
python-version: "3.x"
36+
37+
- uses: abatilo/actions-poetry@v2
38+
39+
- name: Update poetry.lock
40+
run: poetry lock --no-update
41+
42+
- name: Install dependencies
43+
run: poetry install
44+
45+
- name: Run formatting and linting fixes
46+
run: poetry run poe check:fix
47+
48+
- name: Commit changes
49+
run: |
50+
git config --global user.name 'github-actions[bot]'
51+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
52+
git add -A
53+
git diff --staged --quiet || git commit -m "chore: update poetry.lock and apply auto-fixes"
54+
git push
55+
56+
- name: Wait for CI to complete
57+
uses: lewagon/wait-on-check-action@v1.3.4
58+
with:
59+
ref: ${{ github.head_ref }}
60+
check-name: 'checks'
61+
repo-token: ${{ secrets.GITHUB_TOKEN }}
62+
wait-interval: 10
63+
64+
- name: Auto-merge Dependabot PR
65+
run: gh pr merge --auto --squash "${{ github.event.pull_request.html_url }}"
66+
env:
67+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)