From ac914285b81fdd7e6eb960e79158f004391054b7 Mon Sep 17 00:00:00 2001
From: Joris Vaillant <joris.vaillant@inria.fr>
Date: Thu, 21 Nov 2024 16:02:04 +0100
Subject: [PATCH] ci: Add a workflow to update Pixi lockfile every month

---
 .github/workflows/update_pixi_lockfile.yml | 52 ++++++++++++++++++++++
 1 file changed, 52 insertions(+)
 create mode 100644 .github/workflows/update_pixi_lockfile.yml

diff --git a/.github/workflows/update_pixi_lockfile.yml b/.github/workflows/update_pixi_lockfile.yml
new file mode 100644
index 00000000..f0b5f10f
--- /dev/null
+++ b/.github/workflows/update_pixi_lockfile.yml
@@ -0,0 +1,52 @@
+name: CI - Update Pixi lockfile
+permissions:
+  contents: write
+  pull-requests: write
+
+on:
+  workflow_dispatch:
+  schedule:
+    - cron: 0 5 1 * *
+
+jobs:
+  pixi-update:
+    runs-on: ubuntu-latest
+
+    steps:
+      - uses: actions/create-github-app-token@v1
+        id: generate-token
+        with:
+          app-id: ${{ secrets.APP_ID }}
+          private-key: ${{ secrets.APP_PRIVATE_KEY }}
+
+      - uses: actions/checkout@v4
+        with:
+          token: ${{ steps.generate-token.outputs.token }}
+          ref: devel
+          # Make sure the value of GITHUB_TOKEN will not be persisted in repo's config
+          persist-credentials: false
+
+      - name: Set up pixi
+        uses: prefix-dev/setup-pixi@v0.8.1
+        with:
+          run-install: false
+
+      - name: Update lockfile
+        run: |
+          set -o pipefail
+          pixi update --json | pixi exec pixi-diff-to-markdown >> diff.md
+
+      - name: Create pull request
+        uses: peter-evans/create-pull-request@v7
+        with:
+          token: ${{ steps.generate-token.outputs.token }}
+          commit-message: 'pixi: Update pixi lockfile'
+          title: Update pixi lockfile
+          body-path: diff.md
+          branch: topic/update-pixi
+          base: devel
+          labels: |
+            pixi
+            no changelog
+          delete-branch: true
+          add-paths: pixi.lock
-- 
GitLab