Skip to content

WatchCondaForge

WatchCondaForge #12964

# 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 * * *"
permissions: {}
jobs:
check-version:
runs-on: ubuntu-slim
if: github.repository == 'pangeo-data/pangeo-docker-images'
steps:
- name: Checkout Repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: true
- name: Get Latest pangeo-notebook Metapackage Version
id: latest_version
uses: jacobtomlinson/gha-anaconda-package-version@f5d2c85fa7353b97ce642c233499724caa82328d # 0.1.4
with:
org: "conda-forge"
package: "pangeo-notebook"
version_system: "CalVer"
- name: Find and Replace pangeo-notebook
id: find_replace
uses: jacobtomlinson/gha-find-replace@f1069b438f125e5395d84d1c6fd3b559a7880cb5 # 3.0.5
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
env:
STEPS_LATEST_VERSION_OUTPUTS_VERSION: ${{ steps.latest_version.outputs.version }}
- 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/${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@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0
with:
committer: Pangeo Bot <pangeo-bot@users.noreply.github.com>
token: ${{ secrets.PANGEOBOT_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: "scottyhq"
branch: ${{ env.PR_BRANCH }}
body: |
A new pangeo-metapackage version has been detected.
Updated `environment.yml`s to use `${{ steps.latest_version.outputs.version }}`.