Skip to content

sync-dependencies

sync-dependencies #15

name: sync-dependencies
on:
schedule:
- cron: '0 0 * * *'
pull_request:
paths:
- "pyproject.toml"
workflow_dispatch:
jobs:
sync-and-prepare:
runs-on: ubuntu-latest
outputs:
changed: ${{ steps.check.outputs.changed }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref || github.ref }}
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Sync and Upgrade
run: |
uv lock || (rm uv.lock && uv lock)
uv lock --upgrade
- name: Sync Conda Recipe
run: |
uvx pyproject2conda yaml -f pyproject.toml --output conda/meta.yaml --python-include infer
- name: Check for changes
id: check
run: |
if [ -n "$(git status --porcelain)" ]; then
echo "changed=true" >> $GITHUB_OUTPUT
fi
- name: Upload artifacts for testing
if: steps.check.outputs.changed == 'true'
uses: actions/upload-artifact@v4
with:
name: updated-deps
path: |
uv.lock
conda/meta.yaml
run-tests:
needs: sync-and-prepare
if: needs.sync-and-prepare.outputs.changed == 'true'
uses: ./.github/workflows/python-package.yml
secrets: inherit
finalize:
needs: [sync-and-prepare, run-tests]
if: success()
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref || github.ref }}
- name: Download updated files
uses: actions/download-artifact@v4
with:
name: updated-deps
- name: Push to Existing PR
if: github.event_name == 'pull_request'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add uv.lock conda/meta.yaml
git commit -m "chore: sync uv.lock and conda recipe (tests passed)" || echo "No changes"
git push origin HEAD:${{ github.event.pull_request.head.ref }}
- name: Create New Pull Request
if: github.event_name != 'pull_request'
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "chore: update uv.lock and conda recipe"
title: "chore(deps): sync uv and conda"
body: "Automated daily sync."
branch: "automated-dependency-sync"
delete-branch: true
assignees: Scartography
reviewers: ungarj
labels: dependencies, automated-pr