From 8c92e54219f42660bfd0254200eed6c22ae65c7b Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Fri, 3 Jul 2026 19:01:26 +0200 Subject: [PATCH] ci: Add lables via rest api gh pr edit --add-label runs a GraphQL query that also fetches org/login fields requiring `read:org`, which COMMAND_BOT_PAT doesn't have. The REST labels endpoint only needs `public_repo`, matching the label-creation step already using REST above it. Assisted-by: Claude:claude-sonnet-5 Co-authored-by: Daniel Kesselberg Signed-off-by: Andy Scherzinger --- .github/workflows/ai-policy.yml | 12 ++++++------ workflow-templates/ai-policy.yml | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ai-policy.yml b/.github/workflows/ai-policy.yml index 4ddfe347..e5c8d7d6 100644 --- a/.github/workflows/ai-policy.yml +++ b/.github/workflows/ai-policy.yml @@ -32,7 +32,7 @@ jobs: - name: Collect PR commit messages id: collect env: - GH_TOKEN: ${{ github.token }} + GH_TOKEN: ${{ secrets.COMMAND_BOT_PAT }} COMMITS_URL: ${{ github.event.pull_request.commits_url }} run: | set -euo pipefail @@ -125,7 +125,7 @@ jobs: - name: Create 'AI assisted' label if absent if: steps.ai_trailers.outputs.ai_assisted == 'true' || steps.agent_signoff.outputs.agent_signoff == 'true' || steps.co_authored.outputs.co_authored == 'true' env: - GH_TOKEN: ${{ github.token }} + GH_TOKEN: ${{ secrets.COMMAND_BOT_PAT }} run: | gh api "repos/${{ github.repository }}/labels" \ --method POST \ @@ -137,11 +137,11 @@ jobs: - name: Label PR as AI assisted if: steps.ai_trailers.outputs.ai_assisted == 'true' || steps.agent_signoff.outputs.agent_signoff == 'true' || steps.co_authored.outputs.co_authored == 'true' env: - GH_TOKEN: ${{ github.token }} + GH_TOKEN: ${{ secrets.COMMAND_BOT_PAT }} run: | - gh pr edit "${{ github.event.pull_request.number }}" \ - --repo "${{ github.repository }}" \ - --add-label "AI assisted" + gh api "repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels" \ + --method POST \ + -f "labels[]=AI assisted" echo "Added 'AI assisted' label to PR #${{ github.event.pull_request.number }}" - name: Fail on coding-agent Signed-off-by diff --git a/workflow-templates/ai-policy.yml b/workflow-templates/ai-policy.yml index acc8d30b..e5c8d7d6 100644 --- a/workflow-templates/ai-policy.yml +++ b/workflow-templates/ai-policy.yml @@ -139,9 +139,9 @@ jobs: env: GH_TOKEN: ${{ secrets.COMMAND_BOT_PAT }} run: | - gh pr edit "${{ github.event.pull_request.number }}" \ - --repo "${{ github.repository }}" \ - --add-label "AI assisted" + gh api "repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels" \ + --method POST \ + -f "labels[]=AI assisted" echo "Added 'AI assisted' label to PR #${{ github.event.pull_request.number }}" - name: Fail on coding-agent Signed-off-by