Skip to content

WatchCondaForge

WatchCondaForge #13

# Check for new versions of pangeo-notebook metapackage on Conda Forge
name: WatchCondaForge
on:
workflow_dispatch:
schedule:
# Run once per day at midnight
- cron: "0 0 * * *"
jobs:
check-version:
runs-on: ubuntu-latest
if: github.repository == 'CNES/datalabs-docker-images'
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Get Latest pangeo-notebook Metapackage Version
id: latest_version
uses: jacobtomlinson/[email protected]
with:
org: "conda-forge"
package: "pangeo-notebook"
version_system: "CalVer"
- name: Find and Replace pangeo-notebook
id: find_replace
uses: jacobtomlinson/[email protected]
with:
include: "base-notebook/environment.yml"
find: "pangeo-notebook=.*"
replace: "pangeo-notebook=${{ steps.latest_version.outputs.version }}"
- name: Set Environment Variables
run: |
CALVER="$( date -u '+%Y.%m.%d' )"
PR_BRANCH="upgrade-pangeo-metapackage-${{ steps.latest_version.outputs.version }}"
echo "CALVER=${CALVER}" >> $GITHUB_ENV
echo "PR_BRANCH=${PR_BRANCH}" >> $GITHUB_ENV
- name: Check if PR Already Exists
id: check_branch
run: |
# https://github.com/actions/checkout#fetch-all-branches
git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
if git show-ref --quiet refs/remotes/origin/${{env.PR_BRANCH}}; then
RESULT=True
else
RESULT=False
fi
echo "exists=${RESULT}" >> $GITHUB_OUTPUT
# Skip following commands if PR already exists or pangeo-notebook version matches current master
- name: Create Pull Request
if: steps.check_branch.outputs.exists == 'False' && steps.find_replace.outputs.modifiedFiles > 0
id: cpr
uses: peter-evans/create-pull-request@v7
with:
committer: Datalabs Bot <[email protected]>
token: ${{ secrets.DATALABSBOT_TOKEN }}
commit-message: "Update pangeo-notebook metapackage version to ${{ steps.latest_version.outputs.version }}"
title: "Update pangeo-notebook metapackage version to ${{ steps.latest_version.outputs.version }}"
reviewers: "eroan.marie"
branch: ${{ env.PR_BRANCH }}
body: |
A new pangeo-metapackage version has been detected.
Updated `environment.yml`s to use `${{ steps.latest_version.outputs.version }}`.