Skip to content

Commit c3827ff

Browse files
committed
Declare GraphQL variables in fetch_reviews.sh
The previous query body referenced `$NUMBER_OF_THREADS` and `$NUMBER_OF_COMMENTS_PER_THREAD` inside `gh api graphql -f query='…'` without declaring them in the `query(...)` header or forwarding them via `-F`, so every invocation came back with `Variable $NUMBER_OF_THREADS is not defined`. The script could not have completed a single fetch in this state. Declare `$prComments`, `$reviews`, `$threads`, and `$comments` as proper GraphQL Int parameters and forward the corresponding `$NUMBER_OF_*` shell variables — the ones SKILL.md tells the user to substitute — via matching `-F` flags. Also add a `#!/usr/bin/env bash` shebang so the script is self-contained, and quote `-F number="$PR_NUMBER"` for consistency with the other parameters. The single-quoted redirect path that fedify-dev#765 (comment) flagged is already addressed: the prior refactor pointed the redirect target at the double-quoted `"$FETCHED_FILE"` shell variable, so the literal `$PR_NUMBER` directory bug it described can no longer occur. Addresses: - fedify-dev#765 (comment) - fedify-dev#765 (comment) Assisted-by: Claude Code:claude-opus-4-7
1 parent 096c817 commit c3827ff

1 file changed

Lines changed: 23 additions & 7 deletions

File tree

.agents/skills/get-reviews/fetch_reviews.sh

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
1+
#!/usr/bin/env bash
12
PR_PATH="plans/$PR_NUMBER"
23
FETCHED_PATH="$PR_PATH/fetched"
34
mkdir -p "$FETCHED_PATH"
45
TIMESTAMP=$(date +"%m%d%H%M")
56
FETCHED_FILE="$FETCHED_PATH/$TIMESTAMP.json"
6-
gh api graphql -f query='query($owner: String!, $repo: String!, $number: Int!) {
7+
gh api graphql -f query='query(
8+
$owner: String!,
9+
$repo: String!,
10+
$number: Int!,
11+
$prComments: Int!,
12+
$reviews: Int!,
13+
$threads: Int!,
14+
$comments: Int!
15+
) {
716
repository(owner: $owner, name: $repo) {
817
pullRequest(number: $number) {
9-
comments(first: $NUMBER_OF_PR_COMMENTS) {
18+
comments(first: $prComments) {
1019
nodes {
1120
id
1221
databaseId
@@ -16,7 +25,7 @@ gh api graphql -f query='query($owner: String!, $repo: String!, $number: Int!) {
1625
createdAt
1726
}
1827
}
19-
reviews(first: $NUMBER_OF_REVIEWS) {
28+
reviews(first: $reviews) {
2029
nodes {
2130
id
2231
databaseId
@@ -27,14 +36,14 @@ gh api graphql -f query='query($owner: String!, $repo: String!, $number: Int!) {
2736
createdAt
2837
}
2938
}
30-
reviewThreads(first: $NUMBER_OF_THREADS) {
39+
reviewThreads(first: $threads) {
3140
nodes {
3241
id
3342
isResolved
3443
isOutdated
3544
path
3645
line
37-
comments(first: $NUMBER_OF_COMMENTS_PER_THREAD) {
46+
comments(first: $comments) {
3847
nodes {
3948
id
4049
databaseId
@@ -52,7 +61,14 @@ gh api graphql -f query='query($owner: String!, $repo: String!, $number: Int!) {
5261
}
5362
}
5463
}
55-
}' -F owner=fedify-dev -F repo=fedify -F number=$PR_NUMBER \
56-
| jq . > "$FETCHED_FILE"
64+
}' \
65+
-F owner=fedify-dev \
66+
-F repo=fedify \
67+
-F number="$PR_NUMBER" \
68+
-F prComments="$NUMBER_OF_PR_COMMENTS" \
69+
-F reviews="$NUMBER_OF_REVIEWS" \
70+
-F threads="$NUMBER_OF_THREADS" \
71+
-F comments="$NUMBER_OF_COMMENTS_PER_THREAD" \
72+
| jq . > "$FETCHED_FILE"
5773

5874
# cspell: ignore MMDDHHMM

0 commit comments

Comments
 (0)