Skip to content

Commit 65b0fd6

Browse files
committed
fix: introduce uv-lock in ci.yml
1 parent 83eee3f commit 65b0fd6

File tree

1 file changed

+26
-7
lines changed

1 file changed

+26
-7
lines changed

.github/workflows/ci.yml

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,46 @@ 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]
12+
permissions:
13+
contents: write
14+
pull-requests: write
1515

1616
jobs:
1717
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]'
2218
runs-on: ubuntu-latest
2319
strategy:
2420
matrix:
2521
python: ["3.10", "3.11", "3.12", "3.13"]
2622

2723
steps:
24+
- uses: actions/create-github-app-token@v1
25+
id: app
26+
with:
27+
app-id: ${{ secrets.APP_ID }}
28+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
2829
- uses: actions/checkout@v5
30+
with:
31+
ref: ${{ github.event.pull_request.head.ref }}
32+
repository: ${{ github.event.pull_request.head.repo.full_name }}
33+
token: ${{ steps.app.outputs.token }}
2934
- name: Install uv and set the Python version
3035
uses: astral-sh/setup-uv@v6
3136
with:
3237
python-version: ${{ matrix.python }}
38+
# refresh lock only for Dependabot PRs
39+
- name: Refresh uv.lock (Dependabot only)
40+
if: |
41+
github.event_name == 'pull_request' &&
42+
github.actor == 'dependabot[bot]'
43+
run: |
44+
uv lock
45+
if ! git diff --quiet -- uv.lock; then
46+
git config user.name "uv-lock-bot[bot]"
47+
git config user.email "uv-lock-bot[bot]@users.noreply.github.com"
48+
git add uv.lock
49+
git commit -m "chore: refresh uv.lock"
50+
git push || echo "push skipped (no perms)"
51+
fi
3352
- name: Install dependencies
3453
run: |
3554
uv sync --locked --only-dev

0 commit comments

Comments
 (0)