Skip to content

ci-locks

ci-locks #40

Workflow file for this run

# Reference:
# - https://github.com/actions/checkout
# - https://github.com/prefix-dev/setup-pixi
# - https://github.com/pavelzw/pixi-diff-to-markdown
# - https://github.com/peter-evans/create-pull-request
name: ci-locks
on:
schedule:
- cron: "3 0 * * 1"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
SHELLOPTS: "errexit:pipefail"
NAME: "mo-pack-py313"
defaults:
run:
shell: bash -l {0}
jobs:
locks-update:
name: "update lockfiles"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: "setup pixi"
uses: prefix-dev/setup-pixi@82d477f15f3a381dbcc8adc1206ce643fe110fb7
with:
run-install: false
- name: "refresh pixi"
run: |
pixi update --json | pixi exec pixi-diff-to-markdown > diff.md
if [ $(wc -c < diff.md) -lt 10 ]; then
rm -f diff.md
fi
- name: "refresh locks"
if: ${{ hashFiles('diff.md') }}
run: |
pixi workspace export conda-explicit-spec --environment ${{ env.NAME }} --frozen --ignore-pypi-errors requirements
pixi workspace export conda-environment --environment ${{ env.NAME }} requirements/mo-pack.yml
- name: "generate token"
uses: actions/create-github-app-token@v2
id: generate-token
with:
app-id: ${{ secrets.AUTH_APP_ID }}
private-key: ${{ secrets.AUTH_APP_PRIVATE_KEY }}
- name: "create pull-request"
id: cpr
if: ${{ hashFiles('diff.md') }}
uses: peter-evans/create-pull-request@84ae59a2cdc2258d6fa0732dd66352dddae2a412
with:
token: ${{ steps.generate-token.outputs.token }}
add-paths: |
${{ github.workspace }}/pixi.lock
${{ github.workspace }}/requirements/mo-pack*.txt
${{ github.workspace }}/requirements/mo-pack*.yml
commit-message: "updated lockfiles"
branch: pixi-auto-update
base: main
delete-branch: true
title: "chore: pixi update lockfiles"
body-path: ${{ github.workspace }}/diff.md
labels: |
new: pull request
bot
pixi
- name: "show pull-request"
if: ${{ hashFiles('diff.md') }}
run: |
echo "### :rocket: Pull-Request Summary" >> ${GITHUB_STEP_SUMMARY}
echo "" >> ${GITHUB_STEP_SUMMARY}
echo "The following locks pull-request has been auto-generated:"
echo "- **PR** #${{ steps.cpr.outputs.pull-request-number }}" >> ${GITHUB_STEP_SUMMARY}
echo "- **URL** ${{ steps.cpr.outputs.pull-request-url }}" >> ${GITHUB_STEP_SUMMARY}
echo "- **Operation** [${{ steps.cpr.outputs.pull-request-operation }}]" >> ${GITHUB_STEP_SUMMARY}
echo "- **SHA** ${{ steps.cpr.outputs.pull-request-head-sha }}" >> ${GITHUB_STEP_SUMMARY}