From 8efeeb4c49f245917ff19b0716195fc303f241d5 Mon Sep 17 00:00:00 2001 From: Nicholas Bollweg Date: Sun, 26 Feb 2023 15:39:58 -0600 Subject: [PATCH] some CI tweaks --- .github/workflows/badges.yml | 41 ++++++++++++++++++++++++++++++++++++ .github/workflows/pages.yml | 2 +- 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/badges.yml diff --git a/.github/workflows/badges.yml b/.github/workflows/badges.yml new file mode 100644 index 0000000..0e45c88 --- /dev/null +++ b/.github/workflows/badges.yml @@ -0,0 +1,41 @@ +name: Badges + +# TODO: restore +# on: +# pull_request_target: +# types: [opened] + +on: + push: + branches: + - main + pull_request: + branches: + - '*' + +permissions: + pull-requests: write + +jobs: + binder: + runs-on: ubuntu-latest + steps: + - name: Add Demo comment + uses: actions/github-script@v6 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const PR_NUMBER = context.issue.number + const { PR_HEAD_REF, PR_HEAD_USERREPO } = process.env; + + const LITE = `https://jupyterlite.rtfd.io/en/latest/_static/badge.svg`; + const BND = `https://mybinder.org/badge_logo.svg`; + const RTD = `https://jupyterlab-deck--${PR_NUMBER}.org.readthedocs.build/en/${PR_NUMBER}/_static/lab/index.html?path=README.ipynb`; + const BH = `https://mybinder.org/v2/gh/${PR_HEAD_USERREPO}/${PR_HEAD_REF}?urlpath=lab/tree/examples/README.ipynb`; + + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: `Try it on [![](${LITE})](${RTD}) :arrow_left: ReadTheDocs or Binder :arrow_right: [![](${BND})](${BH})` + }); diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 66d25d7..57467cf 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -1,4 +1,4 @@ -name: pages +name: Pages on: push: