Skip to content

Commit 8898bf7

Browse files
committed
ci: tweak review cmd
1 parent e5b13b7 commit 8898bf7

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

.github/workflows/review.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,9 @@ jobs:
5050
- name: Get PR details
5151
id: pr-details
5252
run: |
53-
PR_DATA=$(gh api /repos/${{ github.repository }}/pulls/${{ steps.pr-number.outputs.number }})
54-
echo "title=$(echo "$PR_DATA" | jq -r .title)" >> $GITHUB_OUTPUT
55-
echo "body=$(echo "$PR_DATA" | jq -r .body)" >> $GITHUB_OUTPUT
56-
echo "sha=$(echo "$PR_DATA" | jq -r .head.sha)" >> $GITHUB_OUTPUT
53+
gh api /repos/${{ github.repository }}/pulls/${{ steps.pr-number.outputs.number }} > pr_data.json
54+
echo "title=$(jq -r .title pr_data.json)" >> $GITHUB_OUTPUT
55+
echo "sha=$(jq -r .head.sha pr_data.json)" >> $GITHUB_OUTPUT
5756
env:
5857
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5958

@@ -63,28 +62,29 @@ jobs:
6362
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6463
OPENCODE_PERMISSION: '{ "bash": { "gh*": "allow", "gh pr review*": "deny", "*": "deny" } }'
6564
run: |
65+
PR_BODY=$(jq -r .body pr_data.json)
6666
opencode run -m anthropic/claude-sonnet-4-5 "A new pull request has been created: '${{ steps.pr-details.outputs.title }}'
6767
6868
<pr-number>
6969
${{ steps.pr-number.outputs.number }}
7070
</pr-number>
7171
7272
<pr-description>
73-
${{ steps.pr-details.outputs.body }}
73+
$PR_BODY
7474
</pr-description>
7575
7676
Please check all the code changes in this pull request against the style guide, also look for any bugs if they exist. Diffs are important but make sure you read the entire file to get proper context. Make it clear the suggestions are merely suggestions and the human can decide what to do
7777
7878
Use the gh cli to create comments on the files for the violations. Try to leave the comment on the exact line number. If you have a suggested fix include it in a suggestion code block.
7979
8080
Command MUST be like this.
81-
```
81+
\`\`\`
8282
gh api \
8383
--method POST \
84-
-H "Accept: application/vnd.github+json" \
85-
-H "X-GitHub-Api-Version: 2022-11-28" \
84+
-H \"Accept: application/vnd.github+json\" \
85+
-H \"X-GitHub-Api-Version: 2022-11-28\" \
8686
/repos/${{ github.repository }}/pulls/${{ steps.pr-number.outputs.number }}/comments \
87-
-f 'body=[summary of issue]' -f 'commit_id=${{ steps.pr-details.outputs.sha }}' -f 'path=[path-to-file]' -F "line=[line]" -f 'side=RIGHT'
88-
```
87+
-f 'body=[summary of issue]' -f 'commit_id=${{ steps.pr-details.outputs.sha }}' -f 'path=[path-to-file]' -F \"line=[line]\" -f 'side=RIGHT'
88+
\`\`\`
8989
9090
Only create comments for actual violations. If the code follows all guidelines, don't run any gh commands."

0 commit comments

Comments
 (0)