From 54449093282f89a695f9faa6cde62e771660375b Mon Sep 17 00:00:00 2001 From: KevinEyo1 Date: Mon, 29 Jan 2024 13:25:23 +0800 Subject: [PATCH 01/27] a --- packages/core/__mocks__/gh-pages.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/core/__mocks__/gh-pages.js b/packages/core/__mocks__/gh-pages.js index f62f21cb3e..8ca33ad49b 100644 --- a/packages/core/__mocks__/gh-pages.js +++ b/packages/core/__mocks__/gh-pages.js @@ -9,4 +9,5 @@ ghpages.publish = (dir, options, callback) => { callback(); }; + module.exports = ghpages; From a4a4d722555693fd24957b8eb1457241a1d530ce Mon Sep 17 00:00:00 2001 From: KevinEyo1 Date: Mon, 29 Jan 2024 13:26:43 +0800 Subject: [PATCH 02/27] Revert test changes --- packages/core/__mocks__/gh-pages.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/core/__mocks__/gh-pages.js b/packages/core/__mocks__/gh-pages.js index 8ca33ad49b..f62f21cb3e 100644 --- a/packages/core/__mocks__/gh-pages.js +++ b/packages/core/__mocks__/gh-pages.js @@ -9,5 +9,4 @@ ghpages.publish = (dir, options, callback) => { callback(); }; - module.exports = ghpages; From 52c84e733a11b302cd3cdccfbace6c7bd1892738 Mon Sep 17 00:00:00 2001 From: KevinEyo1 Date: Sat, 16 Mar 2024 01:18:23 +0800 Subject: [PATCH 03/27] Create workflow --- .github/workflows/pr-merge.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/pr-merge.yml diff --git a/.github/workflows/pr-merge.yml b/.github/workflows/pr-merge.yml new file mode 100644 index 0000000000..f84fc55611 --- /dev/null +++ b/.github/workflows/pr-merge.yml @@ -0,0 +1,29 @@ +name: PR Merge +on: + push: + branches: + - master + tags: + - 'v[0-9]+.[0-9]+.[0-9]+' + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + check-release-tag: + runs-on: ubuntu-latest + steps: + - name: Check for presence of release tag + id: check_release_tag + uses: actions/github-script@v5 + with: + script: | + + env: + LABELS: ${{ toJson(github.event.pull_request.labels) }} + CONTAINS_LABELS: ${{ contains(toJson(github.event.pull_request.labels), 'release') }} + + + + From e26927ab74e59e102017e8c52daced9046ec4460 Mon Sep 17 00:00:00 2001 From: KevinEyo1 Date: Sun, 17 Mar 2024 21:00:59 +0800 Subject: [PATCH 04/27] Add pr-merge workflow --- .github/workflows/pr-merge.yml | 85 +++++++++++++++++++++++++++------- 1 file changed, 67 insertions(+), 18 deletions(-) diff --git a/.github/workflows/pr-merge.yml b/.github/workflows/pr-merge.yml index f84fc55611..b4504ef8d2 100644 --- a/.github/workflows/pr-merge.yml +++ b/.github/workflows/pr-merge.yml @@ -1,29 +1,78 @@ name: PR Merge on: - push: - branches: - - master - tags: - - 'v[0-9]+.[0-9]+.[0-9]+' + # push: + # branches: + # - master + # tags: + # - 'v[0-9]+.[0-9]+.[0-9]+' + pull_request: + types: + - closed concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true jobs: - check-release-tag: + check-pr-label: + if: ${{ github.event.pull_request.merged == true }} && ${{ github.event.pull_request.base.ref == 'master' }} runs-on: ubuntu-latest + steps: - - name: Check for presence of release tag - id: check_release_tag - uses: actions/github-script@v5 - with: - script: | - - env: - LABELS: ${{ toJson(github.event.pull_request.labels) }} - CONTAINS_LABELS: ${{ contains(toJson(github.event.pull_request.labels), 'release') }} + - uses: actions/checkout@v3 + - name: Check for PR description label + id: check_pr_description_label + run: | + python scripts/process_message.py "${TEXT_BODY}" > processed_body.txt + processed_body=$(cat processed_body.txt) + proposed_version_impact=$(echo "$processed_body" | awk '/Major \\\(when you make incompatible API changes\\\)/,/Patch \\\(when you make backward compatible bug fixes\\\)/') + echo "Version Impact: $proposed_version_impact" + is_major=$(echo "$proposed_version_impact" | grep -q '\[X\] Major'; echo $?) + is_minor=$(echo "$proposed_version_impact" | grep -q '\[X\] Minor'; echo $?) + is_patch=$(echo "$proposed_version_impact" | grep -q '\[X\] Patch'; echo $?) + echo "is_major=$( [ $is_major -eq 0 ] && echo "true" || echo "false" )" >> $GITHUB_OUTPUT + echo "is_minor=$( [ $is_minor -eq 0 ] && echo "true" || echo "false" )" >> $GITHUB_OUTPUT + echo "is_patch=$( [ $is_patch -eq 0 ] && echo "true" || echo "false" )" >> $GITHUB_OUTPUT + env: + TEXT_BODY: ${{ github.event.pull_request.body }} + - name: Check that only one version impact is selected + id: check_version_impact + run: | + if [ "$IS_MAJOR" = "false" ] && [ "$IS_MINOR" = "false" ] && [ "$IS_PATCH" = "false" ]; then + echo "Please remember to tick a SEMVER impact for this PR in the PR body description." + exit 1 + elif [ "$IS_MAJOR" = "true" ] && { [ "$IS_MINOR" = "true" ] || [ "$IS_PATCH" = "true" ]; } || { [ "$IS_MINOR" = "true" ] && [ "$IS_PATCH" = "true" ]; }; then + echo "Please select only one SEMVER impact for this PR in the PR body description." + exit 1 + else + echo "chosen_label=$( + if [ "$IS_MAJOR" = "true" ]; then + echo "r.Major" + elif [ "$IS_MINOR" = "true" ]; then + echo "r.Minor" + elif [ "$IS_PATCH" = "true" ]; then + echo "r.Patch" + fi + )" >> $GITHUB_OUTPUT + fi + env: + IS_MAJOR: ${{ steps.check_pr_description_label.outputs.is_major }} + IS_MINOR: ${{ steps.check_pr_description_label.outputs.is_minor }} + IS_PATCH: ${{ steps.check_pr_description_label.outputs.is_patch }} + + - name: Assign label based on version impact + uses: actions/github-script@v7 + with: + script: | + github.rest.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.payload.pull_request.number, + labels: ["$CHOSEN_LABEL"] + }) + env: + CHOSEN_LABEL: ${{ steps.check_version_impact.outputs.chosen_label }} - + \ No newline at end of file From 188e4be175c54740a15bfaa4fee1c02e84478683 Mon Sep 17 00:00:00 2001 From: KevinEyo1 Date: Sun, 17 Mar 2024 21:35:40 +0800 Subject: [PATCH 05/27] Add restriction for master --- .github/workflows/pr-merge.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pr-merge.yml b/.github/workflows/pr-merge.yml index b4504ef8d2..c4e5069f8c 100644 --- a/.github/workflows/pr-merge.yml +++ b/.github/workflows/pr-merge.yml @@ -6,6 +6,8 @@ on: # tags: # - 'v[0-9]+.[0-9]+.[0-9]+' pull_request: + branches: + - master types: - closed From 96ee925811b17cabd626e7b2d570aa63e351c6a4 Mon Sep 17 00:00:00 2001 From: KevinEyo1 Date: Mon, 18 Mar 2024 12:36:05 +0800 Subject: [PATCH 06/27] Test change --- .github/workflows/pr-merge.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/pr-merge.yml b/.github/workflows/pr-merge.yml index c4e5069f8c..058b1f53c9 100644 --- a/.github/workflows/pr-merge.yml +++ b/.github/workflows/pr-merge.yml @@ -6,8 +6,6 @@ on: # tags: # - 'v[0-9]+.[0-9]+.[0-9]+' pull_request: - branches: - - master types: - closed @@ -17,7 +15,7 @@ concurrency: jobs: check-pr-label: - if: ${{ github.event.pull_request.merged == true }} && ${{ github.event.pull_request.base.ref == 'master' }} + if: ${{ github.event.pull_request.merged == true }} runs-on: ubuntu-latest steps: From 5d77ded4d442eb25a6faf00c30f813599ec33568 Mon Sep 17 00:00:00 2001 From: KevinEyo1 Date: Tue, 19 Mar 2024 12:47:27 +0800 Subject: [PATCH 07/27] Simplify logic --- .github/workflows/pr-merge.yml | 68 +++++++++++++++------------------- delete.json | 1 + delete.py | 28 ++++++++++++++ 3 files changed, 59 insertions(+), 38 deletions(-) create mode 100644 delete.json create mode 100644 delete.py diff --git a/.github/workflows/pr-merge.yml b/.github/workflows/pr-merge.yml index 058b1f53c9..57d128d25e 100644 --- a/.github/workflows/pr-merge.yml +++ b/.github/workflows/pr-merge.yml @@ -26,53 +26,45 @@ jobs: python scripts/process_message.py "${TEXT_BODY}" > processed_body.txt processed_body=$(cat processed_body.txt) proposed_version_impact=$(echo "$processed_body" | awk '/Major \\\(when you make incompatible API changes\\\)/,/Patch \\\(when you make backward compatible bug fixes\\\)/') - echo "Version Impact: $proposed_version_impact" is_major=$(echo "$proposed_version_impact" | grep -q '\[X\] Major'; echo $?) is_minor=$(echo "$proposed_version_impact" | grep -q '\[X\] Minor'; echo $?) is_patch=$(echo "$proposed_version_impact" | grep -q '\[X\] Patch'; echo $?) - echo "is_major=$( [ $is_major -eq 0 ] && echo "true" || echo "false" )" >> $GITHUB_OUTPUT - echo "is_minor=$( [ $is_minor -eq 0 ] && echo "true" || echo "false" )" >> $GITHUB_OUTPUT - echo "is_patch=$( [ $is_patch -eq 0 ] && echo "true" || echo "false" )" >> $GITHUB_OUTPUT + sum=$(($is_major + $is_minor + $is_patch)) + if [[ "$sum" -eq 3 ]]; then + echo "Please remember to tick a SEMVER impact for this PR in the PR body description." + exit 1 + elif [[ "$sum" -le 1 ]]; then + echo "Please select only one SEMVER impact for this PR in the PR body description." + exit 1 + else + echo "chosen_label=$( + if [ "$is_major" -eq 0 ]; then + echo "r.Major" + elif [ "$is_minor" -eq 0 ]; then + echo "r.Minor" + elif [ "$is_patch" -eq 0 ]; then + echo "r.Patch" + fi + )" >> $GITHUB_OUTPUT + fi env: TEXT_BODY: ${{ github.event.pull_request.body }} - - name: Check that only one version impact is selected - id: check_version_impact - run: | - if [ "$IS_MAJOR" = "false" ] && [ "$IS_MINOR" = "false" ] && [ "$IS_PATCH" = "false" ]; then - echo "Please remember to tick a SEMVER impact for this PR in the PR body description." - exit 1 - elif [ "$IS_MAJOR" = "true" ] && { [ "$IS_MINOR" = "true" ] || [ "$IS_PATCH" = "true" ]; } || { [ "$IS_MINOR" = "true" ] && [ "$IS_PATCH" = "true" ]; }; then - echo "Please select only one SEMVER impact for this PR in the PR body description." - exit 1 - else - echo "chosen_label=$( - if [ "$IS_MAJOR" = "true" ]; then - echo "r.Major" - elif [ "$IS_MINOR" = "true" ]; then - echo "r.Minor" - elif [ "$IS_PATCH" = "true" ]; then - echo "r.Patch" - fi - )" >> $GITHUB_OUTPUT - fi - env: - IS_MAJOR: ${{ steps.check_pr_description_label.outputs.is_major }} - IS_MINOR: ${{ steps.check_pr_description_label.outputs.is_minor }} - IS_PATCH: ${{ steps.check_pr_description_label.outputs.is_patch }} - name: Assign label based on version impact - uses: actions/github-script@v7 - with: - script: | - github.rest.issues.addLabels({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.payload.pull_request.number, - labels: ["$CHOSEN_LABEL"] - }) + run: echo "${CHOSEN_LABEL}" + # uses: actions/github-script@v7 + + # with: + # script: | + # github.rest.issues.addLabels({ + # owner: context.repo.owner, + # repo: context.repo.repo, + # issue_number: context.payload.pull_request.number, + # labels: ["$CHOSEN_LABEL"] + # }) env: - CHOSEN_LABEL: ${{ steps.check_version_impact.outputs.chosen_label }} + CHOSEN_LABEL: ${{ steps.check_pr_description_label.outputs.chosen_label }} \ No newline at end of file diff --git a/delete.json b/delete.json new file mode 100644 index 0000000000..617018c834 --- /dev/null +++ b/delete.json @@ -0,0 +1 @@ +{"pull_request": {"body": "**What is the purpose of this pull request?**\n\n- [ ] Documentation update\n- [ ] Bug fix\n- [ ] Feature addition or enhancement\n- [ ] Code maintenance\n- [ ] DevOps\n- [ ] Improve developer experience\n- [ ] Others, please explain:\n\n\n\n**Overview of changes:**\n\n\n**Anything you'd like to highlight/discuss:**\n\n\n**Testing instructions:**\n\n\n\n**Proposed commit message: (wrap lines at 72 characters)**\n\n\n\n---\n\n**Checklist:** :ballot_box_with_check:\n\n\n\n- [ ] Updated the documentation for feature additions and enhancements\n- [ ] Added tests for bug fixes or features\n- [ ] Linked all related issues\n- [ ] No unrelated changes \n\n\n\n---\n\n**Reviewer checklist:**\n\nIndicate the [SEMVER](https://semver.org/) impact of the PR:\n- [X] Major (when you make incompatible API changes)\n- [ ] Minor (when you add functionality in a backward compatible manner)\n- [ ] Patch (when you make backward compatible bug fixes)\n\nAt the end of the review, please label the PR with the appropriate label: `r.Major`, `r.Minor`, `r.Patch`.\n\nBreaking change release note preparation (if applicable):\n- To be included in the release note for any feature that is made obsolete/breaking\n\n> Give a brief explanation note about:\n> - what was the old feature that was made obsolete\n> - any replacement feature (if any), and\n> - how the author should modify his website to migrate from the old feature to the replacement feature (if possible).\n", "base": {"ref": "master"}, "merged": true}} \ No newline at end of file diff --git a/delete.py b/delete.py new file mode 100644 index 0000000000..9f22a81373 --- /dev/null +++ b/delete.py @@ -0,0 +1,28 @@ +import json + +# Path to your markdown file +markdown_file_path = '.github/PULL_REQUEST_TEMPLATE' + +# Read the markdown file content +with open(markdown_file_path, 'r', encoding='utf-8') as file: + markdown_content = file.read() + +# Convert markdown content to JSON format +json_payload = { + "pull_request": { + "body": markdown_content, + "base": { + "ref": "master" + }, + "merged": True + } +} + +# Convert Python dictionary to JSON string +json_string = json.dumps(json_payload, ensure_ascii=False) + +# Output or save the JSON string as needed +# print(json_string) +#save to delete.json +with open('delete.json', 'w', encoding='utf-8') as file: + file.write(json_string) \ No newline at end of file From 409ec369b9fa16624fccf94feaee3f2dd3e1b7c5 Mon Sep 17 00:00:00 2001 From: KevinEyo1 Date: Tue, 19 Mar 2024 15:56:31 +0800 Subject: [PATCH 08/27] Fix label name --- .github/workflows/pr-merge.yml | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/.github/workflows/pr-merge.yml b/.github/workflows/pr-merge.yml index 57d128d25e..f404ad2127 100644 --- a/.github/workflows/pr-merge.yml +++ b/.github/workflows/pr-merge.yml @@ -52,17 +52,15 @@ jobs: TEXT_BODY: ${{ github.event.pull_request.body }} - name: Assign label based on version impact - run: echo "${CHOSEN_LABEL}" - # uses: actions/github-script@v7 - - # with: - # script: | - # github.rest.issues.addLabels({ - # owner: context.repo.owner, - # repo: context.repo.repo, - # issue_number: context.payload.pull_request.number, - # labels: ["$CHOSEN_LABEL"] - # }) + uses: actions/github-script@v7 + with: + script: | + github.rest.issues.addLabels({ + issue_number: context.payload.pull_request.number, + owner: context.repo.owner, + repo: context.repo.repo, + labels: ['${CHOSEN_LABEL}'] + }) env: CHOSEN_LABEL: ${{ steps.check_pr_description_label.outputs.chosen_label }} From 619c5c3b1d50f34acabe34482ee56258c5159f13 Mon Sep 17 00:00:00 2001 From: KevinEyo1 Date: Tue, 19 Mar 2024 16:12:53 +0800 Subject: [PATCH 09/27] Fix bug --- .github/workflows/pr-merge.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr-merge.yml b/.github/workflows/pr-merge.yml index f404ad2127..dc3c40e55a 100644 --- a/.github/workflows/pr-merge.yml +++ b/.github/workflows/pr-merge.yml @@ -55,11 +55,12 @@ jobs: uses: actions/github-script@v7 with: script: | + const chosen_label = "${CHOSEN_LABEL}" github.rest.issues.addLabels({ issue_number: context.payload.pull_request.number, owner: context.repo.owner, repo: context.repo.repo, - labels: ['${CHOSEN_LABEL}'] + labels: [chosen_label] }) env: CHOSEN_LABEL: ${{ steps.check_pr_description_label.outputs.chosen_label }} From 520b845502d0dddc2df1c29f31468edf1d5499fc Mon Sep 17 00:00:00 2001 From: KevinEyo1 Date: Tue, 19 Mar 2024 16:49:03 +0800 Subject: [PATCH 10/27] Fix change --- .github/workflows/pr-merge.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/pr-merge.yml b/.github/workflows/pr-merge.yml index dc3c40e55a..cedf154551 100644 --- a/.github/workflows/pr-merge.yml +++ b/.github/workflows/pr-merge.yml @@ -1,10 +1,5 @@ name: PR Merge on: - # push: - # branches: - # - master - # tags: - # - 'v[0-9]+.[0-9]+.[0-9]+' pull_request: types: - closed From 6f6409bfeec31146f39cbf54e412c8665c9ebc0c Mon Sep 17 00:00:00 2001 From: KevinEyo1 Date: Tue, 19 Mar 2024 16:57:37 +0800 Subject: [PATCH 11/27] Test --- .github/workflows/pr-merge.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/pr-merge.yml b/.github/workflows/pr-merge.yml index cedf154551..f08faf3282 100644 --- a/.github/workflows/pr-merge.yml +++ b/.github/workflows/pr-merge.yml @@ -50,12 +50,11 @@ jobs: uses: actions/github-script@v7 with: script: | - const chosen_label = "${CHOSEN_LABEL}" github.rest.issues.addLabels({ issue_number: context.payload.pull_request.number, owner: context.repo.owner, repo: context.repo.repo, - labels: [chosen_label] + labels: [${!CHOSEN_LABEL}] }) env: CHOSEN_LABEL: ${{ steps.check_pr_description_label.outputs.chosen_label }} From f4683131c713b6840999dbaeebb8c1a4fac0cbe5 Mon Sep 17 00:00:00 2001 From: KevinEyo1 Date: Tue, 19 Mar 2024 17:11:41 +0800 Subject: [PATCH 12/27] Change --- .github/workflows/pr-merge.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr-merge.yml b/.github/workflows/pr-merge.yml index f08faf3282..6f4d55671f 100644 --- a/.github/workflows/pr-merge.yml +++ b/.github/workflows/pr-merge.yml @@ -21,9 +21,9 @@ jobs: python scripts/process_message.py "${TEXT_BODY}" > processed_body.txt processed_body=$(cat processed_body.txt) proposed_version_impact=$(echo "$processed_body" | awk '/Major \\\(when you make incompatible API changes\\\)/,/Patch \\\(when you make backward compatible bug fixes\\\)/') - is_major=$(echo "$proposed_version_impact" | grep -q '\[X\] Major'; echo $?) - is_minor=$(echo "$proposed_version_impact" | grep -q '\[X\] Minor'; echo $?) - is_patch=$(echo "$proposed_version_impact" | grep -q '\[X\] Patch'; echo $?) + is_major=$(echo "$proposed_version_impact" | grep -qi '\[X\] Major'; echo $?) + is_minor=$(echo "$proposed_version_impact" | grep -qi '\[X\] Minor'; echo $?) + is_patch=$(echo "$proposed_version_impact" | grep -qi '\[X\] Patch'; echo $?) sum=$(($is_major + $is_minor + $is_patch)) if [[ "$sum" -eq 3 ]]; then echo "Please remember to tick a SEMVER impact for this PR in the PR body description." @@ -54,7 +54,7 @@ jobs: issue_number: context.payload.pull_request.number, owner: context.repo.owner, repo: context.repo.repo, - labels: [${!CHOSEN_LABEL}] + labels: [${{env.CHOSEN_LABEL}}] }) env: CHOSEN_LABEL: ${{ steps.check_pr_description_label.outputs.chosen_label }} From cba297f4409314521b2bc62d3da025195279c0b8 Mon Sep 17 00:00:00 2001 From: KevinEyo1 Date: Tue, 19 Mar 2024 17:15:18 +0800 Subject: [PATCH 13/27] Test --- .github/workflows/pr-merge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-merge.yml b/.github/workflows/pr-merge.yml index 6f4d55671f..ecd391537d 100644 --- a/.github/workflows/pr-merge.yml +++ b/.github/workflows/pr-merge.yml @@ -54,7 +54,7 @@ jobs: issue_number: context.payload.pull_request.number, owner: context.repo.owner, repo: context.repo.repo, - labels: [${{env.CHOSEN_LABEL}}] + labels: [process.env.CHOSEN_LABEL] }) env: CHOSEN_LABEL: ${{ steps.check_pr_description_label.outputs.chosen_label }} From 9a845849c6567ae494cc526265a2736e996a3cc3 Mon Sep 17 00:00:00 2001 From: KevinEyo1 Date: Tue, 19 Mar 2024 17:56:08 +0800 Subject: [PATCH 14/27] Add ping --- .github/workflows/pr-merge.yml | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pr-merge.yml b/.github/workflows/pr-merge.yml index ecd391537d..3f7e88481b 100644 --- a/.github/workflows/pr-merge.yml +++ b/.github/workflows/pr-merge.yml @@ -24,14 +24,13 @@ jobs: is_major=$(echo "$proposed_version_impact" | grep -qi '\[X\] Major'; echo $?) is_minor=$(echo "$proposed_version_impact" | grep -qi '\[X\] Minor'; echo $?) is_patch=$(echo "$proposed_version_impact" | grep -qi '\[X\] Patch'; echo $?) - sum=$(($is_major + $is_minor + $is_patch)) + echo "sum=$(($is_major + $is_minor + $is_patch))" >> $GITHUB_OUTPUT if [[ "$sum" -eq 3 ]]; then - echo "Please remember to tick a SEMVER impact for this PR in the PR body description." - exit 1 + echo "message=$(echo "@${MERGE_AUTHOR} Each PR must have a SEMVER impact label, please label the PR properly.")" >> $GITHUB_OUTPUT elif [[ "$sum" -le 1 ]]; then - echo "Please select only one SEMVER impact for this PR in the PR body description." - exit 1 + echo "message=$(echo "@${MERGE_AUTHOR} Each PR can only have one SEMVER impact label, please label the PR properly.")" >> $GITHUB_OUTPUT else + echo "message=$(echo "SEMVER impact selected.")" >> $GITHUB_OUTPUT echo "chosen_label=$( if [ "$is_major" -eq 0 ]; then echo "r.Major" @@ -45,18 +44,30 @@ jobs: env: TEXT_BODY: ${{ github.event.pull_request.body }} + MERGE_AUTHOR: ${{ github.event.pull_request.merged_by.login }} - name: Assign label based on version impact uses: actions/github-script@v7 with: script: | - github.rest.issues.addLabels({ + if (process.env.SUM != 2) { + github.rest.issues.createComment({ issue_number: context.payload.pull_request.number, owner: context.repo.owner, repo: context.repo.repo, - labels: [process.env.CHOSEN_LABEL] - }) + body: process.env.MESSAGE, + }); + } else { + github.rest.issues.addLabels({ + issue_number: context.payload.pull_request.number, + owner: context.repo.owner, + repo: context.repo.repo, + labels: [process.env.CHOSEN_LABEL] + }); + } env: + SUM: ${{ steps.check_pr_description_label.outputs.sum }} + MESSAGE: ${{ steps.check_pr_description_label.outputs.message }} CHOSEN_LABEL: ${{ steps.check_pr_description_label.outputs.chosen_label }} From 22253792937d2be945cc28c49ed466ed0b32527b Mon Sep 17 00:00:00 2001 From: KevinEyo1 Date: Tue, 19 Mar 2024 18:02:45 +0800 Subject: [PATCH 15/27] Add marker --- .github/workflows/pr-merge.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pr-merge.yml b/.github/workflows/pr-merge.yml index 3f7e88481b..63f4fdf709 100644 --- a/.github/workflows/pr-merge.yml +++ b/.github/workflows/pr-merge.yml @@ -26,8 +26,10 @@ jobs: is_patch=$(echo "$proposed_version_impact" | grep -qi '\[X\] Patch'; echo $?) echo "sum=$(($is_major + $is_minor + $is_patch))" >> $GITHUB_OUTPUT if [[ "$sum" -eq 3 ]]; then + echo "3" echo "message=$(echo "@${MERGE_AUTHOR} Each PR must have a SEMVER impact label, please label the PR properly.")" >> $GITHUB_OUTPUT elif [[ "$sum" -le 1 ]]; then + echo "1" echo "message=$(echo "@${MERGE_AUTHOR} Each PR can only have one SEMVER impact label, please label the PR properly.")" >> $GITHUB_OUTPUT else echo "message=$(echo "SEMVER impact selected.")" >> $GITHUB_OUTPUT From 462d26d5df1f54460cd9c757615f0c7238a88841 Mon Sep 17 00:00:00 2001 From: KevinEyo1 Date: Tue, 19 Mar 2024 18:08:15 +0800 Subject: [PATCH 16/27] A --- .github/workflows/pr-merge.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pr-merge.yml b/.github/workflows/pr-merge.yml index 63f4fdf709..0b23220d47 100644 --- a/.github/workflows/pr-merge.yml +++ b/.github/workflows/pr-merge.yml @@ -25,6 +25,7 @@ jobs: is_minor=$(echo "$proposed_version_impact" | grep -qi '\[X\] Minor'; echo $?) is_patch=$(echo "$proposed_version_impact" | grep -qi '\[X\] Patch'; echo $?) echo "sum=$(($is_major + $is_minor + $is_patch))" >> $GITHUB_OUTPUT + echo "sum: $sum" if [[ "$sum" -eq 3 ]]; then echo "3" echo "message=$(echo "@${MERGE_AUTHOR} Each PR must have a SEMVER impact label, please label the PR properly.")" >> $GITHUB_OUTPUT From 1f901fd5b7c4c26e6d0bce9ab1b9b7c4c26f1771 Mon Sep 17 00:00:00 2001 From: KevinEyo1 Date: Tue, 19 Mar 2024 18:12:09 +0800 Subject: [PATCH 17/27] Fix bug --- .github/workflows/pr-merge.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-merge.yml b/.github/workflows/pr-merge.yml index 0b23220d47..697f83ffc7 100644 --- a/.github/workflows/pr-merge.yml +++ b/.github/workflows/pr-merge.yml @@ -24,8 +24,8 @@ jobs: is_major=$(echo "$proposed_version_impact" | grep -qi '\[X\] Major'; echo $?) is_minor=$(echo "$proposed_version_impact" | grep -qi '\[X\] Minor'; echo $?) is_patch=$(echo "$proposed_version_impact" | grep -qi '\[X\] Patch'; echo $?) - echo "sum=$(($is_major + $is_minor + $is_patch))" >> $GITHUB_OUTPUT - echo "sum: $sum" + sum=$(($is_major + $is_minor + $is_patch)) + echo "$sum" >> $GITHUB_OUTPUT if [[ "$sum" -eq 3 ]]; then echo "3" echo "message=$(echo "@${MERGE_AUTHOR} Each PR must have a SEMVER impact label, please label the PR properly.")" >> $GITHUB_OUTPUT From b2e0e9201d9e169242de5f0cfd6bc42321d48c5d Mon Sep 17 00:00:00 2001 From: KevinEyo1 Date: Wed, 20 Mar 2024 00:41:26 +0800 Subject: [PATCH 18/27] Fix bug --- .github/workflows/pr-merge.yml | 8 +++++--- delete.json | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr-merge.yml b/.github/workflows/pr-merge.yml index 697f83ffc7..43cc8bea99 100644 --- a/.github/workflows/pr-merge.yml +++ b/.github/workflows/pr-merge.yml @@ -25,12 +25,12 @@ jobs: is_minor=$(echo "$proposed_version_impact" | grep -qi '\[X\] Minor'; echo $?) is_patch=$(echo "$proposed_version_impact" | grep -qi '\[X\] Patch'; echo $?) sum=$(($is_major + $is_minor + $is_patch)) - echo "$sum" >> $GITHUB_OUTPUT + echo "sum=$sum" >> $GITHUB_OUTPUT if [[ "$sum" -eq 3 ]]; then - echo "3" + echo "3 here" echo "message=$(echo "@${MERGE_AUTHOR} Each PR must have a SEMVER impact label, please label the PR properly.")" >> $GITHUB_OUTPUT elif [[ "$sum" -le 1 ]]; then - echo "1" + echo "1 here" echo "message=$(echo "@${MERGE_AUTHOR} Each PR can only have one SEMVER impact label, please label the PR properly.")" >> $GITHUB_OUTPUT else echo "message=$(echo "SEMVER impact selected.")" >> $GITHUB_OUTPUT @@ -53,6 +53,8 @@ jobs: uses: actions/github-script@v7 with: script: | + echo $SUM + echo $MESSAGE if (process.env.SUM != 2) { github.rest.issues.createComment({ issue_number: context.payload.pull_request.number, diff --git a/delete.json b/delete.json index 617018c834..60c6982522 100644 --- a/delete.json +++ b/delete.json @@ -1 +1 @@ -{"pull_request": {"body": "**What is the purpose of this pull request?**\n\n- [ ] Documentation update\n- [ ] Bug fix\n- [ ] Feature addition or enhancement\n- [ ] Code maintenance\n- [ ] DevOps\n- [ ] Improve developer experience\n- [ ] Others, please explain:\n\n\n\n**Overview of changes:**\n\n\n**Anything you'd like to highlight/discuss:**\n\n\n**Testing instructions:**\n\n\n\n**Proposed commit message: (wrap lines at 72 characters)**\n\n\n\n---\n\n**Checklist:** :ballot_box_with_check:\n\n\n\n- [ ] Updated the documentation for feature additions and enhancements\n- [ ] Added tests for bug fixes or features\n- [ ] Linked all related issues\n- [ ] No unrelated changes \n\n\n\n---\n\n**Reviewer checklist:**\n\nIndicate the [SEMVER](https://semver.org/) impact of the PR:\n- [X] Major (when you make incompatible API changes)\n- [ ] Minor (when you add functionality in a backward compatible manner)\n- [ ] Patch (when you make backward compatible bug fixes)\n\nAt the end of the review, please label the PR with the appropriate label: `r.Major`, `r.Minor`, `r.Patch`.\n\nBreaking change release note preparation (if applicable):\n- To be included in the release note for any feature that is made obsolete/breaking\n\n> Give a brief explanation note about:\n> - what was the old feature that was made obsolete\n> - any replacement feature (if any), and\n> - how the author should modify his website to migrate from the old feature to the replacement feature (if possible).\n", "base": {"ref": "master"}, "merged": true}} \ No newline at end of file +{"pull_request": {"body": "**What is the purpose of this pull request?**\n\n- [ ] Documentation update\n- [ ] Bug fix\n- [ ] Feature addition or enhancement\n- [ ] Code maintenance\n- [ ] DevOps\n- [ ] Improve developer experience\n- [ ] Others, please explain:\n\n\n\n**Overview of changes:**\n\n\n**Anything you'd like to highlight/discuss:**\n\n\n**Testing instructions:**\n\n\n\n**Proposed commit message: (wrap lines at 72 characters)**\n\n\n\n---\n\n**Checklist:** :ballot_box_with_check:\n\n\n\n- [ ] Updated the documentation for feature additions and enhancements\n- [ ] Added tests for bug fixes or features\n- [ ] Linked all related issues\n- [ ] No unrelated changes \n\n\n\n---\n\n**Reviewer checklist:**\n\nIndicate the [SEMVER](https://semver.org/) impact of the PR:\n- [ ] Major (when you make incompatible API changes)\n- [ ] Minor (when you add functionality in a backward compatible manner)\n- [ ] Patch (when you make backward compatible bug fixes)\n\nAt the end of the review, please label the PR with the appropriate label: `r.Major`, `r.Minor`, `r.Patch`.\n\nBreaking change release note preparation (if applicable):\n- To be included in the release note for any feature that is made obsolete/breaking\n\n> Give a brief explanation note about:\n> - what was the old feature that was made obsolete\n> - any replacement feature (if any), and\n> - how the author should modify his website to migrate from the old feature to the replacement feature (if possible).\n", "base": {"ref": "master"}, "merged": true}} \ No newline at end of file From 726cde549b48f0384f8d64d01aac5e41a5405613 Mon Sep 17 00:00:00 2001 From: KevinEyo1 Date: Wed, 20 Mar 2024 00:49:03 +0800 Subject: [PATCH 19/27] Delete line --- .github/workflows/pr-merge.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/pr-merge.yml b/.github/workflows/pr-merge.yml index 43cc8bea99..685f4afc09 100644 --- a/.github/workflows/pr-merge.yml +++ b/.github/workflows/pr-merge.yml @@ -53,8 +53,6 @@ jobs: uses: actions/github-script@v7 with: script: | - echo $SUM - echo $MESSAGE if (process.env.SUM != 2) { github.rest.issues.createComment({ issue_number: context.payload.pull_request.number, From 5888f5fbbaef091710efd047a36c8b1092c81e2e Mon Sep 17 00:00:00 2001 From: KevinEyo1 Date: Wed, 20 Mar 2024 01:18:16 +0800 Subject: [PATCH 20/27] Clean code --- .github/workflows/pr-merge.yml | 4 ++-- delete.json | 1 - delete.py | 28 ---------------------------- 3 files changed, 2 insertions(+), 31 deletions(-) delete mode 100644 delete.json delete mode 100644 delete.py diff --git a/.github/workflows/pr-merge.yml b/.github/workflows/pr-merge.yml index 685f4afc09..54d56f79f3 100644 --- a/.github/workflows/pr-merge.yml +++ b/.github/workflows/pr-merge.yml @@ -28,10 +28,10 @@ jobs: echo "sum=$sum" >> $GITHUB_OUTPUT if [[ "$sum" -eq 3 ]]; then echo "3 here" - echo "message=$(echo "@${MERGE_AUTHOR} Each PR must have a SEMVER impact label, please label the PR properly.")" >> $GITHUB_OUTPUT + echo "message=$(echo "@${MERGE_AUTHOR} Each PR must have a SEMVER impact label, remember to label the PR properly.")" >> $GITHUB_OUTPUT elif [[ "$sum" -le 1 ]]; then echo "1 here" - echo "message=$(echo "@${MERGE_AUTHOR} Each PR can only have one SEMVER impact label, please label the PR properly.")" >> $GITHUB_OUTPUT + echo "message=$(echo "@${MERGE_AUTHOR} Each PR can only have one SEMVER impact label, remember to label the PR properly.")" >> $GITHUB_OUTPUT else echo "message=$(echo "SEMVER impact selected.")" >> $GITHUB_OUTPUT echo "chosen_label=$( diff --git a/delete.json b/delete.json deleted file mode 100644 index 60c6982522..0000000000 --- a/delete.json +++ /dev/null @@ -1 +0,0 @@ -{"pull_request": {"body": "**What is the purpose of this pull request?**\n\n- [ ] Documentation update\n- [ ] Bug fix\n- [ ] Feature addition or enhancement\n- [ ] Code maintenance\n- [ ] DevOps\n- [ ] Improve developer experience\n- [ ] Others, please explain:\n\n\n\n**Overview of changes:**\n\n\n**Anything you'd like to highlight/discuss:**\n\n\n**Testing instructions:**\n\n\n\n**Proposed commit message: (wrap lines at 72 characters)**\n\n\n\n---\n\n**Checklist:** :ballot_box_with_check:\n\n\n\n- [ ] Updated the documentation for feature additions and enhancements\n- [ ] Added tests for bug fixes or features\n- [ ] Linked all related issues\n- [ ] No unrelated changes \n\n\n\n---\n\n**Reviewer checklist:**\n\nIndicate the [SEMVER](https://semver.org/) impact of the PR:\n- [ ] Major (when you make incompatible API changes)\n- [ ] Minor (when you add functionality in a backward compatible manner)\n- [ ] Patch (when you make backward compatible bug fixes)\n\nAt the end of the review, please label the PR with the appropriate label: `r.Major`, `r.Minor`, `r.Patch`.\n\nBreaking change release note preparation (if applicable):\n- To be included in the release note for any feature that is made obsolete/breaking\n\n> Give a brief explanation note about:\n> - what was the old feature that was made obsolete\n> - any replacement feature (if any), and\n> - how the author should modify his website to migrate from the old feature to the replacement feature (if possible).\n", "base": {"ref": "master"}, "merged": true}} \ No newline at end of file diff --git a/delete.py b/delete.py deleted file mode 100644 index 9f22a81373..0000000000 --- a/delete.py +++ /dev/null @@ -1,28 +0,0 @@ -import json - -# Path to your markdown file -markdown_file_path = '.github/PULL_REQUEST_TEMPLATE' - -# Read the markdown file content -with open(markdown_file_path, 'r', encoding='utf-8') as file: - markdown_content = file.read() - -# Convert markdown content to JSON format -json_payload = { - "pull_request": { - "body": markdown_content, - "base": { - "ref": "master" - }, - "merged": True - } -} - -# Convert Python dictionary to JSON string -json_string = json.dumps(json_payload, ensure_ascii=False) - -# Output or save the JSON string as needed -# print(json_string) -#save to delete.json -with open('delete.json', 'w', encoding='utf-8') as file: - file.write(json_string) \ No newline at end of file From b323f32bdd4825dd1a456095c584ef0a52a259bc Mon Sep 17 00:00:00 2001 From: KevinEyo1 Date: Thu, 21 Mar 2024 15:25:09 +0800 Subject: [PATCH 21/27] Clean code --- .github/workflows/pr-merge.yml | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/.github/workflows/pr-merge.yml b/.github/workflows/pr-merge.yml index 54d56f79f3..edf9dbc943 100644 --- a/.github/workflows/pr-merge.yml +++ b/.github/workflows/pr-merge.yml @@ -10,7 +10,7 @@ concurrency: jobs: check-pr-label: - if: ${{ github.event.pull_request.merged == true }} + if: ${{ github.event.pull_request.merged }} runs-on: ubuntu-latest steps: @@ -21,25 +21,23 @@ jobs: python scripts/process_message.py "${TEXT_BODY}" > processed_body.txt processed_body=$(cat processed_body.txt) proposed_version_impact=$(echo "$processed_body" | awk '/Major \\\(when you make incompatible API changes\\\)/,/Patch \\\(when you make backward compatible bug fixes\\\)/') - is_major=$(echo "$proposed_version_impact" | grep -qi '\[X\] Major'; echo $?) - is_minor=$(echo "$proposed_version_impact" | grep -qi '\[X\] Minor'; echo $?) - is_patch=$(echo "$proposed_version_impact" | grep -qi '\[X\] Patch'; echo $?) + is_major=$(echo "$proposed_version_impact" | grep -qi '\[X\] Major'; echo $((1-$?))) + is_minor=$(echo "$proposed_version_impact" | grep -qi '\[X\] Minor'; echo $((1-$?))) + is_patch=$(echo "$proposed_version_impact" | grep -qi '\[X\] Patch'; echo $((1-$?))) sum=$(($is_major + $is_minor + $is_patch)) echo "sum=$sum" >> $GITHUB_OUTPUT - if [[ "$sum" -eq 3 ]]; then - echo "3 here" + if [[ "$sum" -eq 0 ]]; then echo "message=$(echo "@${MERGE_AUTHOR} Each PR must have a SEMVER impact label, remember to label the PR properly.")" >> $GITHUB_OUTPUT - elif [[ "$sum" -le 1 ]]; then - echo "1 here" + elif [[ "$sum" -ge 2 ]]; then echo "message=$(echo "@${MERGE_AUTHOR} Each PR can only have one SEMVER impact label, remember to label the PR properly.")" >> $GITHUB_OUTPUT else echo "message=$(echo "SEMVER impact selected.")" >> $GITHUB_OUTPUT echo "chosen_label=$( - if [ "$is_major" -eq 0 ]; then + if [ "$is_major" -eq 1 ]; then echo "r.Major" - elif [ "$is_minor" -eq 0 ]; then + elif [ "$is_minor" -eq 1 ]; then echo "r.Minor" - elif [ "$is_patch" -eq 0 ]; then + elif [ "$is_patch" -eq 1 ]; then echo "r.Patch" fi )" >> $GITHUB_OUTPUT @@ -53,7 +51,7 @@ jobs: uses: actions/github-script@v7 with: script: | - if (process.env.SUM != 2) { + if (process.env.SUM != 1) { github.rest.issues.createComment({ issue_number: context.payload.pull_request.number, owner: context.repo.owner, From d54702b50755206deb6efdd50e5bf77d3da4c178 Mon Sep 17 00:00:00 2001 From: KevinEyo1 Date: Thu, 21 Mar 2024 16:22:02 +0800 Subject: [PATCH 22/27] Fix nits --- .github/workflows/pr-merge.yml | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/.github/workflows/pr-merge.yml b/.github/workflows/pr-merge.yml index edf9dbc943..561284a165 100644 --- a/.github/workflows/pr-merge.yml +++ b/.github/workflows/pr-merge.yml @@ -12,7 +12,6 @@ jobs: check-pr-label: if: ${{ github.event.pull_request.merged }} runs-on: ubuntu-latest - steps: - uses: actions/checkout@v3 - name: Check for PR description label @@ -24,12 +23,12 @@ jobs: is_major=$(echo "$proposed_version_impact" | grep -qi '\[X\] Major'; echo $((1-$?))) is_minor=$(echo "$proposed_version_impact" | grep -qi '\[X\] Minor'; echo $((1-$?))) is_patch=$(echo "$proposed_version_impact" | grep -qi '\[X\] Patch'; echo $((1-$?))) - sum=$(($is_major + $is_minor + $is_patch)) - echo "sum=$sum" >> $GITHUB_OUTPUT - if [[ "$sum" -eq 0 ]]; then - echo "message=$(echo "@${MERGE_AUTHOR} Each PR must have a SEMVER impact label, remember to label the PR properly.")" >> $GITHUB_OUTPUT - elif [[ "$sum" -ge 2 ]]; then - echo "message=$(echo "@${MERGE_AUTHOR} Each PR can only have one SEMVER impact label, remember to label the PR properly.")" >> $GITHUB_OUTPUT + num_labels_chosen=$(($is_major + $is_minor + $is_patch)) + echo "num_labels_chosen=$num_labels_chosen" >> $GITHUB_OUTPUT + if [[ "$num_labels_chosen" -eq 0 ]]; then + echo "message=$(echo "@${MERGE_AUTHOR} Each PR must have a SEMVER impact label, please remember to label the PR properly.")" >> $GITHUB_OUTPUT + elif [[ "$num_labels_chosen" -ge 2 ]]; then + echo "message=$(echo "@${MERGE_AUTHOR} Each PR can only have one SEMVER impact label, please remember to label the PR properly.")" >> $GITHUB_OUTPUT else echo "message=$(echo "SEMVER impact selected.")" >> $GITHUB_OUTPUT echo "chosen_label=$( @@ -42,16 +41,14 @@ jobs: fi )" >> $GITHUB_OUTPUT fi - env: TEXT_BODY: ${{ github.event.pull_request.body }} MERGE_AUTHOR: ${{ github.event.pull_request.merged_by.login }} - - name: Assign label based on version impact uses: actions/github-script@v7 with: script: | - if (process.env.SUM != 1) { + if (process.env.NUM_LABELS_CHOSEN != 1) { github.rest.issues.createComment({ issue_number: context.payload.pull_request.number, owner: context.repo.owner, @@ -67,9 +64,6 @@ jobs: }); } env: - SUM: ${{ steps.check_pr_description_label.outputs.sum }} + NUM_LABELS_CHOSEN: ${{ steps.check_pr_description_label.outputs.num_labels_chosen }} MESSAGE: ${{ steps.check_pr_description_label.outputs.message }} CHOSEN_LABEL: ${{ steps.check_pr_description_label.outputs.chosen_label }} - - - \ No newline at end of file From f0ca80bcb1c8a79df20b322434657211271cb5a3 Mon Sep 17 00:00:00 2001 From: KevinEyo1 Date: Mon, 25 Mar 2024 15:16:35 +0800 Subject: [PATCH 23/27] Change to on approve --- .github/workflows/pr-merge.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pr-merge.yml b/.github/workflows/pr-merge.yml index 561284a165..8393d0f8e5 100644 --- a/.github/workflows/pr-merge.yml +++ b/.github/workflows/pr-merge.yml @@ -1,8 +1,8 @@ -name: PR Merge +name: Pull Request Review Action on: - pull_request: + pull_request_review: types: - - closed + - submitted concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} @@ -10,7 +10,7 @@ concurrency: jobs: check-pr-label: - if: ${{ github.event.pull_request.merged }} + if: ${{ github.event.review.state == 'approved' }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -43,7 +43,7 @@ jobs: fi env: TEXT_BODY: ${{ github.event.pull_request.body }} - MERGE_AUTHOR: ${{ github.event.pull_request.merged_by.login }} + MERGE_AUTHOR: ${{ github.event.sender.login }} - name: Assign label based on version impact uses: actions/github-script@v7 with: From 6ed4472a652a1eb7f6313ecb56eebac1ff114f28 Mon Sep 17 00:00:00 2001 From: KevinEyo1 Date: Tue, 26 Mar 2024 12:36:12 +0800 Subject: [PATCH 24/27] Add permission to write --- .github/workflows/pr-merge.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pr-merge.yml b/.github/workflows/pr-merge.yml index 8393d0f8e5..3821c01267 100644 --- a/.github/workflows/pr-merge.yml +++ b/.github/workflows/pr-merge.yml @@ -10,6 +10,8 @@ concurrency: jobs: check-pr-label: + permissions: + issues: write if: ${{ github.event.review.state == 'approved' }} runs-on: ubuntu-latest steps: From e445596628ec613b54b7012c538ebe3b9b2cd57d Mon Sep 17 00:00:00 2001 From: KevinEyo1 Date: Tue, 26 Mar 2024 12:40:00 +0800 Subject: [PATCH 25/27] Change permission --- .github/workflows/pr-merge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-merge.yml b/.github/workflows/pr-merge.yml index 3821c01267..7030ce3c5e 100644 --- a/.github/workflows/pr-merge.yml +++ b/.github/workflows/pr-merge.yml @@ -11,7 +11,7 @@ concurrency: jobs: check-pr-label: permissions: - issues: write + pull-requests: write if: ${{ github.event.review.state == 'approved' }} runs-on: ubuntu-latest steps: From 988000e15d591aca3d95801f2cd26bbcbcbe4da4 Mon Sep 17 00:00:00 2001 From: KevinEyo1 Date: Tue, 26 Mar 2024 13:31:09 +0800 Subject: [PATCH 26/27] Change back to issue permission --- .github/workflows/pr-merge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-merge.yml b/.github/workflows/pr-merge.yml index 7030ce3c5e..3821c01267 100644 --- a/.github/workflows/pr-merge.yml +++ b/.github/workflows/pr-merge.yml @@ -11,7 +11,7 @@ concurrency: jobs: check-pr-label: permissions: - pull-requests: write + issues: write if: ${{ github.event.review.state == 'approved' }} runs-on: ubuntu-latest steps: From 60429c9dc80d1451977c22fe986fa3aae91273be Mon Sep 17 00:00:00 2001 From: KevinEyo1 Date: Wed, 27 Mar 2024 15:52:24 +0800 Subject: [PATCH 27/27] Revert to on merged --- .github/workflows/pr-merge.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pr-merge.yml b/.github/workflows/pr-merge.yml index 3821c01267..8e5a27ce35 100644 --- a/.github/workflows/pr-merge.yml +++ b/.github/workflows/pr-merge.yml @@ -1,8 +1,8 @@ name: Pull Request Review Action on: - pull_request_review: + pull_request_target: types: - - submitted + - closed concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} @@ -10,9 +10,7 @@ concurrency: jobs: check-pr-label: - permissions: - issues: write - if: ${{ github.event.review.state == 'approved' }} + if: ${{ github.event.pull_request.merged }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v3