From 03f54643fd48fe8ff9e054f1d93ec33ddc6eeab2 Mon Sep 17 00:00:00 2001 From: Yiya Chen Date: Wed, 2 Jul 2025 14:46:03 +0800 Subject: [PATCH] ci: remove action-add-labels (#368) * ci: remove action-add-labels * ci: use gh cli * ci: use pull_request_target * ci: add ref --------- Signed-off-by: Yi-Ya Chen --- .github/workflows/backport-label.yaml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/backport-label.yaml b/.github/workflows/backport-label.yaml index ff0df575..795df5b8 100644 --- a/.github/workflows/backport-label.yaml +++ b/.github/workflows/backport-label.yaml @@ -1,7 +1,7 @@ name: "[PR Management] Add Backport Label" on: - pull_request: + pull_request_target: types: [opened, reopened] branches: [main] @@ -14,6 +14,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 + with: + ref: ${{ github.base_ref }} - name: Fetch release branches and PR labels id: fetch_info @@ -52,7 +54,10 @@ jobs: - name: Add backport label if needed if: steps.fetch_info.outputs.should_label == 'true' && !contains(steps.fetch_info.outputs.pr_labels, steps.fetch_info.outputs.backport_label) - uses: actions-ecosystem/action-add-labels@v1 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - labels: ${{ steps.fetch_info.outputs.backport_label }} + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + echo "Adding label: ${{ steps.fetch_info.outputs.backport_label }}" + gh pr edit ${{ github.event.pull_request.number }} \ + --repo ${{ github.repository }} \ + --add-label "${{ steps.fetch_info.outputs.backport_label }}"