diff --git a/.github/workflows/pr-labeled.yml b/.github/workflows/pr-labeled.yml index 4b4c9c74211a..1120d6e53875 100644 --- a/.github/workflows/pr-labeled.yml +++ b/.github/workflows/pr-labeled.yml @@ -4,12 +4,15 @@ env: GH_TOKEN: ${{ github.token }} PR: ${{ github.event.pull_request.html_url }} on: - pull_request: + pull_request_target: types: - labeled jobs: process_labels: runs-on: ubuntu-latest + permissions: + pull-requests: write + contents: read steps: - uses: actions/checkout@v3 with: diff --git a/.github/workflows/script/PrLabeled.ps1 b/.github/workflows/script/PrLabeled.ps1 index 68fd8b1c8d86..6fdb69d8f04c 100644 --- a/.github/workflows/script/PrLabeled.ps1 +++ b/.github/workflows/script/PrLabeled.ps1 @@ -60,6 +60,11 @@ if ($CommentDict.ContainsKey($LabelName)) { Write-Host "Comment is already added" } else { - gh pr comment $PrUrl --body $comment + try { + gh pr comment $PrUrl --body $comment + } + catch { + Write-Host "Failed to add comment: $_" + } } } \ No newline at end of file