From 2c934632a4f733e3cbac2f81bc0838a301ce4abe Mon Sep 17 00:00:00 2001 From: huxiyang3 <1872591453@qq.com> Date: Fri, 1 Nov 2024 16:23:15 +0800 Subject: [PATCH 01/16] chore: use pull request target event --- .github/workflows/ci.yml | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c1fb91f829..20ac306307 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,23 +12,28 @@ on: workflow_dispatch: jobs: - label: + add-label: runs-on: ubuntu-latest steps: - - name: Check out the repository - uses: actions/checkout@v4 + - name: Checkout repository + uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.ref }} + repository: ${{ github.event.pull_request.head.repo.full_name }} - - name: Determine label - id: determine_label + - name: Determine label based on target branch + id: determine-label run: | if [[ "${{ github.event.pull_request.base.ref }}" == "next" ]]; then echo "label=2.x" >> $GITHUB_ENV elif [[ "${{ github.event.pull_request.base.ref }}" == "V3.0" ]]; then echo "label=3.x" >> $GITHUB_ENV + else + echo "label=none" >> $GITHUB_ENV fi - - name: Add label to PR + - name: Add label to Pull Request uses: actions-ecosystem/action-add-labels@v1 with: github_token: ${{ secrets.GITHUB_TOKEN }} From a59ebff8df0e57fd0250469f4d86b006d602777a Mon Sep 17 00:00:00 2001 From: huxiyang3 <1872591453@qq.com> Date: Fri, 1 Nov 2024 16:26:36 +0800 Subject: [PATCH 02/16] chore: use pull request target event --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 20ac306307..280be87324 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,6 +10,7 @@ on: - next workflow_dispatch: + pull_request_target: jobs: add-label: From 0dd38744a4f834d9bcb5756171d87eec78733f7c Mon Sep 17 00:00:00 2001 From: huxiyang3 <1872591453@qq.com> Date: Fri, 1 Nov 2024 16:29:29 +0800 Subject: [PATCH 03/16] chore: use pull request target event --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 280be87324..2346b0e600 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,7 +37,7 @@ jobs: - name: Add label to Pull Request uses: actions-ecosystem/action-add-labels@v1 with: - github_token: ${{ secrets.GITHUB_TOKEN }} + github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} labels: ${{ env.label }} lint: runs-on: ubuntu-latest From 6689ea3c1d112429dddcb355e7d355c343f0335a Mon Sep 17 00:00:00 2001 From: huxiyang3 <1872591453@qq.com> Date: Fri, 1 Nov 2024 16:34:08 +0800 Subject: [PATCH 04/16] chore: use pull request target event --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2346b0e600..7fa3829d3b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.ref }} repository: ${{ github.event.pull_request.head.repo.full_name }} From a6ab8dfd36184b3efffd99cf21da4280e3cd420e Mon Sep 17 00:00:00 2001 From: huxiyang3 <1872591453@qq.com> Date: Fri, 1 Nov 2024 16:34:54 +0800 Subject: [PATCH 05/16] chore: use pull request target event --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7fa3829d3b..93d44b6eab 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,7 +37,7 @@ jobs: - name: Add label to Pull Request uses: actions-ecosystem/action-add-labels@v1 with: - github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} + github_token: ${{ secrets.GITHUB_TOKEN }} labels: ${{ env.label }} lint: runs-on: ubuntu-latest From e463e5ebad2c1ad4f8b393f03c36b4b48554a5b9 Mon Sep 17 00:00:00 2001 From: huxiyang3 <1872591453@qq.com> Date: Fri, 1 Nov 2024 16:41:25 +0800 Subject: [PATCH 06/16] chore: use pull request target event --- .github/workflows/ci.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 93d44b6eab..55a6a945a1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,13 +4,17 @@ on: push: branches: - next - + - V3.0 pull_request: branches: - next + - V3.0 + pull_request_target: + branches: + - next + - V3.0 workflow_dispatch: - pull_request_target: jobs: add-label: From f534e5341f7560404e9cd3c06910c321f3f00f10 Mon Sep 17 00:00:00 2001 From: huxiyang3 <1872591453@qq.com> Date: Fri, 1 Nov 2024 18:20:43 +0800 Subject: [PATCH 07/16] chore: ci test --- .github/workflows/ci.yml | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 55a6a945a1..e50bfcb19e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,10 +10,7 @@ on: - next - V3.0 pull_request_target: - branches: - - next - - V3.0 - + types: [opened, synchronize, reopened] workflow_dispatch: jobs: @@ -21,11 +18,8 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout repository + - name: Check out repository uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.ref }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - name: Determine label based on target branch id: determine-label @@ -35,13 +29,14 @@ jobs: elif [[ "${{ github.event.pull_request.base.ref }}" == "V3.0" ]]; then echo "label=3.x" >> $GITHUB_ENV else - echo "label=none" >> $GITHUB_ENV + echo "label=" >> $GITHUB_ENV fi - name: Add label to Pull Request + if: env.label != '' uses: actions-ecosystem/action-add-labels@v1 with: - github_token: ${{ secrets.GITHUB_TOKEN }} + github_token: ${{ secrets.GITHUB_TOKEN }} labels: ${{ env.label }} lint: runs-on: ubuntu-latest From 5541d2c8ee001bb9da3f8043b7db28b56477b03d Mon Sep 17 00:00:00 2001 From: huxiyang3 <1872591453@qq.com> Date: Fri, 1 Nov 2024 18:22:54 +0800 Subject: [PATCH 08/16] chore: ci test --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e50bfcb19e..9a344294cc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,7 +36,7 @@ jobs: if: env.label != '' uses: actions-ecosystem/action-add-labels@v1 with: - github_token: ${{ secrets.GITHUB_TOKEN }} + github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} labels: ${{ env.label }} lint: runs-on: ubuntu-latest From 43994be1dc8b1bf804373f767a245d3f773807ca Mon Sep 17 00:00:00 2001 From: huxiyang3 <1872591453@qq.com> Date: Fri, 1 Nov 2024 18:30:15 +0800 Subject: [PATCH 09/16] chore: ci test --- .github/workflows/ci.yml | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9a344294cc..a26442832e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,29 +15,17 @@ on: jobs: add-label: + name: Add Label runs-on: ubuntu-latest - steps: - - name: Check out repository - uses: actions/checkout@v4 - - - name: Determine label based on target branch - id: determine-label - run: | - if [[ "${{ github.event.pull_request.base.ref }}" == "next" ]]; then - echo "label=2.x" >> $GITHUB_ENV - elif [[ "${{ github.event.pull_request.base.ref }}" == "V3.0" ]]; then - echo "label=3.x" >> $GITHUB_ENV - else - echo "label=" >> $GITHUB_ENV - fi - - - name: Add label to Pull Request - if: env.label != '' - uses: actions-ecosystem/action-add-labels@v1 + - uses: actions/checkout@v2 + - uses: christianvuerings/add-labels@v1 with: - github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} - labels: ${{ env.label }} + labels: | + minor release + bug + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} lint: runs-on: ubuntu-latest steps: From 5fc49ec568bb3ed57a47a05143e31ec763de9936 Mon Sep 17 00:00:00 2001 From: huxiyang3 <1872591453@qq.com> Date: Fri, 1 Nov 2024 18:31:44 +0800 Subject: [PATCH 10/16] chore: ci test --- .github/workflows/ci.yml | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a26442832e..e50bfcb19e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,17 +15,29 @@ on: jobs: add-label: - name: Add Label runs-on: ubuntu-latest + steps: - - uses: actions/checkout@v2 - - uses: christianvuerings/add-labels@v1 + - name: Check out repository + uses: actions/checkout@v4 + + - name: Determine label based on target branch + id: determine-label + run: | + if [[ "${{ github.event.pull_request.base.ref }}" == "next" ]]; then + echo "label=2.x" >> $GITHUB_ENV + elif [[ "${{ github.event.pull_request.base.ref }}" == "V3.0" ]]; then + echo "label=3.x" >> $GITHUB_ENV + else + echo "label=" >> $GITHUB_ENV + fi + + - name: Add label to Pull Request + if: env.label != '' + uses: actions-ecosystem/action-add-labels@v1 with: - labels: | - minor release - bug - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + github_token: ${{ secrets.GITHUB_TOKEN }} + labels: ${{ env.label }} lint: runs-on: ubuntu-latest steps: From 6d39b5d3143bfd3bb2f571d390a4efa0636c23aa Mon Sep 17 00:00:00 2001 From: huxiyang3 <1872591453@qq.com> Date: Fri, 1 Nov 2024 18:34:58 +0800 Subject: [PATCH 11/16] chore: ci test --- .github/workflows/ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e50bfcb19e..a15083ea9f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,6 +13,10 @@ on: types: [opened, synchronize, reopened] workflow_dispatch: +permissions: + contents: read + pull-requests: write + jobs: add-label: runs-on: ubuntu-latest From 0ae20d3b160f0aae26d018194a0803e9e7ec330c Mon Sep 17 00:00:00 2001 From: huxiyang3 <1872591453@qq.com> Date: Fri, 1 Nov 2024 18:48:49 +0800 Subject: [PATCH 12/16] chore: ci test --- .github/workflows/ci.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a15083ea9f..b78d55f8b9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,10 +13,8 @@ on: types: [opened, synchronize, reopened] workflow_dispatch: -permissions: - contents: read - pull-requests: write - +permissions: write-all + jobs: add-label: runs-on: ubuntu-latest From f05f54f68725e678ad393957e437af521fd1e092 Mon Sep 17 00:00:00 2001 From: huxiyang3 <1872591453@qq.com> Date: Fri, 1 Nov 2024 19:48:55 +0800 Subject: [PATCH 13/16] chore: ci test --- .github/workflows/ci.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b78d55f8b9..80b62f2fef 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,12 +5,8 @@ on: branches: - next - V3.0 - pull_request: - branches: - - next - - V3.0 pull_request_target: - types: [opened, synchronize, reopened] + types: [assigned, opened, synchronize, reopened] workflow_dispatch: permissions: write-all From 5816d7ad5c1e06cacabf1bdbe05daf44dec4bcad Mon Sep 17 00:00:00 2001 From: huxiyang3 <1872591453@qq.com> Date: Fri, 1 Nov 2024 19:54:30 +0800 Subject: [PATCH 14/16] chore: ci test --- .github/workflows/ci.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 80b62f2fef..cf4c88593a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,8 +5,12 @@ on: branches: - next - V3.0 + pull_request: + branches: + - next + - V3.0 pull_request_target: - types: [assigned, opened, synchronize, reopened] + types: [opened, synchronize, reopened] workflow_dispatch: permissions: write-all @@ -31,7 +35,7 @@ jobs: fi - name: Add label to Pull Request - if: env.label != '' + if: github.event_name == 'pull_request_target' && env.label != '' uses: actions-ecosystem/action-add-labels@v1 with: github_token: ${{ secrets.GITHUB_TOKEN }} From 7297370a23ae8608bc1111acf697b00d72210533 Mon Sep 17 00:00:00 2001 From: huxiyang3 <1872591453@qq.com> Date: Fri, 1 Nov 2024 19:59:40 +0800 Subject: [PATCH 15/16] chore: ci test --- .github/workflows/ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cf4c88593a..3f51a3e730 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,6 +33,12 @@ jobs: else echo "label=" >> $GITHUB_ENV fi + + - name: Debug event + run: echo "Event name is: ${{ github.event_name }}" + + - name: Debug label + run: echo "Label is: ${{ env.label }}" - name: Add label to Pull Request if: github.event_name == 'pull_request_target' && env.label != '' From 6686ca0718e6811b06acd7927853ab124df85f9e Mon Sep 17 00:00:00 2001 From: huxiyang3 <1872591453@qq.com> Date: Fri, 1 Nov 2024 20:02:08 +0800 Subject: [PATCH 16/16] chore: ci test --- .github/workflows/ci.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3f51a3e730..8e221f191f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,6 +26,7 @@ jobs: - name: Determine label based on target branch id: determine-label run: | + echo "${{github.event_name}}" if [[ "${{ github.event.pull_request.base.ref }}" == "next" ]]; then echo "label=2.x" >> $GITHUB_ENV elif [[ "${{ github.event.pull_request.base.ref }}" == "V3.0" ]]; then @@ -33,12 +34,6 @@ jobs: else echo "label=" >> $GITHUB_ENV fi - - - name: Debug event - run: echo "Event name is: ${{ github.event_name }}" - - - name: Debug label - run: echo "Label is: ${{ env.label }}" - name: Add label to Pull Request if: github.event_name == 'pull_request_target' && env.label != ''