From 91feb728efe023d306539d6d79f1b29da494e430 Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Thu, 7 Oct 2021 16:43:11 -0400 Subject: [PATCH 01/53] remove push trigger --- .github/workflows/binder-badge.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/binder-badge.yml b/.github/workflows/binder-badge.yml index db5382e42..d5b6f0ace 100644 --- a/.github/workflows/binder-badge.yml +++ b/.github/workflows/binder-badge.yml @@ -2,7 +2,6 @@ name: AddBinderBadge on: - push: pull_request_target: # since we're using nbgitpuller, only create the badge when PR opened types: [opened] From ef4c1eed4e7abb893ca6416100587138b9ec1580 Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Thu, 7 Oct 2021 16:46:55 -0400 Subject: [PATCH 02/53] add action button --- .github/workflows/binder-badge.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/binder-badge.yml b/.github/workflows/binder-badge.yml index d5b6f0ace..75b2c6e82 100644 --- a/.github/workflows/binder-badge.yml +++ b/.github/workflows/binder-badge.yml @@ -2,6 +2,7 @@ name: AddBinderBadge on: + workflow_dispatch: pull_request_target: # since we're using nbgitpuller, only create the badge when PR opened types: [opened] From 2fb44ebc1e97af4b9693439a41082484da855e2c Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Thu, 7 Oct 2021 16:50:02 -0400 Subject: [PATCH 03/53] add push trigger back to test --- .github/workflows/binder-badge.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/binder-badge.yml b/.github/workflows/binder-badge.yml index 75b2c6e82..117ef7e1f 100644 --- a/.github/workflows/binder-badge.yml +++ b/.github/workflows/binder-badge.yml @@ -2,6 +2,7 @@ name: AddBinderBadge on: + push: workflow_dispatch: pull_request_target: # since we're using nbgitpuller, only create the badge when PR opened From aa4e39728e4c7a285e33f91d2abc2d6a80820010 Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Thu, 7 Oct 2021 17:09:15 -0400 Subject: [PATCH 04/53] remove checkout action for security --- .github/workflows/binder-badge.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/binder-badge.yml b/.github/workflows/binder-badge.yml index 117ef7e1f..23c3ea3ef 100644 --- a/.github/workflows/binder-badge.yml +++ b/.github/workflows/binder-badge.yml @@ -13,9 +13,6 @@ jobs: add-badge: runs-on: ubuntu-20.04 steps: - - name: Checkout PR - uses: actions/checkout@v2 - - name: Comment on PR with Binder link uses: actions/github-script@v5 env: From 5bb6ffe34f071064629dd2a35a30995df9a39fc4 Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Thu, 7 Oct 2021 17:19:37 -0400 Subject: [PATCH 05/53] remove paths --- .github/workflows/binder-badge.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/binder-badge.yml b/.github/workflows/binder-badge.yml index 23c3ea3ef..b3f15bda4 100644 --- a/.github/workflows/binder-badge.yml +++ b/.github/workflows/binder-badge.yml @@ -7,8 +7,7 @@ on: pull_request_target: # since we're using nbgitpuller, only create the badge when PR opened types: [opened] - paths: - - 'examples/*' + jobs: add-badge: runs-on: ubuntu-20.04 From d040b8c0117d6f5cb8698324255e35d76dc6c9c8 Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Thu, 7 Oct 2021 17:21:22 -0400 Subject: [PATCH 06/53] add permission context --- .github/workflows/binder-badge.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/binder-badge.yml b/.github/workflows/binder-badge.yml index b3f15bda4..01f7c0bf0 100644 --- a/.github/workflows/binder-badge.yml +++ b/.github/workflows/binder-badge.yml @@ -10,7 +10,9 @@ on: jobs: add-badge: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest + permissions: + pull-requests: write steps: - name: Comment on PR with Binder link uses: actions/github-script@v5 From 7ea835a171078d64f5aa631a862e3e8c02e34615 Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Fri, 8 Oct 2021 13:22:18 -0400 Subject: [PATCH 07/53] updates from GitHub Community post --- .github/workflows/binder-badge.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/binder-badge.yml b/.github/workflows/binder-badge.yml index 01f7c0bf0..9a7a4a183 100644 --- a/.github/workflows/binder-badge.yml +++ b/.github/workflows/binder-badge.yml @@ -5,7 +5,6 @@ on: push: workflow_dispatch: pull_request_target: - # since we're using nbgitpuller, only create the badge when PR opened types: [opened] jobs: @@ -16,17 +15,12 @@ jobs: steps: - name: Comment on PR with Binder link uses: actions/github-script@v5 - env: - BRANCH_NAME: ${{ github.event.pull_request.head.ref }} - CONTENT_REPO: ${{github.event.pull_request.head.repo.full_name}} with: github-token: ${{secrets.GITHUB_TOKEN}} script: | - var BRANCH_NAME = process.env.BRANCH_NAME; - var CONTENT_REPO = process.env.CONTENT_REPO; github.rest.issues.createComment({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, - body: `[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/icesat2py/icepyx/main?urlpath=git-pull%3Frepo%3Dhttps%253A%252F%252Fgithub.com%252F${CONTENT_REPO}%26urlpath%3Dlab%252Ftree%252Ficepyx%252Fexamples%252F%26branch%3D${BRANCH_NAME}) :point_left: Launch a binder notebook on this branch` + body: `[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/icesat2py/icepyx/main?urlpath=git-pull%3Frepo%3Dhttps%253A%252F%252Fgithub.com%252F${$GITHUB_REPOSITORY}%26urlpath%3Dlab%252Ftree%252Ficepyx%252Fexamples%252F%26branch%3D${$GITHUB_HEAD_REF}) :point_left: Launch a binder notebook on this branch` }) \ No newline at end of file From 2e8e0bfa0e1813ea8270a14cc16d745cc14da75c Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Fri, 8 Oct 2021 13:28:51 -0400 Subject: [PATCH 08/53] create variables from the build in values --- .github/workflows/binder-badge.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/binder-badge.yml b/.github/workflows/binder-badge.yml index 9a7a4a183..58767ddd8 100644 --- a/.github/workflows/binder-badge.yml +++ b/.github/workflows/binder-badge.yml @@ -18,9 +18,11 @@ jobs: with: github-token: ${{secrets.GITHUB_TOKEN}} script: | + var GITHUB_HEAD_REF = $GITHUB_HEAD_REF; + var GITHUB_REPOSITORY = $GITHUB_REPOSITORY; github.rest.issues.createComment({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, - body: `[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/icesat2py/icepyx/main?urlpath=git-pull%3Frepo%3Dhttps%253A%252F%252Fgithub.com%252F${$GITHUB_REPOSITORY}%26urlpath%3Dlab%252Ftree%252Ficepyx%252Fexamples%252F%26branch%3D${$GITHUB_HEAD_REF}) :point_left: Launch a binder notebook on this branch` + body: `[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/icesat2py/icepyx/main?urlpath=git-pull%3Frepo%3Dhttps%253A%252F%252Fgithub.com%252F${GITHUB_REPOSITORY}%26urlpath%3Dlab%252Ftree%252Ficepyx%252Fexamples%252F%26branch%3D${GITHUB_HEAD_REF}) :point_left: Launch a binder notebook on this branch` }) \ No newline at end of file From 7c13f2ad783f26f37c1da1601032f73559cfaaae Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Fri, 8 Oct 2021 13:31:47 -0400 Subject: [PATCH 09/53] try updated mwe --- .github/workflows/binder-badge.yml | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/.github/workflows/binder-badge.yml b/.github/workflows/binder-badge.yml index 58767ddd8..383a9553e 100644 --- a/.github/workflows/binder-badge.yml +++ b/.github/workflows/binder-badge.yml @@ -1,6 +1,4 @@ -# From: https://github.com/uwhackweek/jupyterbook-template/.github/workflows/binder-badge.yml - -name: AddBinderBadge +name: Binder Badge on: push: workflow_dispatch: @@ -8,21 +6,14 @@ on: types: [opened] jobs: - add-badge: + binder: runs-on: ubuntu-latest - permissions: - pull-requests: write steps: - - name: Comment on PR with Binder link - uses: actions/github-script@v5 - with: - github-token: ${{secrets.GITHUB_TOKEN}} - script: | - var GITHUB_HEAD_REF = $GITHUB_HEAD_REF; - var GITHUB_REPOSITORY = $GITHUB_REPOSITORY; - github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: `[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/icesat2py/icepyx/main?urlpath=git-pull%3Frepo%3Dhttps%253A%252F%252Fgithub.com%252F${GITHUB_REPOSITORY}%26urlpath%3Dlab%252Ftree%252Ficepyx%252Fexamples%252F%26branch%3D${GITHUB_HEAD_REF}) :point_left: Launch a binder notebook on this branch` - }) \ No newline at end of file + - uses: actions/checkout@v2 + - name: print vars + run: | + echo $PR_HEAD_REF + echo $PR_HEAD_USERREPO + env: + PR_HEAD_REF: ${{ github.head_ref }} + PR_HEAD_USERREPO: ${{ github.repository }} \ No newline at end of file From cf8de599db187d0ee7ae71cf93dbac73ba7d4fd6 Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Fri, 8 Oct 2021 13:35:16 -0400 Subject: [PATCH 10/53] try using built in vars --- .github/workflows/binder-badge.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/binder-badge.yml b/.github/workflows/binder-badge.yml index 383a9553e..e819131a9 100644 --- a/.github/workflows/binder-badge.yml +++ b/.github/workflows/binder-badge.yml @@ -14,6 +14,8 @@ jobs: run: | echo $PR_HEAD_REF echo $PR_HEAD_USERREPO + echo $GITHUB_HEAD_REF + echo $GITHUB_REPOSITORY env: PR_HEAD_REF: ${{ github.head_ref }} PR_HEAD_USERREPO: ${{ github.repository }} \ No newline at end of file From 99d3e957384568d8e630620a45fe2f62e6b5b605 Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Fri, 8 Oct 2021 13:39:14 -0400 Subject: [PATCH 11/53] re-add checkout --- .github/workflows/binder-badge.yml | 34 +++++++++++++++++++----------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/.github/workflows/binder-badge.yml b/.github/workflows/binder-badge.yml index e819131a9..e84f69f73 100644 --- a/.github/workflows/binder-badge.yml +++ b/.github/workflows/binder-badge.yml @@ -1,4 +1,6 @@ -name: Binder Badge +# From: https://github.com/uwhackweek/jupyterbook-template/.github/workflows/binder-badge.yml + +name: AddBinderBadge on: push: workflow_dispatch: @@ -6,16 +8,24 @@ on: types: [opened] jobs: - binder: + add-badge: runs-on: ubuntu-latest + permissions: + pull-requests: write steps: - - uses: actions/checkout@v2 - - name: print vars - run: | - echo $PR_HEAD_REF - echo $PR_HEAD_USERREPO - echo $GITHUB_HEAD_REF - echo $GITHUB_REPOSITORY - env: - PR_HEAD_REF: ${{ github.head_ref }} - PR_HEAD_USERREPO: ${{ github.repository }} \ No newline at end of file + - name: Checkout PR + uses: actions/checkout@v2 + + - name: Comment on PR with Binder link + uses: actions/github-script@v5 + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + var GITHUB_HEAD_REF = $GITHUB_HEAD_REF; + var GITHUB_REPOSITORY = $GITHUB_REPOSITORY; + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: `[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/icesat2py/icepyx/main?urlpath=git-pull%3Frepo%3Dhttps%253A%252F%252Fgithub.com%252F${CONTENT_REPO}%26urlpath%3Dlab%252Ftree%252Ficepyx%252Fexamples%252F%26branch%3D${BRANCH_NAME}) :point_left: Launch a binder notebook on this branch` + }) \ No newline at end of file From 4a75d98a14cd819fc6ef3b37d1310796d9da9b9b Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Fri, 8 Oct 2021 13:43:42 -0400 Subject: [PATCH 12/53] try github ref --- .github/workflows/binder-badge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/binder-badge.yml b/.github/workflows/binder-badge.yml index e84f69f73..dd606b53c 100644 --- a/.github/workflows/binder-badge.yml +++ b/.github/workflows/binder-badge.yml @@ -21,7 +21,7 @@ jobs: with: github-token: ${{secrets.GITHUB_TOKEN}} script: | - var GITHUB_HEAD_REF = $GITHUB_HEAD_REF; + var GITHUB_REF = $GITHUB_REF; var GITHUB_REPOSITORY = $GITHUB_REPOSITORY; github.rest.issues.createComment({ issue_number: context.issue.number, From 8ee778fae2807e4f0ea709155f69579341208c69 Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Fri, 8 Oct 2021 13:45:16 -0400 Subject: [PATCH 13/53] remove branch checkout --- .github/workflows/binder-badge.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/binder-badge.yml b/.github/workflows/binder-badge.yml index dd606b53c..d77fbd2e9 100644 --- a/.github/workflows/binder-badge.yml +++ b/.github/workflows/binder-badge.yml @@ -12,10 +12,7 @@ jobs: runs-on: ubuntu-latest permissions: pull-requests: write - steps: - - name: Checkout PR - uses: actions/checkout@v2 - + steps: - name: Comment on PR with Binder link uses: actions/github-script@v5 with: From 23a3be287cff8fa088b43fc55430bbfda2334a68 Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Fri, 8 Oct 2021 13:46:38 -0400 Subject: [PATCH 14/53] try calling value a different way --- .github/workflows/binder-badge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/binder-badge.yml b/.github/workflows/binder-badge.yml index d77fbd2e9..5b674d930 100644 --- a/.github/workflows/binder-badge.yml +++ b/.github/workflows/binder-badge.yml @@ -18,7 +18,7 @@ jobs: with: github-token: ${{secrets.GITHUB_TOKEN}} script: | - var GITHUB_REF = $GITHUB_REF; + var GITHUB_REF = ${{ github.head_ref }}; var GITHUB_REPOSITORY = $GITHUB_REPOSITORY; github.rest.issues.createComment({ issue_number: context.issue.number, From ff324728331ce35c217fa9aa4628593261dade3b Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Fri, 8 Oct 2021 13:59:48 -0400 Subject: [PATCH 15/53] try base ref --- .github/workflows/binder-badge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/binder-badge.yml b/.github/workflows/binder-badge.yml index 5b674d930..e982cefcb 100644 --- a/.github/workflows/binder-badge.yml +++ b/.github/workflows/binder-badge.yml @@ -18,7 +18,7 @@ jobs: with: github-token: ${{secrets.GITHUB_TOKEN}} script: | - var GITHUB_REF = ${{ github.head_ref }}; + var GITHUB_REF = ${{ github.base_ref }}; var GITHUB_REPOSITORY = $GITHUB_REPOSITORY; github.rest.issues.createComment({ issue_number: context.issue.number, From 7bc9225863023dd3307886455b387e65a3640d32 Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Fri, 8 Oct 2021 14:19:43 -0400 Subject: [PATCH 16/53] try different syntax --- .github/workflows/binder-badge.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/binder-badge.yml b/.github/workflows/binder-badge.yml index e982cefcb..4758056c1 100644 --- a/.github/workflows/binder-badge.yml +++ b/.github/workflows/binder-badge.yml @@ -10,15 +10,16 @@ on: jobs: add-badge: runs-on: ubuntu-latest - permissions: - pull-requests: write - steps: + steps: + - name: Checkout PR + uses: actions/checkout@v2 + - name: Comment on PR with Binder link uses: actions/github-script@v5 with: github-token: ${{secrets.GITHUB_TOKEN}} script: | - var GITHUB_REF = ${{ github.base_ref }}; + var GITHUB_HEAD_REF = github.event.pull_request.head.ref; var GITHUB_REPOSITORY = $GITHUB_REPOSITORY; github.rest.issues.createComment({ issue_number: context.issue.number, From 38436aa63c88e78e3f69eca417f17e38d1bd6609 Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Fri, 8 Oct 2021 14:41:03 -0400 Subject: [PATCH 17/53] test a bunch of syntax --- .github/workflows/binder-badge.yml | 34 ++++++++++++++---------------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/.github/workflows/binder-badge.yml b/.github/workflows/binder-badge.yml index 4758056c1..ad4856795 100644 --- a/.github/workflows/binder-badge.yml +++ b/.github/workflows/binder-badge.yml @@ -1,6 +1,6 @@ # From: https://github.com/uwhackweek/jupyterbook-template/.github/workflows/binder-badge.yml -name: AddBinderBadge +name: Binder Badge on: push: workflow_dispatch: @@ -8,22 +8,20 @@ on: types: [opened] jobs: - add-badge: + binder: runs-on: ubuntu-latest steps: - - name: Checkout PR - uses: actions/checkout@v2 - - - name: Comment on PR with Binder link - uses: actions/github-script@v5 - with: - github-token: ${{secrets.GITHUB_TOKEN}} - script: | - var GITHUB_HEAD_REF = github.event.pull_request.head.ref; - var GITHUB_REPOSITORY = $GITHUB_REPOSITORY; - github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: `[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/icesat2py/icepyx/main?urlpath=git-pull%3Frepo%3Dhttps%253A%252F%252Fgithub.com%252F${CONTENT_REPO}%26urlpath%3Dlab%252Ftree%252Ficepyx%252Fexamples%252F%26branch%3D${BRANCH_NAME}) :point_left: Launch a binder notebook on this branch` - }) \ No newline at end of file + - uses: actions/checkout@v2 + - name: print vars + run: | + echo $PR_HEAD_REF + echo $PR_HEAD_USERREPO + echo $GITHUB_HEAD_REF + echo $GITHUB_REPOSITORY + echo ${{ github.base_ref}} + echo ${{ github.head_ref}} + echo ${{ github.ref}} + echo ${{ github.base_ref}} + env: + PR_HEAD_REF: ${{ github.head_ref }} + PR_HEAD_USERREPO: ${{ github.repository }} \ No newline at end of file From f43c8e9db3459cef79c3b941458a8a25bf3b3594 Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Fri, 8 Oct 2021 14:47:44 -0400 Subject: [PATCH 18/53] new list of vars --- .github/workflows/binder-badge.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/binder-badge.yml b/.github/workflows/binder-badge.yml index ad4856795..d0c2dc2cf 100644 --- a/.github/workflows/binder-badge.yml +++ b/.github/workflows/binder-badge.yml @@ -14,14 +14,10 @@ jobs: - uses: actions/checkout@v2 - name: print vars run: | - echo $PR_HEAD_REF - echo $PR_HEAD_USERREPO echo $GITHUB_HEAD_REF echo $GITHUB_REPOSITORY - echo ${{ github.base_ref}} + echo $GITHUB_REF + echo $GITHUB_BASE_REF echo ${{ github.head_ref}} echo ${{ github.ref}} - echo ${{ github.base_ref}} - env: - PR_HEAD_REF: ${{ github.head_ref }} - PR_HEAD_USERREPO: ${{ github.repository }} \ No newline at end of file + echo ${{ github.base_ref}} \ No newline at end of file From 0fd4c443c4eeca7374a38a1fa14a6581ceb94257 Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Fri, 8 Oct 2021 14:50:16 -0400 Subject: [PATCH 19/53] use github ref --- .github/workflows/binder-badge.yml | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/.github/workflows/binder-badge.yml b/.github/workflows/binder-badge.yml index d0c2dc2cf..bfd0c3737 100644 --- a/.github/workflows/binder-badge.yml +++ b/.github/workflows/binder-badge.yml @@ -1,6 +1,6 @@ # From: https://github.com/uwhackweek/jupyterbook-template/.github/workflows/binder-badge.yml -name: Binder Badge +name: AddBinderBadge on: push: workflow_dispatch: @@ -8,16 +8,22 @@ on: types: [opened] jobs: - binder: + add-badge: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: print vars - run: | - echo $GITHUB_HEAD_REF - echo $GITHUB_REPOSITORY - echo $GITHUB_REF - echo $GITHUB_BASE_REF - echo ${{ github.head_ref}} - echo ${{ github.ref}} - echo ${{ github.base_ref}} \ No newline at end of file + - name: Checkout PR + uses: actions/checkout@v2 + + - name: Comment on PR with Binder link + uses: actions/github-script@v5 + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + var GITHUB_REF = $GITHUB_REF; + var GITHUB_REPOSITORY = $GITHUB_REPOSITORY; + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: `[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/icesat2py/icepyx/main?urlpath=git-pull%3Frepo%3Dhttps%253A%252F%252Fgithub.com%252F${CONTENT_REPO}%26urlpath%3Dlab%252Ftree%252Ficepyx%252Fexamples%252F%26branch%3D${BRANCH_NAME}) :point_left: Launch a binder notebook on this branch` + }) \ No newline at end of file From f0f6b4fde6e8ff81165881c805183bd75c8eddfe Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Fri, 8 Oct 2021 14:53:29 -0400 Subject: [PATCH 20/53] combine mwe and binder --- .github/workflows/binder-badge.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/binder-badge.yml b/.github/workflows/binder-badge.yml index bfd0c3737..a90f571e8 100644 --- a/.github/workflows/binder-badge.yml +++ b/.github/workflows/binder-badge.yml @@ -13,6 +13,14 @@ jobs: steps: - name: Checkout PR uses: actions/checkout@v2 + run: | + echo $GITHUB_HEAD_REF + echo $GITHUB_REPOSITORY + echo $GITHUB_REF + echo $GITHUB_BASE_REF + echo ${{ github.head_ref}} + echo ${{ github.ref}} + echo ${{ github.base_ref}} - name: Comment on PR with Binder link uses: actions/github-script@v5 From c39a961ec3e4f4c98ba271a82aa4fbb84b0d933c Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Fri, 8 Oct 2021 14:55:04 -0400 Subject: [PATCH 21/53] separate uses and runs --- .github/workflows/binder-badge.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/binder-badge.yml b/.github/workflows/binder-badge.yml index a90f571e8..4299b29d4 100644 --- a/.github/workflows/binder-badge.yml +++ b/.github/workflows/binder-badge.yml @@ -13,6 +13,7 @@ jobs: steps: - name: Checkout PR uses: actions/checkout@v2 + - name: print vars run: | echo $GITHUB_HEAD_REF echo $GITHUB_REPOSITORY From 69866f15ddba1298d718242198a98f929b257d4b Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Fri, 8 Oct 2021 14:59:26 -0400 Subject: [PATCH 22/53] reintroduce env vars --- .github/workflows/binder-badge.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/binder-badge.yml b/.github/workflows/binder-badge.yml index 4299b29d4..6b83cf529 100644 --- a/.github/workflows/binder-badge.yml +++ b/.github/workflows/binder-badge.yml @@ -28,11 +28,14 @@ jobs: with: github-token: ${{secrets.GITHUB_TOKEN}} script: | - var GITHUB_REF = $GITHUB_REF; - var GITHUB_REPOSITORY = $GITHUB_REPOSITORY; + var BRANCH_NAME = process.env.BRANCH_NAME; + var CONTENT_REPO = process.env.CONTENT_REPO; github.rest.issues.createComment({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, body: `[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/icesat2py/icepyx/main?urlpath=git-pull%3Frepo%3Dhttps%253A%252F%252Fgithub.com%252F${CONTENT_REPO}%26urlpath%3Dlab%252Ftree%252Ficepyx%252Fexamples%252F%26branch%3D${BRANCH_NAME}) :point_left: Launch a binder notebook on this branch` - }) \ No newline at end of file + }) + env: + BRANCH_NAME: ${{ github.ref}} + CONTENT_REPO: ${{ github.repository }} \ No newline at end of file From 62ed411c4e762c4a36eb9903c85281b0f6f27bac Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Fri, 8 Oct 2021 15:01:32 -0400 Subject: [PATCH 23/53] fix indent --- .github/workflows/binder-badge.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/binder-badge.yml b/.github/workflows/binder-badge.yml index 6b83cf529..241e839bd 100644 --- a/.github/workflows/binder-badge.yml +++ b/.github/workflows/binder-badge.yml @@ -36,6 +36,6 @@ jobs: repo: context.repo.repo, body: `[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/icesat2py/icepyx/main?urlpath=git-pull%3Frepo%3Dhttps%253A%252F%252Fgithub.com%252F${CONTENT_REPO}%26urlpath%3Dlab%252Ftree%252Ficepyx%252Fexamples%252F%26branch%3D${BRANCH_NAME}) :point_left: Launch a binder notebook on this branch` }) - env: - BRANCH_NAME: ${{ github.ref}} - CONTENT_REPO: ${{ github.repository }} \ No newline at end of file + env: + BRANCH_NAME: ${{ github.ref }} + CONTENT_REPO: ${{ github.repository }} \ No newline at end of file From 375e3ec9fb0c23c2de08a1ed976ee714a34e1e7b Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Fri, 8 Oct 2021 15:10:39 -0400 Subject: [PATCH 24/53] echo more vars --- .github/workflows/binder-badge.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/binder-badge.yml b/.github/workflows/binder-badge.yml index 241e839bd..8514f167f 100644 --- a/.github/workflows/binder-badge.yml +++ b/.github/workflows/binder-badge.yml @@ -22,6 +22,11 @@ jobs: echo ${{ github.head_ref}} echo ${{ github.ref}} echo ${{ github.base_ref}} + echo ${{github.event.pull_request.head.ref}} + echo ${{github.event.pull_request.ref}} + echo ${{ github.event.pull_request.base.sha }} + echo ${{ github.event.pull_request.ref.sha }} + echo ${{ github.event.pull_request.ref.name }} - name: Comment on PR with Binder link uses: actions/github-script@v5 @@ -36,6 +41,7 @@ jobs: repo: context.repo.repo, body: `[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/icesat2py/icepyx/main?urlpath=git-pull%3Frepo%3Dhttps%253A%252F%252Fgithub.com%252F${CONTENT_REPO}%26urlpath%3Dlab%252Ftree%252Ficepyx%252Fexamples%252F%26branch%3D${BRANCH_NAME}) :point_left: Launch a binder notebook on this branch` }) + env: BRANCH_NAME: ${{ github.ref }} CONTENT_REPO: ${{ github.repository }} \ No newline at end of file From f25ee682c6f8faaafd91aff417575edd1efa879e Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Fri, 8 Oct 2021 16:01:24 -0400 Subject: [PATCH 25/53] try more vars --- .github/workflows/binder-badge.yml | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/.github/workflows/binder-badge.yml b/.github/workflows/binder-badge.yml index 8514f167f..ca9528766 100644 --- a/.github/workflows/binder-badge.yml +++ b/.github/workflows/binder-badge.yml @@ -15,23 +15,16 @@ jobs: uses: actions/checkout@v2 - name: print vars run: | - echo $GITHUB_HEAD_REF - echo $GITHUB_REPOSITORY - echo $GITHUB_REF - echo $GITHUB_BASE_REF echo ${{ github.head_ref}} echo ${{ github.ref}} echo ${{ github.base_ref}} - echo ${{github.event.pull_request.head.ref}} - echo ${{github.event.pull_request.ref}} - echo ${{ github.event.pull_request.base.sha }} - echo ${{ github.event.pull_request.ref.sha }} - echo ${{ github.event.pull_request.ref.name }} + echo ${{ github.ref.name}} - name: Comment on PR with Binder link uses: actions/github-script@v5 with: github-token: ${{secrets.GITHUB_TOKEN}} + # NOTE: setting the vars for the script (by getting them from the env) makes it cleaner and easier to use them in the url script: | var BRANCH_NAME = process.env.BRANCH_NAME; var CONTENT_REPO = process.env.CONTENT_REPO; @@ -41,7 +34,7 @@ jobs: repo: context.repo.repo, body: `[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/icesat2py/icepyx/main?urlpath=git-pull%3Frepo%3Dhttps%253A%252F%252Fgithub.com%252F${CONTENT_REPO}%26urlpath%3Dlab%252Ftree%252Ficepyx%252Fexamples%252F%26branch%3D${BRANCH_NAME}) :point_left: Launch a binder notebook on this branch` }) - + # NOTE: Setting the vars as env vars is required to make them available within the Comment on PR step env: BRANCH_NAME: ${{ github.ref }} CONTENT_REPO: ${{ github.repository }} \ No newline at end of file From 0df20291167e8840f7ab2c744a3e76b82e41f4d1 Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Mon, 11 Oct 2021 12:45:08 -0400 Subject: [PATCH 26/53] try to extract branch name --- .github/workflows/binder-badge.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/binder-badge.yml b/.github/workflows/binder-badge.yml index ca9528766..31e1b9728 100644 --- a/.github/workflows/binder-badge.yml +++ b/.github/workflows/binder-badge.yml @@ -18,7 +18,7 @@ jobs: echo ${{ github.head_ref}} echo ${{ github.ref}} echo ${{ github.base_ref}} - echo ${{ github.ref.name}} + echo ${GITHUB_REF#refs/heads/} - name: Comment on PR with Binder link uses: actions/github-script@v5 @@ -36,5 +36,5 @@ jobs: }) # NOTE: Setting the vars as env vars is required to make them available within the Comment on PR step env: - BRANCH_NAME: ${{ github.ref }} + BRANCH_NAME: ${{ github.ref#refs/heads/ }} CONTENT_REPO: ${{ github.repository }} \ No newline at end of file From 156767cd0c179b2e568a31a51e423e3b1573f854 Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Mon, 11 Oct 2021 12:49:01 -0400 Subject: [PATCH 27/53] try to export as env var --- .github/workflows/binder-badge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/binder-badge.yml b/.github/workflows/binder-badge.yml index 31e1b9728..1d67cf092 100644 --- a/.github/workflows/binder-badge.yml +++ b/.github/workflows/binder-badge.yml @@ -36,5 +36,5 @@ jobs: }) # NOTE: Setting the vars as env vars is required to make them available within the Comment on PR step env: - BRANCH_NAME: ${{ github.ref#refs/heads/ }} + BRANCH_NAME: $(echo ${GITHUB_REF#refs/heads/}) CONTENT_REPO: ${{ github.repository }} \ No newline at end of file From 484efd07dd89513d5ae07cbd4247d8365d586957 Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Mon, 11 Oct 2021 14:49:22 -0400 Subject: [PATCH 28/53] try setting as env var --- .github/workflows/binder-badge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/binder-badge.yml b/.github/workflows/binder-badge.yml index 1d67cf092..7198407fe 100644 --- a/.github/workflows/binder-badge.yml +++ b/.github/workflows/binder-badge.yml @@ -36,5 +36,5 @@ jobs: }) # NOTE: Setting the vars as env vars is required to make them available within the Comment on PR step env: - BRANCH_NAME: $(echo ${GITHUB_REF#refs/heads/}) + BRANCH_NAME: ${{echo ${GITHUB_REF#refs/heads/}}} CONTENT_REPO: ${{ github.repository }} \ No newline at end of file From f01f6aef73afd38c512491ffc11ff0ac2809a6a7 Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Mon, 11 Oct 2021 14:51:14 -0400 Subject: [PATCH 29/53] try setting as env var --- .github/workflows/binder-badge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/binder-badge.yml b/.github/workflows/binder-badge.yml index 7198407fe..e7bea121f 100644 --- a/.github/workflows/binder-badge.yml +++ b/.github/workflows/binder-badge.yml @@ -36,5 +36,5 @@ jobs: }) # NOTE: Setting the vars as env vars is required to make them available within the Comment on PR step env: - BRANCH_NAME: ${{echo ${GITHUB_REF#refs/heads/}}} + BRANCH_NAME: echo ${GITHUB_REF#refs/heads/} CONTENT_REPO: ${{ github.repository }} \ No newline at end of file From 8e9f5ee6aeb9e295092feee9c4d89a5edf0a2720 Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Mon, 11 Oct 2021 14:54:02 -0400 Subject: [PATCH 30/53] pass whole ref into env --- .github/workflows/binder-badge.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/binder-badge.yml b/.github/workflows/binder-badge.yml index e7bea121f..006d09b52 100644 --- a/.github/workflows/binder-badge.yml +++ b/.github/workflows/binder-badge.yml @@ -26,7 +26,7 @@ jobs: github-token: ${{secrets.GITHUB_TOKEN}} # NOTE: setting the vars for the script (by getting them from the env) makes it cleaner and easier to use them in the url script: | - var BRANCH_NAME = process.env.BRANCH_NAME; + var BRANCH_NAME = ${process.env.GITHUB_REF#refs/heads}; var CONTENT_REPO = process.env.CONTENT_REPO; github.rest.issues.createComment({ issue_number: context.issue.number, @@ -36,5 +36,5 @@ jobs: }) # NOTE: Setting the vars as env vars is required to make them available within the Comment on PR step env: - BRANCH_NAME: echo ${GITHUB_REF#refs/heads/} + GITHUB_REF: ${{ github.ref }} CONTENT_REPO: ${{ github.repository }} \ No newline at end of file From 8f91e38a41e0bfddea1a6953b95d66603bc748a0 Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Mon, 11 Oct 2021 14:56:23 -0400 Subject: [PATCH 31/53] echo line in var declaration --- .github/workflows/binder-badge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/binder-badge.yml b/.github/workflows/binder-badge.yml index 006d09b52..feb46e354 100644 --- a/.github/workflows/binder-badge.yml +++ b/.github/workflows/binder-badge.yml @@ -26,7 +26,7 @@ jobs: github-token: ${{secrets.GITHUB_TOKEN}} # NOTE: setting the vars for the script (by getting them from the env) makes it cleaner and easier to use them in the url script: | - var BRANCH_NAME = ${process.env.GITHUB_REF#refs/heads}; + var BRANCH_NAME = echo ${process.env.GITHUB_REF#refs/heads}; var CONTENT_REPO = process.env.CONTENT_REPO; github.rest.issues.createComment({ issue_number: context.issue.number, From 8e8d03c9f1bceb753e52c0cad96d9204c5f8b880 Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Mon, 11 Oct 2021 15:07:23 -0400 Subject: [PATCH 32/53] try exporting var earlier in workflow --- .github/workflows/binder-badge.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/binder-badge.yml b/.github/workflows/binder-badge.yml index feb46e354..56dbc92fb 100644 --- a/.github/workflows/binder-badge.yml +++ b/.github/workflows/binder-badge.yml @@ -19,6 +19,10 @@ jobs: echo ${{ github.ref}} echo ${{ github.base_ref}} echo ${GITHUB_REF#refs/heads/} + - name: get branch name + run: | + echo ${GITHUB_REF#refs/heads/} + export GIT_BRANCH=$(echo ${GITHUB_REF#refs/heads/}) - name: Comment on PR with Binder link uses: actions/github-script@v5 @@ -26,7 +30,7 @@ jobs: github-token: ${{secrets.GITHUB_TOKEN}} # NOTE: setting the vars for the script (by getting them from the env) makes it cleaner and easier to use them in the url script: | - var BRANCH_NAME = echo ${process.env.GITHUB_REF#refs/heads}; + var BRANCH_NAME = process.env.BRANCH_NAME; var CONTENT_REPO = process.env.CONTENT_REPO; github.rest.issues.createComment({ issue_number: context.issue.number, @@ -36,5 +40,5 @@ jobs: }) # NOTE: Setting the vars as env vars is required to make them available within the Comment on PR step env: - GITHUB_REF: ${{ github.ref }} + BRANCH_NAME: ${process.env.GIT_BRANCH} CONTENT_REPO: ${{ github.repository }} \ No newline at end of file From a211a355c875e8411fc6bb870e02d0ce4137b954 Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Mon, 11 Oct 2021 15:08:58 -0400 Subject: [PATCH 33/53] fix ref --- .github/workflows/binder-badge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/binder-badge.yml b/.github/workflows/binder-badge.yml index 56dbc92fb..cb6334e12 100644 --- a/.github/workflows/binder-badge.yml +++ b/.github/workflows/binder-badge.yml @@ -40,5 +40,5 @@ jobs: }) # NOTE: Setting the vars as env vars is required to make them available within the Comment on PR step env: - BRANCH_NAME: ${process.env.GIT_BRANCH} + BRANCH_NAME: ${{ $GIT_BRANCH}} CONTENT_REPO: ${{ github.repository }} \ No newline at end of file From d3298042b0208d7a5d313b8b6397a45e31c96503 Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Mon, 11 Oct 2021 15:09:55 -0400 Subject: [PATCH 34/53] fix ref --- .github/workflows/binder-badge.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/binder-badge.yml b/.github/workflows/binder-badge.yml index cb6334e12..8c489f8aa 100644 --- a/.github/workflows/binder-badge.yml +++ b/.github/workflows/binder-badge.yml @@ -30,7 +30,7 @@ jobs: github-token: ${{secrets.GITHUB_TOKEN}} # NOTE: setting the vars for the script (by getting them from the env) makes it cleaner and easier to use them in the url script: | - var BRANCH_NAME = process.env.BRANCH_NAME; + var BRANCH_NAME = process.env.GIT_BRANCH; var CONTENT_REPO = process.env.CONTENT_REPO; github.rest.issues.createComment({ issue_number: context.issue.number, @@ -40,5 +40,5 @@ jobs: }) # NOTE: Setting the vars as env vars is required to make them available within the Comment on PR step env: - BRANCH_NAME: ${{ $GIT_BRANCH}} + BRANCH_NAME: $GIT_BRANCH CONTENT_REPO: ${{ github.repository }} \ No newline at end of file From bb9a43c6c3f72c575fe9d96e7a8375fcfc21b827 Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Mon, 11 Oct 2021 15:11:01 -0400 Subject: [PATCH 35/53] rem env var --- .github/workflows/binder-badge.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/binder-badge.yml b/.github/workflows/binder-badge.yml index 8c489f8aa..ec74ab3e1 100644 --- a/.github/workflows/binder-badge.yml +++ b/.github/workflows/binder-badge.yml @@ -40,5 +40,4 @@ jobs: }) # NOTE: Setting the vars as env vars is required to make them available within the Comment on PR step env: - BRANCH_NAME: $GIT_BRANCH CONTENT_REPO: ${{ github.repository }} \ No newline at end of file From 658be5c0e98201a7edae709df3fd91ff3777c9f1 Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Mon, 11 Oct 2021 15:13:51 -0400 Subject: [PATCH 36/53] echo branch name var --- .github/workflows/binder-badge.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/binder-badge.yml b/.github/workflows/binder-badge.yml index ec74ab3e1..8766f6b78 100644 --- a/.github/workflows/binder-badge.yml +++ b/.github/workflows/binder-badge.yml @@ -23,6 +23,7 @@ jobs: run: | echo ${GITHUB_REF#refs/heads/} export GIT_BRANCH=$(echo ${GITHUB_REF#refs/heads/}) + echo $GIT_BRANCH - name: Comment on PR with Binder link uses: actions/github-script@v5 @@ -30,7 +31,7 @@ jobs: github-token: ${{secrets.GITHUB_TOKEN}} # NOTE: setting the vars for the script (by getting them from the env) makes it cleaner and easier to use them in the url script: | - var BRANCH_NAME = process.env.GIT_BRANCH; + var BRANCH_NAME = process.env.BRANCH_NAME; var CONTENT_REPO = process.env.CONTENT_REPO; github.rest.issues.createComment({ issue_number: context.issue.number, @@ -40,4 +41,5 @@ jobs: }) # NOTE: Setting the vars as env vars is required to make them available within the Comment on PR step env: + BRANCH_NAME: ${{ GIT_BRANCH }} CONTENT_REPO: ${{ github.repository }} \ No newline at end of file From 06ebc08f290771a9545e7f8739bebc41377d4b00 Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Mon, 11 Oct 2021 15:14:57 -0400 Subject: [PATCH 37/53] echo branch name var --- .github/workflows/binder-badge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/binder-badge.yml b/.github/workflows/binder-badge.yml index 8766f6b78..001a51934 100644 --- a/.github/workflows/binder-badge.yml +++ b/.github/workflows/binder-badge.yml @@ -41,5 +41,5 @@ jobs: }) # NOTE: Setting the vars as env vars is required to make them available within the Comment on PR step env: - BRANCH_NAME: ${{ GIT_BRANCH }} + BRANCH_NAME: ${{ process.env.GIT_BRANCH }} CONTENT_REPO: ${{ github.repository }} \ No newline at end of file From b6b62ea052560b3b71fa31f62bd8ee3ee80e06fb Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Mon, 11 Oct 2021 15:24:56 -0400 Subject: [PATCH 38/53] try to access via env --- .github/workflows/binder-badge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/binder-badge.yml b/.github/workflows/binder-badge.yml index 001a51934..2e0e1bb3e 100644 --- a/.github/workflows/binder-badge.yml +++ b/.github/workflows/binder-badge.yml @@ -41,5 +41,5 @@ jobs: }) # NOTE: Setting the vars as env vars is required to make them available within the Comment on PR step env: - BRANCH_NAME: ${{ process.env.GIT_BRANCH }} + BRANCH_NAME: ${{ env.GIT_BRANCH }} CONTENT_REPO: ${{ github.repository }} \ No newline at end of file From d40752b50ed104382153653345e8969ebab90b70 Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Mon, 11 Oct 2021 15:28:33 -0400 Subject: [PATCH 39/53] try to get it to eval --- .github/workflows/binder-badge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/binder-badge.yml b/.github/workflows/binder-badge.yml index 2e0e1bb3e..b46cdecca 100644 --- a/.github/workflows/binder-badge.yml +++ b/.github/workflows/binder-badge.yml @@ -41,5 +41,5 @@ jobs: }) # NOTE: Setting the vars as env vars is required to make them available within the Comment on PR step env: - BRANCH_NAME: ${{ env.GIT_BRANCH }} + BRANCH_NAME: '$(echo ${GITHUB_REF#refs/heads/})' CONTENT_REPO: ${{ github.repository }} \ No newline at end of file From d8b747e26c5999d2577b5ad272158df3e7867b53 Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Mon, 11 Oct 2021 15:32:52 -0400 Subject: [PATCH 40/53] try another way --- .github/workflows/binder-badge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/binder-badge.yml b/.github/workflows/binder-badge.yml index b46cdecca..45de4ee90 100644 --- a/.github/workflows/binder-badge.yml +++ b/.github/workflows/binder-badge.yml @@ -41,5 +41,5 @@ jobs: }) # NOTE: Setting the vars as env vars is required to make them available within the Comment on PR step env: - BRANCH_NAME: '$(echo ${GITHUB_REF#refs/heads/})' + BRANCH_NAME: $ {{ context.ref#refs/heads}} CONTENT_REPO: ${{ github.repository }} \ No newline at end of file From 2f318dd5b0491f6b2d46714907393d9eb49529cf Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Mon, 11 Oct 2021 15:34:26 -0400 Subject: [PATCH 41/53] try removing rest of path outside env var getting --- .github/workflows/binder-badge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/binder-badge.yml b/.github/workflows/binder-badge.yml index 45de4ee90..5cdfe61c9 100644 --- a/.github/workflows/binder-badge.yml +++ b/.github/workflows/binder-badge.yml @@ -41,5 +41,5 @@ jobs: }) # NOTE: Setting the vars as env vars is required to make them available within the Comment on PR step env: - BRANCH_NAME: $ {{ context.ref#refs/heads}} + BRANCH_NAME: ${{ context.ref}}#refs/heads CONTENT_REPO: ${{ github.repository }} \ No newline at end of file From ea32181210842012c556c9593788fb7f600976e8 Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Mon, 11 Oct 2021 15:35:17 -0400 Subject: [PATCH 42/53] context invalid --- .github/workflows/binder-badge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/binder-badge.yml b/.github/workflows/binder-badge.yml index 5cdfe61c9..386a0c6ea 100644 --- a/.github/workflows/binder-badge.yml +++ b/.github/workflows/binder-badge.yml @@ -41,5 +41,5 @@ jobs: }) # NOTE: Setting the vars as env vars is required to make them available within the Comment on PR step env: - BRANCH_NAME: ${{ context.ref}}#refs/heads + BRANCH_NAME: ${{ github.ref }}#refs/heads CONTENT_REPO: ${{ github.repository }} \ No newline at end of file From 98bfe73fbe262c6e2e700c562974c9dd67021c6d Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Mon, 11 Oct 2021 15:38:11 -0400 Subject: [PATCH 43/53] print out context for ref --- .github/workflows/binder-badge.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/binder-badge.yml b/.github/workflows/binder-badge.yml index 386a0c6ea..bebc84380 100644 --- a/.github/workflows/binder-badge.yml +++ b/.github/workflows/binder-badge.yml @@ -31,6 +31,7 @@ jobs: github-token: ${{secrets.GITHUB_TOKEN}} # NOTE: setting the vars for the script (by getting them from the env) makes it cleaner and easier to use them in the url script: | + console.log(context) var BRANCH_NAME = process.env.BRANCH_NAME; var CONTENT_REPO = process.env.CONTENT_REPO; github.rest.issues.createComment({ From 69866000ea0995602cd0edccc1b6ad805af09503 Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Mon, 11 Oct 2021 15:42:52 -0400 Subject: [PATCH 44/53] try using js to get branch name --- .github/workflows/binder-badge.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/binder-badge.yml b/.github/workflows/binder-badge.yml index bebc84380..4c3448196 100644 --- a/.github/workflows/binder-badge.yml +++ b/.github/workflows/binder-badge.yml @@ -32,7 +32,7 @@ jobs: # NOTE: setting the vars for the script (by getting them from the env) makes it cleaner and easier to use them in the url script: | console.log(context) - var BRANCH_NAME = process.env.BRANCH_NAME; + var BRANCH_NAME = `${GITHUB_REF.replace("refs/heads", "")}`; var CONTENT_REPO = process.env.CONTENT_REPO; github.rest.issues.createComment({ issue_number: context.issue.number, @@ -42,5 +42,5 @@ jobs: }) # NOTE: Setting the vars as env vars is required to make them available within the Comment on PR step env: - BRANCH_NAME: ${{ github.ref }}#refs/heads + GITHUB_REF: ${{ github.ref }} CONTENT_REPO: ${{ github.repository }} \ No newline at end of file From e45bb2a7a302236248ba17722e9ac040d6ef9a25 Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Mon, 11 Oct 2021 15:44:46 -0400 Subject: [PATCH 45/53] fix var calling --- .github/workflows/binder-badge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/binder-badge.yml b/.github/workflows/binder-badge.yml index 4c3448196..160be887d 100644 --- a/.github/workflows/binder-badge.yml +++ b/.github/workflows/binder-badge.yml @@ -32,7 +32,7 @@ jobs: # NOTE: setting the vars for the script (by getting them from the env) makes it cleaner and easier to use them in the url script: | console.log(context) - var BRANCH_NAME = `${GITHUB_REF.replace("refs/heads", "")}`; + var BRANCH_NAME = process.env.GITHUB_REF.replace("refs/heads", ""); var CONTENT_REPO = process.env.CONTENT_REPO; github.rest.issues.createComment({ issue_number: context.issue.number, From 569bf53f585fdacfcbd8efaa0fa4a3e4fe8fab0f Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Mon, 11 Oct 2021 16:45:53 -0400 Subject: [PATCH 46/53] comment out unneeded steps --- .github/workflows/binder-badge.yml | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/.github/workflows/binder-badge.yml b/.github/workflows/binder-badge.yml index 160be887d..1444b89e0 100644 --- a/.github/workflows/binder-badge.yml +++ b/.github/workflows/binder-badge.yml @@ -3,7 +3,6 @@ name: AddBinderBadge on: push: - workflow_dispatch: pull_request_target: types: [opened] @@ -11,19 +10,19 @@ jobs: add-badge: runs-on: ubuntu-latest steps: - - name: Checkout PR - uses: actions/checkout@v2 - - name: print vars - run: | - echo ${{ github.head_ref}} - echo ${{ github.ref}} - echo ${{ github.base_ref}} - echo ${GITHUB_REF#refs/heads/} - - name: get branch name - run: | - echo ${GITHUB_REF#refs/heads/} - export GIT_BRANCH=$(echo ${GITHUB_REF#refs/heads/}) - echo $GIT_BRANCH + # - name: Checkout PR + # uses: actions/checkout@v2 + # - name: print vars + # run: | + # echo ${{ github.head_ref}} + # echo ${{ github.ref}} + # echo ${{ github.base_ref}} + # echo ${GITHUB_REF#refs/heads/} + # - name: get branch name + # run: | + # echo ${GITHUB_REF#refs/heads/} + # export GIT_BRANCH=$(echo ${GITHUB_REF#refs/heads/}) + # echo $GIT_BRANCH - name: Comment on PR with Binder link uses: actions/github-script@v5 From 3450d6e9a254c7b3e428ffe3f8f41c19df01a9ba Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Mon, 11 Oct 2021 20:21:27 -0400 Subject: [PATCH 47/53] fix binder link --- .github/workflows/binder-badge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/binder-badge.yml b/.github/workflows/binder-badge.yml index 1444b89e0..1ec42a38a 100644 --- a/.github/workflows/binder-badge.yml +++ b/.github/workflows/binder-badge.yml @@ -37,7 +37,7 @@ jobs: issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, - body: `[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/icesat2py/icepyx/main?urlpath=git-pull%3Frepo%3Dhttps%253A%252F%252Fgithub.com%252F${CONTENT_REPO}%26urlpath%3Dlab%252Ftree%252Ficepyx%252Fexamples%252F%26branch%3D${BRANCH_NAME}) :point_left: Launch a binder notebook on this branch` + body: `[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/${CONTENT_REPO}/${BRANCH_NAME}?labpath=examples) :point_left: Launch a binder notebook on this branch` }) # NOTE: Setting the vars as env vars is required to make them available within the Comment on PR step env: From dbbfac89af4726608f1403c38cf2617fbfa4db5e Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Mon, 11 Oct 2021 20:25:40 -0400 Subject: [PATCH 48/53] fix binder link extra / --- .github/workflows/binder-badge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/binder-badge.yml b/.github/workflows/binder-badge.yml index 1ec42a38a..65da95792 100644 --- a/.github/workflows/binder-badge.yml +++ b/.github/workflows/binder-badge.yml @@ -37,7 +37,7 @@ jobs: issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, - body: `[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/${CONTENT_REPO}/${BRANCH_NAME}?labpath=examples) :point_left: Launch a binder notebook on this branch` + body: `[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/${CONTENT_REPO}${BRANCH_NAME}?labpath=examples) :point_left: Launch a binder notebook on this branch` }) # NOTE: Setting the vars as env vars is required to make them available within the Comment on PR step env: From 543d9517459d3567b4bc3385acc32f53d9cd15fd Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Mon, 11 Oct 2021 21:09:14 -0400 Subject: [PATCH 49/53] try alternate way to get issue number from second binder example --- .github/workflows/binder-badge.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/binder-badge.yml b/.github/workflows/binder-badge.yml index 65da95792..19664862a 100644 --- a/.github/workflows/binder-badge.yml +++ b/.github/workflows/binder-badge.yml @@ -28,16 +28,15 @@ jobs: uses: actions/github-script@v5 with: github-token: ${{secrets.GITHUB_TOKEN}} - # NOTE: setting the vars for the script (by getting them from the env) makes it cleaner and easier to use them in the url script: | console.log(context) var BRANCH_NAME = process.env.GITHUB_REF.replace("refs/heads", ""); var CONTENT_REPO = process.env.CONTENT_REPO; github.rest.issues.createComment({ - issue_number: context.issue.number, + issue_number: context.payload.issue.number, owner: context.repo.owner, repo: context.repo.repo, - body: `[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/${CONTENT_REPO}${BRANCH_NAME}?labpath=examples) :point_left: Launch a binder notebook on this branch` + body: `[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/${CONTENT_REPO}/${BRANCH_NAME}?labpath=examples) :point_left: Launch a binder notebook on this branch` }) # NOTE: Setting the vars as env vars is required to make them available within the Comment on PR step env: From 5edae542789eaf10ca81ab469ec82b6b8e329ad2 Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Tue, 12 Oct 2021 13:53:40 -0400 Subject: [PATCH 50/53] try binder-badge action directly --- .github/workflows/binder-badge.yml | 85 +++++++++++++++++------------- 1 file changed, 49 insertions(+), 36 deletions(-) diff --git a/.github/workflows/binder-badge.yml b/.github/workflows/binder-badge.yml index 19664862a..db81d2ac4 100644 --- a/.github/workflows/binder-badge.yml +++ b/.github/workflows/binder-badge.yml @@ -1,44 +1,57 @@ -# From: https://github.com/uwhackweek/jupyterbook-template/.github/workflows/binder-badge.yml - -name: AddBinderBadge +name: binder-badge on: push: pull_request_target: - types: [opened] jobs: - add-badge: + badge: runs-on: ubuntu-latest steps: - # - name: Checkout PR - # uses: actions/checkout@v2 - # - name: print vars - # run: | - # echo ${{ github.head_ref}} - # echo ${{ github.ref}} - # echo ${{ github.base_ref}} - # echo ${GITHUB_REF#refs/heads/} - # - name: get branch name - # run: | - # echo ${GITHUB_REF#refs/heads/} - # export GIT_BRANCH=$(echo ${GITHUB_REF#refs/heads/}) - # echo $GIT_BRANCH + - uses: manics/action-binderbadge@main + with: + githubToken: ${{ secrets.GITHUB_TOKEN }} + +# From: https://github.com/uwhackweek/jupyterbook-template/.github/workflows/binder-badge.yml + +# name: AddBinderBadge +# on: +# push: +# pull_request_target: +# types: [opened] + +# jobs: +# add-badge: +# runs-on: ubuntu-latest +# steps: +# # - name: Checkout PR +# # uses: actions/checkout@v2 +# # - name: print vars +# # run: | +# # echo ${{ github.head_ref}} +# # echo ${{ github.ref}} +# # echo ${{ github.base_ref}} +# # echo ${GITHUB_REF#refs/heads/} +# # - name: get branch name +# # run: | +# # echo ${GITHUB_REF#refs/heads/} +# # export GIT_BRANCH=$(echo ${GITHUB_REF#refs/heads/}) +# # echo $GIT_BRANCH - - name: Comment on PR with Binder link - uses: actions/github-script@v5 - with: - github-token: ${{secrets.GITHUB_TOKEN}} - script: | - console.log(context) - var BRANCH_NAME = process.env.GITHUB_REF.replace("refs/heads", ""); - var CONTENT_REPO = process.env.CONTENT_REPO; - github.rest.issues.createComment({ - issue_number: context.payload.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: `[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/${CONTENT_REPO}/${BRANCH_NAME}?labpath=examples) :point_left: Launch a binder notebook on this branch` - }) - # NOTE: Setting the vars as env vars is required to make them available within the Comment on PR step - env: - GITHUB_REF: ${{ github.ref }} - CONTENT_REPO: ${{ github.repository }} \ No newline at end of file +# - name: Comment on PR with Binder link +# uses: actions/github-script@v5 +# with: +# github-token: ${{secrets.GITHUB_TOKEN}} +# script: | +# console.log(context) +# var BRANCH_NAME = process.env.GITHUB_REF.replace("refs/heads", ""); +# var CONTENT_REPO = process.env.CONTENT_REPO; +# github.rest.issues.createComment({ +# issue_number: context.issue.number, +# owner: context.repo.owner, +# repo: context.repo.repo, +# body: `[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/${CONTENT_REPO}/${BRANCH_NAME}?labpath=examples) :point_left: Launch a binder notebook on this branch` +# }) +# # NOTE: Setting the vars as env vars is required to make them available within the Comment on PR step +# env: +# GITHUB_REF: ${{ github.ref }} +# CONTENT_REPO: ${{ github.repository }} \ No newline at end of file From f3262d82bf62fb62d3c8cd495b31f1c489b88e71 Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Tue, 12 Oct 2021 13:54:51 -0400 Subject: [PATCH 51/53] try binder-badge action directly --- .github/workflows/binder-badge.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/binder-badge.yml b/.github/workflows/binder-badge.yml index db81d2ac4..5bbf0777c 100644 --- a/.github/workflows/binder-badge.yml +++ b/.github/workflows/binder-badge.yml @@ -1,6 +1,5 @@ name: binder-badge on: - push: pull_request_target: jobs: From 2d923575a0768055b34ee0727db479b3b7920a92 Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Tue, 12 Oct 2021 14:03:33 -0400 Subject: [PATCH 52/53] try using orig name to test --- .github/workflows/binder-badge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/binder-badge.yml b/.github/workflows/binder-badge.yml index 5bbf0777c..2683cd79c 100644 --- a/.github/workflows/binder-badge.yml +++ b/.github/workflows/binder-badge.yml @@ -1,4 +1,4 @@ -name: binder-badge +name: AddBinderBadge on: pull_request_target: From 5ddd01bc6db5b157f0b1f5d930e99b7e7d78ba49 Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Tue, 12 Oct 2021 14:12:04 -0400 Subject: [PATCH 53/53] return to original action implementation --- .github/workflows/binder-badge.yml | 84 +++++++++++++----------------- 1 file changed, 36 insertions(+), 48 deletions(-) diff --git a/.github/workflows/binder-badge.yml b/.github/workflows/binder-badge.yml index 2683cd79c..214efab45 100644 --- a/.github/workflows/binder-badge.yml +++ b/.github/workflows/binder-badge.yml @@ -1,56 +1,44 @@ +# From: https://github.com/uwhackweek/jupyterbook-template/.github/workflows/binder-badge.yml + name: AddBinderBadge on: + push: pull_request_target: + types: [opened] jobs: - badge: + add-badge: runs-on: ubuntu-latest steps: - - uses: manics/action-binderbadge@main - with: - githubToken: ${{ secrets.GITHUB_TOKEN }} - -# From: https://github.com/uwhackweek/jupyterbook-template/.github/workflows/binder-badge.yml - -# name: AddBinderBadge -# on: -# push: -# pull_request_target: -# types: [opened] - -# jobs: -# add-badge: -# runs-on: ubuntu-latest -# steps: -# # - name: Checkout PR -# # uses: actions/checkout@v2 -# # - name: print vars -# # run: | -# # echo ${{ github.head_ref}} -# # echo ${{ github.ref}} -# # echo ${{ github.base_ref}} -# # echo ${GITHUB_REF#refs/heads/} -# # - name: get branch name -# # run: | -# # echo ${GITHUB_REF#refs/heads/} -# # export GIT_BRANCH=$(echo ${GITHUB_REF#refs/heads/}) -# # echo $GIT_BRANCH + # - name: Checkout PR + # uses: actions/checkout@v2 + # - name: print vars + # run: | + # echo ${{ github.head_ref}} + # echo ${{ github.ref}} + # echo ${{ github.base_ref}} + # echo ${GITHUB_REF#refs/heads/} + # - name: get branch name + # run: | + # echo ${GITHUB_REF#refs/heads/} + # export GIT_BRANCH=$(echo ${GITHUB_REF#refs/heads/}) + # echo $GIT_BRANCH -# - name: Comment on PR with Binder link -# uses: actions/github-script@v5 -# with: -# github-token: ${{secrets.GITHUB_TOKEN}} -# script: | -# console.log(context) -# var BRANCH_NAME = process.env.GITHUB_REF.replace("refs/heads", ""); -# var CONTENT_REPO = process.env.CONTENT_REPO; -# github.rest.issues.createComment({ -# issue_number: context.issue.number, -# owner: context.repo.owner, -# repo: context.repo.repo, -# body: `[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/${CONTENT_REPO}/${BRANCH_NAME}?labpath=examples) :point_left: Launch a binder notebook on this branch` -# }) -# # NOTE: Setting the vars as env vars is required to make them available within the Comment on PR step -# env: -# GITHUB_REF: ${{ github.ref }} -# CONTENT_REPO: ${{ github.repository }} \ No newline at end of file + - name: Comment on PR with Binder link + uses: actions/github-script@v5 + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + console.log(context) + var BRANCH_NAME = process.env.GITHUB_REF.replace("refs/heads", ""); + var CONTENT_REPO = process.env.CONTENT_REPO; + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: `[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/${CONTENT_REPO}/${BRANCH_NAME}?labpath=examples) :point_left: Launch a binder notebook on this branch` + }) + # NOTE: Setting the vars as env vars is required to make them available within the Comment on PR step + env: + GITHUB_REF: ${{ github.ref }} + CONTENT_REPO: ${{ github.repository }} \ No newline at end of file