|
9 | 9 | branches: |
10 | 10 | - master |
11 | 11 |
|
12 | | -permissions: |
13 | | - contents: write |
14 | | - pull-requests: write |
| 12 | + workflow_run: # chain from the uv-lock workflow |
| 13 | + workflows: ["uv.lock on Dependabot PRs"] |
| 14 | + types: [completed] |
15 | 15 |
|
16 | 16 | jobs: |
17 | 17 | 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]' |
18 | 22 | runs-on: ubuntu-latest |
19 | 23 | strategy: |
20 | 24 | matrix: |
21 | 25 | python: ["3.10", "3.11", "3.12", "3.13"] |
22 | 26 |
|
23 | 27 | 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 }} |
29 | 28 | - 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 }} |
34 | 29 | - name: Install uv and set the Python version |
35 | 30 | uses: astral-sh/setup-uv@v6 |
36 | 31 | with: |
37 | 32 | 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 |
52 | 33 | - name: Install dependencies |
53 | 34 | run: | |
54 | 35 | uv sync --locked --only-dev |
|
0 commit comments