Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 58 additions & 1 deletion .github/workflows/update-lockfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,51 @@ on:
push:
paths:
- pixi.toml
- pixi.lock
schedule:
- cron: "0 8 1,16 * *" # Bi-weekly
workflow_dispatch:

permissions:
contents: write
pull-requests: write

jobs:
check-diff:
runs-on: ubuntu-latest
outputs:
has_diff: ${{ steps.check_diff.outputs.has_diff }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Check pixi files diff
id: check_diff
run: |
if [[ "${{ github.ref }}" == "refs/heads/master" ]]; then
echo "has_diff=true" >> $GITHUB_OUTPUT
echo "Running on master branch - will proceed with update of lockfiles."
exit 0
fi

git fetch origin master
if git diff origin/master...HEAD -- pixi.toml pixi.lock | grep -q .; then
echo "has_diff=true" >> $GITHUB_OUTPUT
echo "Differences found compared to master - will proceed with update of lockfiles."
else
echo "has_diff=false" >> $GITHUB_OUTPUT
echo "No differences found compared to master - will skip update of lockfiles."
fi
env:
GH_TOKEN: ${{ github.token }}

update-locked-environment:
if: ${{ github.ref == 'refs/heads/master' }}
if: |
needs.check-diff.outputs.has_diff == 'true' &&
(github.event_name == 'schedule' && github.ref == 'refs/heads/master' ||
github.event_name != 'schedule' && github.ref != 'refs/heads/master')
needs: check-diff
name: Update lockfiles
runs-on: ubuntu-latest
defaults:
Expand All @@ -22,6 +60,7 @@ jobs:
uses: prefix-dev/setup-pixi@v0.9.3
with:
pixi-version: v0.59.0
run-install: false

- name: Update lockfile
run: |
Expand All @@ -45,7 +84,25 @@ jobs:
pixi.lock
envs/

create-commit:
if: ${{ github.ref != 'refs/heads/master' }}
needs: update-locked-environment
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6

- name: Download all artifacts
uses: actions/download-artifact@v7
with:
name: lockfiles

- name: Create Commit
uses: stefanzweifel/git-auto-commit-action@v7
with:
commit_message: "[github-actions.ci] Update locked envs"

create-pull-request:
if: ${{ github.ref == 'refs/heads/master' }}
needs: update-locked-environment
runs-on: ubuntu-latest
steps:
Expand Down
Loading