Skip to content

Commit 8c6b162

Browse files
authored
Merge pull request #574 from koxudaxi/fix-release-draft-rest-labels
Use REST API for release draft labels
2 parents 220ed5b + 0cc8667 commit 8c6b162

1 file changed

Lines changed: 22 additions & 9 deletions

File tree

.github/workflows/release-draft.yml

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -147,18 +147,24 @@ jobs:
147147
env:
148148
GH_TOKEN: ${{ github.token }}
149149
run: |
150-
gh issue edit ${{ github.event.pull_request.number }} \
151-
--repo "$GITHUB_REPOSITORY" \
152-
--add-label "breaking-change-analyzed"
150+
gh api \
151+
--method POST \
152+
-H "Accept: application/vnd.github+json" \
153+
"/repos/$GITHUB_REPOSITORY/issues/${{ github.event.pull_request.number }}/labels" \
154+
-f labels[]="breaking-change-analyzed" \
155+
--silent
153156
154157
- name: Add breaking-change label if applicable
155158
if: steps.analysis.outputs.has_breaking_changes == 'true'
156159
env:
157160
GH_TOKEN: ${{ github.token }}
158161
run: |
159-
gh issue edit ${{ github.event.pull_request.number }} \
160-
--repo "$GITHUB_REPOSITORY" \
161-
--add-label "breaking-change"
162+
gh api \
163+
--method POST \
164+
-H "Accept: application/vnd.github+json" \
165+
"/repos/$GITHUB_REPOSITORY/issues/${{ github.event.pull_request.number }}/labels" \
166+
-f labels[]="breaking-change" \
167+
--silent
162168
163169
- name: Post analysis result to PR
164170
env:
@@ -186,9 +192,16 @@ jobs:
186192
printf '*This analysis was performed by Claude Code Action*\n'
187193
} > "$TMPFILE"
188194
189-
gh issue comment ${{ github.event.pull_request.number }} \
190-
--repo "$GITHUB_REPOSITORY" \
191-
--body-file "$TMPFILE"
195+
TMPJSON=$(mktemp)
196+
trap 'rm -f "$TMPFILE" "$TMPJSON"' EXIT
197+
jq -n --rawfile body "$TMPFILE" '{body: $body}' > "$TMPJSON"
198+
199+
gh api \
200+
--method POST \
201+
-H "Accept: application/vnd.github+json" \
202+
"/repos/$GITHUB_REPOSITORY/issues/${{ github.event.pull_request.number }}/comments" \
203+
--input "$TMPJSON" \
204+
--silent
192205
193206
- name: Calculate version and update draft release
194207
env:

0 commit comments

Comments
 (0)