Skip to content

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

Generate a PR if a newer version of micromamba is available

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

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@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Set up Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b
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@5e914681df9dc83aa4e4905692ca88beb2f9e91f
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