Bump black from 22.1.0 to 24.3.0 #1089
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
name: Interactive PRs | |
on: | |
pull_request: | |
types: [labeled, synchronize] | |
jobs: | |
setup-interactive-pr: | |
name: Setup interactive PR | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check if this is a labelling event, and the 'interactive_review' label was added | |
if: ${{ github.event.action == 'labeled' && github.event.label.name == 'interactive_review' }} | |
id: checkLabelFromLabelling | |
shell: bash | |
run: echo "::set-output name=hasLabel::true" | |
- name: Check if this is a synchronise event and the 'interactive_review' label is present | |
uses: Dreamcodeio/pr-has-label-action@master | |
if: ${{ github.event.action != 'labeled' }} | |
id: checkLabelFromSync | |
with: | |
label: interactive_review | |
- name: Combine variables into a single output | |
if: ${{ steps.checkLabelFromLabelling.outputs.hasLabel || steps.checkLabelFromSync.outputs.hasLabel }} | |
shell: bash | |
id: checkLabel | |
run: echo "::set-output name=hasLabel::true" | |
- name: Calculate build finish time | |
id: buildFinish | |
if: ${{ steps.checkLabel.outputs.hasLabel }} | |
shell: bash | |
run: echo ::set-output name=finish_time::`TZ='Europe/London' date --date 'now + 5 minutes' +%H:%M` | |
- name: Find comment (in case one already exists) | |
if: ${{ steps.checkLabel.outputs.hasLabel }} | |
uses: peter-evans/find-comment@v1 | |
id: findComment | |
with: | |
issue-number: ${{github.event.number}} | |
body-includes: <!-- GH Actions Binder Comment --> | |
- name: Create comment (if it doesn't exist) | |
id: createComment | |
if: ${{ steps.checkLabel.outputs.hasLabel && (steps.findComment.outputs.comment-id == 0) }} | |
uses: peter-evans/create-or-update-comment@v1 | |
with: | |
issue-number: ${{github.event.number}} | |
body: | | |
<!-- GH Actions Binder Comment --> | |
Building interactive demo on Binder, due to complete at ${{ steps.buildFinish.outputs.finish_time }} UK time. | |
- name: Update comment (if it already exists) | |
if: ${{ steps.checkLabel.outputs.hasLabel && (steps.findComment.outputs.comment-id != 0) }} | |
uses: peter-evans/create-or-update-comment@v1 | |
with: | |
issue-number: ${{github.event.number}} | |
comment-id: ${{ steps.findComment.outputs.comment-id }} | |
edit-mode: replace | |
body: | | |
<!-- GH Actions Binder Comment --> | |
Building interactive demo on Binder, due to complete at ${{ steps.buildFinish.outputs.finish_time }} UK time. | |
- name: Trigger builds on Binder | |
uses: s-weigand/trigger-mybinder-build@v1 | |
if: ${{ steps.checkLabel.outputs.hasLabel }} | |
with: | |
target-repo: debrief/pepys-import | |
target-state: ${{ github.head_ref }} | |
- name: Wait for 5 minutes (to give time for all Binder instances to build) | |
if: ${{ steps.checkLabel.outputs.hasLabel }} | |
uses: jakejarvis/wait-action@master | |
with: | |
time: '5m' | |
# We can't just use the earlier output from findComment as we may have created a new comment | |
- name: Find comment from earlier | |
if: ${{ steps.checkLabel.outputs.hasLabel }} | |
uses: peter-evans/find-comment@v1 | |
id: findComment2 | |
with: | |
issue-number: ${{github.event.number}} | |
body-includes: <!-- GH Actions Binder Comment --> | |
- name: Update comment with link | |
if: ${{ steps.checkLabel.outputs.hasLabel }} | |
uses: peter-evans/create-or-update-comment@v1 | |
with: | |
issue-number: ${{github.event.number}} | |
comment-id: ${{ steps.findComment2.outputs.comment-id }} | |
edit-mode: replace | |
body: | | |
<!-- GH Actions Binder Comment --> | |
:rocket: Interactive demo available via Binder [![logo](https://mybinder.org/static/logo.svg)](https://mybinder.org/v2/gh/debrief/pepys-import/${{github.head_ref}}?filepath=demos/). | |
*Note:* The Jupyter notebook browser will open in the `demos` folder. See comments above for which notebook to use, | |
otherwise use the `_Default_Demo.ipynb` notebook. |