Skip to content

Commit ed2442d

Browse files
committed
build: harden CI with frozen installs and octo-sts token federation
## What Add --frozen and --python flags to all CI uv sync calls, and replace GITHUB_TOKEN with an octo-sts OIDC-federated token in the update-uv-lock workflow so its commits trigger subsequent CI runs. ## Why Without --frozen, uv sync silently re-resolves dependencies when uv.lock is out of date, masking lockfile staleness in CI. Without --python, the CI matrix may use the runner's default Python instead of the intended version. Commits made with GITHUB_TOKEN do not trigger subsequent workflow runs, so Dependabot PRs with uv.lock updates were not getting CI checks on the lockfile commit. ## Notes - python-ci.yml: uv sync --frozen --python ${{ matrix.python-version }} - super-linter.yaml: uv sync --frozen - copilot-setup-steps.yml: uv sync --frozen --python 3.14 - Trust policy in .github/chainguard/update-uv-lock.sts.yaml scoped to pull_request events with job_workflow_ref matching update-uv-lock.yml - Requires octo-sts app installed on the org Signed-off-by: jmeridth <jmeridth@gmail.com>
1 parent beb205c commit ed2442d

5 files changed

Lines changed: 22 additions & 9 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
issuer: https://token.actions.githubusercontent.com
2+
subject_pattern: "repo:github-community-projects/contributors:pull_request"
3+
claim_pattern:
4+
job_workflow_ref: "github-community-projects/contributors/.github/workflows/update-uv-lock.yml@.*"
5+
6+
permissions:
7+
contents: write

.github/workflows/copilot-setup-steps.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@ jobs:
3939
run: uv python install 3.14
4040

4141
- name: Install dependencies
42-
run: uv sync
42+
run: uv sync --frozen --python 3.14

.github/workflows/python-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
- name: Set up Python ${{ matrix.python-version }}
3131
run: uv python install ${{ matrix.python-version }}
3232
- name: Install dependencies
33-
run: uv sync
33+
run: uv sync --frozen --python ${{ matrix.python-version }}
3434
- name: Lint with flake8 and pylint
3535
run: |
3636
make lint

.github/workflows/super-linter.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
with:
2828
enable-cache: true
2929
- name: Install dependencies
30-
run: uv sync
30+
run: uv sync --frozen
3131
- name: Lint Code Base
3232
uses: super-linter/super-linter@61abc07d755095a68f4987d1c2c3d1d64408f1f9 # v8.5.0
3333
env:

.github/workflows/update-uv-lock.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,35 @@ on:
77
- pyproject.toml
88

99
permissions:
10-
contents: write
11-
pull-requests: write
10+
id-token: write
1211

1312
jobs:
1413
update-lock:
1514
if: github.event.pull_request.user.login == 'dependabot[bot]'
1615
runs-on: ubuntu-latest
1716
steps:
17+
- name: Get GitHub App token via octo-sts
18+
uses: octo-sts/action@f603d3be9d8dd9871a265776e625a27b00effe05 # v1.1.1
19+
id: octo-sts
20+
with:
21+
scope: github-community-projects/contributors
22+
identity: update-uv-lock
23+
1824
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1925
with:
2026
ref: ${{ github.head_ref }}
21-
persist-credentials: true
27+
token: ${{ steps.octo-sts.outputs.token }}
2228

2329
- name: Install uv
2430
uses: astral-sh/setup-uv@5a095e7a2014a4212f075830d4f7277575a9d098 # v7.3.1
2531

2632
- name: Update uv.lock
2733
run: uv lock
2834

29-
- name: Commit updated lockfile
35+
- name: Commit and push updated lockfile
3036
run: |
31-
git config user.name "github-actions[bot]"
32-
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
37+
git config user.name "octo-sts[bot]"
38+
git config user.email "801323+octo-sts[bot]@users.noreply.github.com"
3339
git add uv.lock
3440
git diff --cached --quiet || git commit -s -m "chore(deps): update uv.lock"
3541
git push

0 commit comments

Comments
 (0)