Autoupdate #80
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Autoupdate | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: 0 6 * * * | |
jobs: | |
update: | |
name: Update ${{ matrix.name }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- script: update_actions | |
name: gh-actions | |
steps: | |
- name: Checkout branch | |
uses: actions/checkout@v4 | |
- name: Set up pixi | |
uses: prefix-dev/setup-pixi@ba3bb36eb2066252b2363392b7739741bb777659 | |
with: | |
activate-environment: true | |
- name: Update ${{ matrix.name }} | |
run: python -m scripts.${{ matrix.script }} | |
env: | |
GH_TOKEN: ${{ github.token }} | |
- uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c | |
with: | |
commit-message: Auto-update ${{ matrix.name }} | |
title: Auto-update ${{ matrix.name }} | |
body: | | |
New versions of pinned dependencies in ${{ matrix.name }} were detected. | |
This PR updates them to the latest version. | |
branch: update-${{ matrix.name }} | |
delete-branch: true | |
- name: Create issue on failure | |
if: failure() | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
github.rest.issues.listForRepo({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
state: "open", | |
labels: "[bot] autoupdate" | |
}).then((issues) => { | |
if (issues.data.length === 0) { | |
github.rest.issues.create({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
title: "${{ matrix.name }} update failed", | |
body: "See https://github.com/quantco/copier-template-python-open-source/actions/runs/${{ github.run_id }} for details.", | |
labels: ["[bot] autoupdate"] | |
}) | |
} | |
}); |