Skip to content

Generate a PR if a newer version of micromamba is available #3856

Generate a PR if a newer version of micromamba is available

Generate a PR if a newer version of micromamba is available #3856

name: Generate a PR if a newer version of micromamba is available
on:
workflow_dispatch:
# Run every 6 hours (https://crontab.guru/every-6-hours)
schedule:
- cron: '0 */6 * * *'
jobs:
generate_pr_if_new_micromamba:
runs-on: ubuntu-22.04
steps:
- name: Checkout source
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
- name: Set up Python
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3
with:
python-version: "3.10"
- name: Check available versions
id: check_version
run: |
python -m pip install --quiet --disable-pip-version-check -r requirements.txt
CHECK_OUT="$(python check_version.py)"
LATEST_VERSION="$(echo "$CHECK_OUT" | cut -d, -f1)"
DO_PR="$(echo "$CHECK_OUT" | cut -d, -f2)"
echo "latest_version=${LATEST_VERSION}" >> $GITHUB_OUTPUT
echo "do_pr=${DO_PR}" >> $GITHUB_OUTPUT
- name: run update.sh
if: steps.check_version.outputs.do_pr == 'True'
run: ./update.sh ${{ steps.check_version.outputs.latest_version }}
- name: commit updated files
if: steps.check_version.outputs.do_pr == 'True'
uses: peter-evans/create-pull-request@d121e62763d8cc35b5fb1710e887d6e69a52d3a4
with:
branch: "update-${{ steps.check_version.outputs.latest_version }}"
commit-message: "Update to micromamba version ${{ steps.check_version.outputs.latest_version }}"
title: "Update to micromamba version ${{ steps.check_version.outputs.latest_version }}"
delete-branch: true