From c35e9ca6192fd547cac99de154ab7bd62f4b2307 Mon Sep 17 00:00:00 2001 From: Greg Dennis Date: Mon, 1 Feb 2021 21:06:15 +1300 Subject: [PATCH 01/19] added first pr action - checklists --- .github/workflows/checklist.md | 3 +++ .github/workflows/checklist.yml | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 .github/workflows/checklist.md create mode 100644 .github/workflows/checklist.yml diff --git a/.github/workflows/checklist.md b/.github/workflows/checklist.md new file mode 100644 index 00000000..7da23900 --- /dev/null +++ b/.github/workflows/checklist.md @@ -0,0 +1,3 @@ +- [ ] [Issue](https://github.com/json-schema-org/json-schema-spec/issues) linked +- [ ] [Milestone](https://github.com/json-schema-org/json-schema-spec/milestones) assigned +- [ ] Test coverage issue in [test suite](https://github.com/json-schema-org/JSON-Schema-Test-Suite) \ No newline at end of file diff --git a/.github/workflows/checklist.yml b/.github/workflows/checklist.yml new file mode 100644 index 00000000..1a4d8bd7 --- /dev/null +++ b/.github/workflows/checklist.yml @@ -0,0 +1,21 @@ +name: Checklist Handler +on: [pull_request] + +jobs: + label: + runs-on: ubuntu-latest + steps: + - id: get-comment-body + run: | + body=$(cat checklist.md) + body="${body//'%'/'%25'}" + body="${body//$'\n'/'%0A'}" + body="${body//$'\r'/'%0D'}" + echo ::set-output name=body::$body + - name: Update comment + uses: peter-evans/create-or-update-comment@v1 + with: + comment-id: ${{ github.event.comment.id }} + body: ${{ steps.get-comment-body.outputs.body }} + token: GITHUB_TOKEN + edit-mode: append From daa417ab59099ed5e90eaffb57a8839811788996 Mon Sep 17 00:00:00 2001 From: Greg Dennis Date: Mon, 1 Feb 2021 21:28:18 +1300 Subject: [PATCH 02/19] add enforcement --- .github/workflows/checklist.yml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/checklist.yml b/.github/workflows/checklist.yml index 1a4d8bd7..f3a1a6b8 100644 --- a/.github/workflows/checklist.yml +++ b/.github/workflows/checklist.yml @@ -2,20 +2,29 @@ name: Checklist Handler on: [pull_request] jobs: - label: + add-checklist: runs-on: ubuntu-latest steps: - - id: get-comment-body + - name: Get Comment Body + id: get-comment-body run: | - body=$(cat checklist.md) + body=$(cat .github/workflows/checklist.md) body="${body//'%'/'%25'}" body="${body//$'\n'/'%0A'}" body="${body//$'\r'/'%0D'}" echo ::set-output name=body::$body - name: Update comment + # if: github.event.type == 'opened' uses: peter-evans/create-or-update-comment@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: comment-id: ${{ github.event.comment.id }} body: ${{ steps.get-comment-body.outputs.body }} - token: GITHUB_TOKEN edit-mode: append + enforce-checklist: + runs-on: ubuntu-latest + steps: + - uses: adamzolyak/checklist-checker-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From a16656d1006b425ffb89ad2faf53678eaa11414a Mon Sep 17 00:00:00 2001 From: Greg Dennis Date: Mon, 1 Feb 2021 21:34:51 +1300 Subject: [PATCH 03/19] check out files first --- .github/workflows/checklist.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/checklist.yml b/.github/workflows/checklist.yml index f3a1a6b8..a6c8b8af 100644 --- a/.github/workflows/checklist.yml +++ b/.github/workflows/checklist.yml @@ -5,10 +5,11 @@ jobs: add-checklist: runs-on: ubuntu-latest steps: + - uses: actions/checkout@v2 - name: Get Comment Body id: get-comment-body run: | - body=$(cat .github/workflows/checklist.md) + body=$(cat checklist.md) body="${body//'%'/'%25'}" body="${body//$'\n'/'%0A'}" body="${body//$'\r'/'%0D'}" @@ -24,6 +25,7 @@ jobs: edit-mode: append enforce-checklist: runs-on: ubuntu-latest + needs: add-checklist steps: - uses: adamzolyak/checklist-checker-action@master env: From 59a6810f21fa2416c7e9439669090237430f5308 Mon Sep 17 00:00:00 2001 From: Greg Dennis Date: Mon, 1 Feb 2021 21:35:45 +1300 Subject: [PATCH 04/19] full file path --- .github/workflows/checklist.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/checklist.yml b/.github/workflows/checklist.yml index a6c8b8af..bb98b5d2 100644 --- a/.github/workflows/checklist.yml +++ b/.github/workflows/checklist.yml @@ -9,7 +9,7 @@ jobs: - name: Get Comment Body id: get-comment-body run: | - body=$(cat checklist.md) + body=$(cat .github/workflows/checklist.md) body="${body//'%'/'%25'}" body="${body//$'\n'/'%0A'}" body="${body//$'\r'/'%0D'}" From 41dfae606446ef1c10fc2e978dec6914624f8fda Mon Sep 17 00:00:00 2001 From: Greg Dennis Date: Mon, 1 Feb 2021 21:52:29 +1300 Subject: [PATCH 05/19] get pr number --- .github/workflows/checklist.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/checklist.yml b/.github/workflows/checklist.yml index bb98b5d2..f5953771 100644 --- a/.github/workflows/checklist.yml +++ b/.github/workflows/checklist.yml @@ -15,12 +15,12 @@ jobs: body="${body//$'\r'/'%0D'}" echo ::set-output name=body::$body - name: Update comment - # if: github.event.type == 'opened' + # if: github.event.action == 'opened' uses: peter-evans/create-or-update-comment@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - comment-id: ${{ github.event.comment.id }} + issue-number: ${{ github.event.number }} body: ${{ steps.get-comment-body.outputs.body }} edit-mode: append enforce-checklist: From 32d389ab9471ccace0b416d464d7202901cbccc5 Mon Sep 17 00:00:00 2001 From: Greg Dennis Date: Mon, 1 Feb 2021 22:59:41 +1300 Subject: [PATCH 06/19] search for comment --- .github/workflows/checklist.md | 3 +++ .github/workflows/checklist.yml | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/checklist.md b/.github/workflows/checklist.md index 7da23900..f0b766e1 100644 --- a/.github/workflows/checklist.md +++ b/.github/workflows/checklist.md @@ -1,3 +1,6 @@ + +--- + - [ ] [Issue](https://github.com/json-schema-org/json-schema-spec/issues) linked - [ ] [Milestone](https://github.com/json-schema-org/json-schema-spec/milestones) assigned - [ ] Test coverage issue in [test suite](https://github.com/json-schema-org/JSON-Schema-Test-Suite) \ No newline at end of file diff --git a/.github/workflows/checklist.yml b/.github/workflows/checklist.yml index f5953771..335a91f6 100644 --- a/.github/workflows/checklist.yml +++ b/.github/workflows/checklist.yml @@ -14,13 +14,19 @@ jobs: body="${body//$'\n'/'%0A'}" body="${body//$'\r'/'%0D'}" echo ::set-output name=body::$body + - name: Find Comment + uses: peter-evans/find-comment@v1 + id: fc + with: + issue-number: ${{ github.event.number }} + comment-author: ${{ github.event.pull_request.user.login }} - name: Update comment # if: github.event.action == 'opened' uses: peter-evans/create-or-update-comment@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - issue-number: ${{ github.event.number }} + comment-id: ${{ steps.fc.outputs.comment-id }} body: ${{ steps.get-comment-body.outputs.body }} edit-mode: append enforce-checklist: From 7ab42c8ad15532f2ebe7cd26fab38954f10c0251 Mon Sep 17 00:00:00 2001 From: Greg Dennis Date: Mon, 1 Feb 2021 23:05:37 +1300 Subject: [PATCH 07/19] add debug step --- .github/workflows/checklist.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/checklist.yml b/.github/workflows/checklist.yml index 335a91f6..b986b3eb 100644 --- a/.github/workflows/checklist.yml +++ b/.github/workflows/checklist.yml @@ -20,6 +20,8 @@ jobs: with: issue-number: ${{ github.event.number }} comment-author: ${{ github.event.pull_request.user.login }} + - name: Print Comment ID + run: echo ${{ steps.fc.outputs.comment-id }} - name: Update comment # if: github.event.action == 'opened' uses: peter-evans/create-or-update-comment@v1 From 6143c6d4c02387c1a3e44b34d589bc78d952514e Mon Sep 17 00:00:00 2001 From: Greg Dennis Date: Mon, 1 Feb 2021 23:09:51 +1300 Subject: [PATCH 08/19] alternate way of getting first comment --- .github/workflows/checklist.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/checklist.yml b/.github/workflows/checklist.yml index b986b3eb..944f9146 100644 --- a/.github/workflows/checklist.yml +++ b/.github/workflows/checklist.yml @@ -14,21 +14,15 @@ jobs: body="${body//$'\n'/'%0A'}" body="${body//$'\r'/'%0D'}" echo ::set-output name=body::$body - - name: Find Comment - uses: peter-evans/find-comment@v1 - id: fc - with: - issue-number: ${{ github.event.number }} - comment-author: ${{ github.event.pull_request.user.login }} - name: Print Comment ID - run: echo ${{ steps.fc.outputs.comment-id }} + run: echo ${{ github.event.pull_request.comments[0].id }} - name: Update comment # if: github.event.action == 'opened' uses: peter-evans/create-or-update-comment@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - comment-id: ${{ steps.fc.outputs.comment-id }} + comment-id: ${{ github.event.pull_request.comments[0].id }} body: ${{ steps.get-comment-body.outputs.body }} edit-mode: append enforce-checklist: From 0797e686099c150c1eacf1c9847fe78f23726035 Mon Sep 17 00:00:00 2001 From: Greg Dennis Date: Mon, 1 Feb 2021 23:12:49 +1300 Subject: [PATCH 09/19] more debugging --- .github/workflows/checklist.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/checklist.yml b/.github/workflows/checklist.yml index 944f9146..0d314183 100644 --- a/.github/workflows/checklist.yml +++ b/.github/workflows/checklist.yml @@ -15,7 +15,11 @@ jobs: body="${body//$'\r'/'%0D'}" echo ::set-output name=body::$body - name: Print Comment ID - run: echo ${{ github.event.pull_request.comments[0].id }} + run: | + echo ${{ github.event.pull_request }} + echo ${{ github.event.pull_request.comments }} + echo ${{ github.event.pull_request.comments[0] }} + echo ${{ github.event.pull_request.comments[0].id }} - name: Update comment # if: github.event.action == 'opened' uses: peter-evans/create-or-update-comment@v1 From 503e5d67038a8f422760a8b5cf664e698a26da73 Mon Sep 17 00:00:00 2001 From: Greg Dennis Date: Mon, 1 Feb 2021 23:19:41 +1300 Subject: [PATCH 10/19] new action for updating the first 'comment' or 'body' --- .github/workflows/checklist.yml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/.github/workflows/checklist.yml b/.github/workflows/checklist.yml index 0d314183..d36e640f 100644 --- a/.github/workflows/checklist.yml +++ b/.github/workflows/checklist.yml @@ -14,21 +14,20 @@ jobs: body="${body//$'\n'/'%0A'}" body="${body//$'\r'/'%0D'}" echo ::set-output name=body::$body - - name: Print Comment ID - run: | - echo ${{ github.event.pull_request }} - echo ${{ github.event.pull_request.comments }} - echo ${{ github.event.pull_request.comments[0] }} - echo ${{ github.event.pull_request.comments[0].id }} + # - name: Print Comment ID + # run: | + # echo ${{ github.event.pull_request }} + # echo ${{ github.event.pull_request.comments }} + # echo ${{ github.event.pull_request.comments[0] }} + # echo ${{ github.event.pull_request.comments[0].id }} - name: Update comment # if: github.event.action == 'opened' - uses: peter-evans/create-or-update-comment@v1 + # uses: peter-evans/create-or-update-comment@v1 + uses: AsasInnab/pr-body-action@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - comment-id: ${{ github.event.pull_request.comments[0].id }} body: ${{ steps.get-comment-body.outputs.body }} - edit-mode: append enforce-checklist: runs-on: ubuntu-latest needs: add-checklist From d634dbde5778c2615011c00ee262bc95dffebb56 Mon Sep 17 00:00:00 2001 From: Greg Dennis Date: Mon, 1 Feb 2021 23:20:49 +1300 Subject: [PATCH 11/19] input token as param --- .github/workflows/checklist.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/checklist.yml b/.github/workflows/checklist.yml index d36e640f..58eeae53 100644 --- a/.github/workflows/checklist.yml +++ b/.github/workflows/checklist.yml @@ -24,10 +24,9 @@ jobs: # if: github.event.action == 'opened' # uses: peter-evans/create-or-update-comment@v1 uses: AsasInnab/pr-body-action@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: body: ${{ steps.get-comment-body.outputs.body }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} enforce-checklist: runs-on: ubuntu-latest needs: add-checklist From 598fa1550c3c3621cec523a5a8a672dd4e07fb5a Mon Sep 17 00:00:00 2001 From: Greg Dennis Date: Mon, 1 Feb 2021 23:25:56 +1300 Subject: [PATCH 12/19] append existing text --- .github/workflows/checklist.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/checklist.yml b/.github/workflows/checklist.yml index 58eeae53..52862951 100644 --- a/.github/workflows/checklist.yml +++ b/.github/workflows/checklist.yml @@ -9,20 +9,14 @@ jobs: - name: Get Comment Body id: get-comment-body run: | - body=$(cat .github/workflows/checklist.md) + existing=${{ github.event.pull_request.body }} + body="existing$'\n'$(cat .github/workflows/checklist.md)" body="${body//'%'/'%25'}" body="${body//$'\n'/'%0A'}" body="${body//$'\r'/'%0D'}" echo ::set-output name=body::$body - # - name: Print Comment ID - # run: | - # echo ${{ github.event.pull_request }} - # echo ${{ github.event.pull_request.comments }} - # echo ${{ github.event.pull_request.comments[0] }} - # echo ${{ github.event.pull_request.comments[0].id }} - name: Update comment # if: github.event.action == 'opened' - # uses: peter-evans/create-or-update-comment@v1 uses: AsasInnab/pr-body-action@v1 with: body: ${{ steps.get-comment-body.outputs.body }} From e5ae410083ab5b1c6c3e8e8b957444bc58d062ce Mon Sep 17 00:00:00 2001 From: Greg Dennis Date: Mon, 1 Feb 2021 23:29:43 +1300 Subject: [PATCH 13/19] no quotes --- .github/workflows/checklist.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/checklist.yml b/.github/workflows/checklist.yml index 52862951..9f2757c9 100644 --- a/.github/workflows/checklist.yml +++ b/.github/workflows/checklist.yml @@ -10,7 +10,7 @@ jobs: id: get-comment-body run: | existing=${{ github.event.pull_request.body }} - body="existing$'\n'$(cat .github/workflows/checklist.md)" + body=existing$'\n'$(cat .github/workflows/checklist.md) body="${body//'%'/'%25'}" body="${body//$'\n'/'%0A'}" body="${body//$'\r'/'%0D'}" From d051a97947607fe8f1a496c65389bc7bef2fa96a Mon Sep 17 00:00:00 2001 From: Greg Dennis Date: Mon, 1 Feb 2021 23:37:05 +1300 Subject: [PATCH 14/19] no new line --- .github/workflows/checklist.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/checklist.yml b/.github/workflows/checklist.yml index 9f2757c9..dd710f63 100644 --- a/.github/workflows/checklist.yml +++ b/.github/workflows/checklist.yml @@ -10,7 +10,7 @@ jobs: id: get-comment-body run: | existing=${{ github.event.pull_request.body }} - body=existing$'\n'$(cat .github/workflows/checklist.md) + body=${existing}$(cat .github/workflows/checklist.md) body="${body//'%'/'%25'}" body="${body//$'\n'/'%0A'}" body="${body//$'\r'/'%0D'}" From 09478c27df17823ca4066996c4975c41fe9f97b9 Mon Sep 17 00:00:00 2001 From: Greg Dennis Date: Mon, 1 Feb 2021 23:38:32 +1300 Subject: [PATCH 15/19] quotes --- .github/workflows/checklist.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/checklist.yml b/.github/workflows/checklist.yml index dd710f63..28c40601 100644 --- a/.github/workflows/checklist.yml +++ b/.github/workflows/checklist.yml @@ -9,8 +9,8 @@ jobs: - name: Get Comment Body id: get-comment-body run: | - existing=${{ github.event.pull_request.body }} - body=${existing}$(cat .github/workflows/checklist.md) + existing="${{ github.event.pull_request.body }}" + body="${existing}$(cat .github/workflows/checklist.md)" body="${body//'%'/'%25'}" body="${body//$'\n'/'%0A'}" body="${body//$'\r'/'%0D'}" From c507d83a5c63aa340382de675ba6d1aeb05eebff Mon Sep 17 00:00:00 2001 From: Greg Dennis Date: Mon, 1 Feb 2021 23:39:55 +1300 Subject: [PATCH 16/19] needs another blank line --- .github/workflows/checklist.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/checklist.md b/.github/workflows/checklist.md index f0b766e1..c7dba132 100644 --- a/.github/workflows/checklist.md +++ b/.github/workflows/checklist.md @@ -1,4 +1,5 @@ + --- - [ ] [Issue](https://github.com/json-schema-org/json-schema-spec/issues) linked From 3e1aa121a9a18344eb3ce32314137f6ce576c468 Mon Sep 17 00:00:00 2001 From: Greg Dennis Date: Mon, 1 Feb 2021 23:41:26 +1300 Subject: [PATCH 17/19] disable update for existing prs --- .github/workflows/checklist.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/checklist.yml b/.github/workflows/checklist.yml index 28c40601..8d7eb5f7 100644 --- a/.github/workflows/checklist.yml +++ b/.github/workflows/checklist.yml @@ -16,7 +16,7 @@ jobs: body="${body//$'\r'/'%0D'}" echo ::set-output name=body::$body - name: Update comment - # if: github.event.action == 'opened' + if: github.event.action == 'opened' uses: AsasInnab/pr-body-action@v1 with: body: ${{ steps.get-comment-body.outputs.body }} From c56bb2145ef8776c7ee5d9e9f14c4eff6b7254e2 Mon Sep 17 00:00:00 2001 From: Greg Dennis Date: Mon, 1 Feb 2021 23:53:02 +1300 Subject: [PATCH 18/19] trying a different checklist verifier --- .github/workflows/checklist.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/checklist.yml b/.github/workflows/checklist.yml index 8d7eb5f7..08fa068a 100644 --- a/.github/workflows/checklist.yml +++ b/.github/workflows/checklist.yml @@ -25,6 +25,8 @@ jobs: runs-on: ubuntu-latest needs: add-checklist steps: - - uses: adamzolyak/checklist-checker-action@master + - uses: mheap/require-checklist-action@v1 + with: + requireChecklist: false # If this is true and there are no checklists detected, the action will fail env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From ca72687cc3276fdb968ee377446937ac438eabc4 Mon Sep 17 00:00:00 2001 From: Greg Dennis Date: Mon, 1 Feb 2021 23:56:07 +1300 Subject: [PATCH 19/19] allow manual trigger --- .github/workflows/checklist.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/checklist.yml b/.github/workflows/checklist.yml index 08fa068a..2803ac0f 100644 --- a/.github/workflows/checklist.yml +++ b/.github/workflows/checklist.yml @@ -1,5 +1,7 @@ name: Checklist Handler -on: [pull_request] +on: + pull_request: + workflow_dispatch: jobs: add-checklist: