Upgrade 2026: drop dead datasets, fix URLs, modernize to Python 3.12 #13
Workflow file for this run
This file contains hidden or 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
| --- | |
| name: Build and Cache Binder Image | |
| on: | |
| push: | |
| branches: | |
| - master | |
| - main | |
| - upgrade_2026 | |
| paths: | |
| - 'binder/**' | |
| - 'pyproject.toml' | |
| - 'environment.yml' | |
| - 'requirements.txt' | |
| pull_request: | |
| types: [opened, reopened, synchronize] | |
| paths: | |
| - 'binder/**' | |
| - 'pyproject.toml' | |
| - 'environment.yml' | |
| - 'requirements.txt' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| pull-requests: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and cache binder image | |
| uses: jupyterhub/repo2docker-action@master | |
| with: | |
| DOCKER_REGISTRY: ghcr.io | |
| IMAGE_NAME: ghcr.io/${{ github.repository }}/binder | |
| BINDER_CACHE: "true" | |
| - name: Comment on PR with Binder link | |
| if: github.event_name == 'pull_request' | |
| uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| const ref = '${{ github.event.pull_request.head.ref || github.ref_name }}'; | |
| const REPO = '${{ github.repository }}'; | |
| const OWNER = REPO.split('/')[0]; | |
| const REPO_NAME = REPO.split('/')[1]; | |
| const BADGE = '[]'; | |
| const BASE_URL = 'https://mybinder.org/v2/gh'; | |
| const LINK = `${BADGE}(${BASE_URL}/${OWNER}/${REPO_NAME}/${ref}`; | |
| const PARAMS = '?urlpath=lab%2Ftree%2Fnotebooks%2Fdemo.ipynb)'; | |
| const BODY = `🚀 **Binder is ready!** | |
| ${LINK}${PARAMS} | |
| Click the badge above to launch the notebook.`; | |
| const { data: comments } = await github.rest.issues.listComments({ | |
| owner: OWNER, | |
| repo: REPO_NAME, | |
| issue_number: context.issue.number | |
| }); | |
| const hasComment = comments.some(c => c.body.includes('Binder is ready')); | |
| if (hasComment) { | |
| await github.rest.issues.updateComment({ | |
| owner: OWNER, | |
| repo: REPO_NAME, | |
| comment_id: comments.find(c => c.body.includes('Binder is ready')).id, | |
| body: BODY | |
| }); | |
| } else { | |
| await github.rest.issues.createComment({ | |
| owner: OWNER, | |
| repo: REPO_NAME, | |
| issue_number: context.issue.number, | |
| body: BODY | |
| }); | |
| } |