Skip to content

Commit 83eee3f

Browse files
authored
Introduce dependabot (#134)
This PR enables `Dependabot`.
1 parent ee45884 commit 83eee3f

File tree

3 files changed

+58
-0
lines changed

3 files changed

+58
-0
lines changed

.github/dependabot.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
version: 2
3+
updates:
4+
- package-ecosystem: "pip"
5+
directory: "/"
6+
schedule:
7+
interval: "monthly"
8+
open-pull-requests-limit: 25
9+
commit-message:
10+
prefix: "deps"
11+
versioning-strategy: increase

.github/workflows/ci.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,16 @@ on:
99
branches:
1010
- master
1111

12+
workflow_run: # chain from the uv-lock workflow
13+
workflows: ["uv.lock on Dependabot PRs"]
14+
types: [completed]
15+
1216
jobs:
1317
build:
18+
# Only run if not a Dependabot PR, or once uv-lock has completed successfully
19+
if: |
20+
github.event_name == 'workflow_run' ||
21+
github.actor != 'dependabot[bot]'
1422
runs-on: ubuntu-latest
1523
strategy:
1624
matrix:
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: uv.lock on Dependabot PRs
2+
# 📝 Description:
3+
# Using Dependabot with "pip" to avoid uv’s specifier normalization (~= → >=,<).
4+
# Consequence: pip updates only pyproject.toml, not uv.lock → `uv sync --locked` would fail.
5+
# Fix: on Dependabot PRs that touch pyproject.toml, run `uv lock`, commit uv.lock if changed,
6+
# then dispatch ci.yml so CI runs against the refreshed lockfile.
7+
8+
on:
9+
pull_request:
10+
paths: ["pyproject.toml"]
11+
permissions:
12+
contents: write
13+
pull-requests: write
14+
15+
jobs:
16+
uv-lock:
17+
if: github.actor == 'dependabot[bot]'
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
with:
22+
ref: ${{ github.event.pull_request.head.ref }}
23+
repository: ${{ github.event.pull_request.head.repo.full_name }}
24+
- uses: actions/setup-python@v5
25+
with:
26+
python-version: "3.12"
27+
- name: Install uv
28+
uses: astral-sh/setup-uv@v6
29+
- name: Update lockfile
30+
run: uv lock
31+
- name: Commit updated uv.lock
32+
run: |
33+
if ! git diff --quiet -- uv.lock; then
34+
git config user.name "github-actions[bot]"
35+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
36+
git add uv.lock
37+
git commit -m "chore: refresh uv.lock"
38+
git push
39+
fi

0 commit comments

Comments
 (0)