Skip to content

WatchCondaForge

WatchCondaForge #11940

# 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@v3
- 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: "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 "::set-output name=exists::${RESULT}"
# 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@v3
with:
committer: Pangeo Bot <[email protected]>
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 }}`.