Skip to content

Commit de1344d

Browse files
authored
chore(ci): Add workflow to update pixi lock on PRs (#3560)
In #3556, @tsalo discovered he couldn't (effectively) run `pixi lock` from a mac, which I believe is due to prefix-dev/pixi#3081. This PR runs `pixi lock` on PRs and commits to the incoming branch if they are out-of-date. #3559 demonstrates (see, e.g., 35151f7).
2 parents a1c53ad + d7e5307 commit de1344d

File tree

2 files changed

+55
-17
lines changed

2 files changed

+55
-17
lines changed

.github/workflows/docker.yml

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,6 @@ env:
1818
FORCE_COLOR: true
1919

2020
jobs:
21-
check-pixi:
22-
runs-on: ubuntu-latest
23-
permissions:
24-
contents: read
25-
steps:
26-
- name: Checkout repository
27-
uses: actions/checkout@v5
28-
with:
29-
fetch-depth: 200
30-
fetch-tags: true
31-
ref: ${{ github.ref }}
32-
- uses: prefix-dev/[email protected]
33-
with:
34-
pixi-version: v0.55.0
35-
run-install: false
36-
- run: pixi lock --check
37-
3821
build-container:
3922
runs-on: ubuntu-latest
4023
permissions:

.github/workflows/pixi-lock.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
on:
2+
pull_request_target
3+
4+
concurrency:
5+
group: ${{ github.workflow }}-${{ github.ref }}
6+
cancel-in-progress: true
7+
8+
jobs:
9+
check-lockfile:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
steps:
14+
- name: Checkout pull request
15+
uses: actions/checkout@v5
16+
with:
17+
ref: ${{ github.event.pull_request.head.sha }}
18+
token: ${{ secrets.GITHUB_TOKEN }}
19+
fetch-depth: 0
20+
- name: Find submitting repository
21+
id: get-source-repo
22+
uses: actions/github-script@v8
23+
env:
24+
OWNER: ${{ github.repository_owner }}
25+
REPO: ${{ github.repository }}
26+
PULL: ${{ github.event.number }}
27+
with:
28+
script: |
29+
const { data } = await github.rest.pulls.get({
30+
owner: process.env.OWNER,
31+
repo: process.env.REPO.split('/')[1],
32+
pull_number: process.env.PULL,
33+
});
34+
core.setOutput('remote', data.head.repo.html_url)
35+
core.setOutput('branch', data.head.ref)
36+
- name: Set git identity
37+
run: |
38+
git config --global user.name "nipreps[bot]"
39+
git config --global user.email "[email protected]"
40+
- uses: prefix-dev/[email protected]
41+
with:
42+
pixi-version: v0.58.0
43+
run-install: false
44+
- name: Install the latest version of uv
45+
uses: astral-sh/setup-uv@v7
46+
- name: Update lockfile
47+
run: >
48+
uvx datalad run -i pixi.lock -i pyproject.toml -o pixi.lock --
49+
bash -c '! pixi lock --check || git checkout .'
50+
- name: Push updated lockfile, if needed
51+
run: |
52+
git push $REMOTE HEAD:$BRANCH
53+
env:
54+
REMOTE: ${{ steps.get-source-repo.outputs.remote }}
55+
BRANCH: ${{ steps.get-source-repo.outputs.branch }}

0 commit comments

Comments
 (0)