WatchCondaForge #12452
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
# 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 == 'pangeo-data/pangeo-docker-images' | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Get Latest pangeo-notebook Metapackage Version | |
id: latest_version | |
uses: jacobtomlinson/gha-anaconda-package-version@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@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 | |
- 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: 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 }}`. |