Skip to content

Commit ee3e7a8

Browse files
committed
Use --jq to filter gh api response to only needed fields
Address review feedback: use gh's built-in --jq flag to extract only assignees, labels, and milestone from the API response, avoiding unnecessary processing of the full PR payload.
1 parent 8ff9dc6 commit ee3e7a8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

.github/workflows/pr-metadata-check.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,11 @@ jobs:
3939
4040
# Fetch live PR data to avoid stale event payload (race condition
4141
# when labels/milestone are added shortly after PR creation).
42-
PR_JSON=$(gh api "repos/${GH_REPO}/pulls/${PR_NUMBER}")
42+
PR_JSON=$(gh api "repos/${GH_REPO}/pulls/${PR_NUMBER}" \
43+
--jq '{assignees: .assignees, labels: .labels, milestone: (.milestone.title // empty)}')
4344
ASSIGNEES=$(echo "$PR_JSON" | jq '.assignees')
4445
LABELS=$(echo "$PR_JSON" | jq '.labels')
45-
MILESTONE=$(echo "$PR_JSON" | jq -r '.milestone.title // empty')
46+
MILESTONE=$(echo "$PR_JSON" | jq -r '.milestone')
4647
4748
ERRORS=""
4849

0 commit comments

Comments
 (0)