Skip to content

Commit d3ae151

Browse files
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: Andy Scherzinger <info@andy-scherzinger.de> Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
1 parent 8d479b4 commit d3ae151

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

.github/workflows/ai-policy.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
- name: Collect PR commit messages
3333
id: collect
3434
env:
35-
GH_TOKEN: ${{ github.token }}
35+
GH_TOKEN: ${{ secrets.COMMAND_BOT_PAT }}
3636
COMMITS_URL: ${{ github.event.pull_request.commits_url }}
3737
run: |
3838
set -euo pipefail
@@ -125,7 +125,7 @@ jobs:
125125
- name: Create 'AI assisted' label if absent
126126
if: steps.ai_trailers.outputs.ai_assisted == 'true' || steps.agent_signoff.outputs.agent_signoff == 'true' || steps.co_authored.outputs.co_authored == 'true'
127127
env:
128-
GH_TOKEN: ${{ github.token }}
128+
GH_TOKEN: ${{ secrets.COMMAND_BOT_PAT }}
129129
run: |
130130
gh api "repos/${{ github.repository }}/labels" \
131131
--method POST \
@@ -137,11 +137,11 @@ jobs:
137137
- name: Label PR as AI assisted
138138
if: steps.ai_trailers.outputs.ai_assisted == 'true' || steps.agent_signoff.outputs.agent_signoff == 'true' || steps.co_authored.outputs.co_authored == 'true'
139139
env:
140-
GH_TOKEN: ${{ github.token }}
140+
GH_TOKEN: ${{ secrets.COMMAND_BOT_PAT }}
141141
run: |
142-
gh pr edit "${{ github.event.pull_request.number }}" \
143-
--repo "${{ github.repository }}" \
144-
--add-label "AI assisted"
142+
gh api "repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels" \
143+
--method POST \
144+
-f "labels[]=AI assisted"
145145
echo "Added 'AI assisted' label to PR #${{ github.event.pull_request.number }}"
146146
147147
- name: Fail on coding-agent Signed-off-by

workflow-templates/ai-policy.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,9 @@ jobs:
139139
env:
140140
GH_TOKEN: ${{ secrets.COMMAND_BOT_PAT }}
141141
run: |
142-
gh pr edit "${{ github.event.pull_request.number }}" \
143-
--repo "${{ github.repository }}" \
144-
--add-label "AI assisted"
142+
gh api "repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels" \
143+
--method POST \
144+
-f "labels[]=AI assisted"
145145
echo "Added 'AI assisted' label to PR #${{ github.event.pull_request.number }}"
146146
147147
- name: Fail on coding-agent Signed-off-by

0 commit comments

Comments
 (0)