|
40 | 40 | echo "::error::No PR number provided" |
41 | 41 | exit 1 |
42 | 42 | fi |
43 | | - PR_JSON=$(gh api "repos/${{ github.repository }}/pulls/${PR_NUMBER}") |
| 43 | + PR_JSON=$(curl -fsSL \ |
| 44 | + -H "Authorization: Bearer $GH_TOKEN" \ |
| 45 | + -H "Accept: application/vnd.github+json" \ |
| 46 | + "https://api.github.com/repos/${{ github.repository }}/pulls/${PR_NUMBER}") |
44 | 47 | echo "number=${PR_NUMBER}" >> "$GITHUB_OUTPUT" |
45 | 48 | echo "title=$(echo "$PR_JSON" | jq -r '.title')" >> "$GITHUB_OUTPUT" |
46 | 49 | echo "head_sha=$(echo "$PR_JSON" | jq -r '.head.sha')" >> "$GITHUB_OUTPUT" |
@@ -136,15 +139,21 @@ jobs: |
136 | 139 | env: |
137 | 140 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
138 | 141 | run: | |
139 | | - COMMENTS=$(gh api --paginate \ |
140 | | - "repos/${{ github.repository }}/issues/${{ steps.pr.outputs.number }}/comments" \ |
141 | | - --jq '[.[] | "**@\(.user.login):** \(.body | .[0:2000])"] | join("\n\n---\n\n")') |
142 | | - REVIEW_COMMENTS=$(gh api --paginate \ |
143 | | - "repos/${{ github.repository }}/pulls/${{ steps.pr.outputs.number }}/comments" \ |
144 | | - --jq '[.[] | "**@\(.user.login) (review on \(.path)):** \(.body | .[0:2000])"] | join("\n\n---\n\n")') |
145 | | - REVIEWS=$(gh api --paginate \ |
146 | | - "repos/${{ github.repository }}/pulls/${{ steps.pr.outputs.number }}/reviews" \ |
147 | | - --jq '[.[] | select(.body != "") | "**@\(.user.login) (\(.state)):** \(.body | .[0:2000])"] | join("\n\n---\n\n")') |
| 142 | + COMMENTS=$(curl -fsSL \ |
| 143 | + -H "Authorization: Bearer $GH_TOKEN" \ |
| 144 | + -H "Accept: application/vnd.github+json" \ |
| 145 | + "https://api.github.com/repos/${{ github.repository }}/issues/${{ steps.pr.outputs.number }}/comments?per_page=100" \ |
| 146 | + | jq -r '[.[] | "**@\(.user.login):** \(.body | .[0:2000])"] | join("\n\n---\n\n")') |
| 147 | + REVIEW_COMMENTS=$(curl -fsSL \ |
| 148 | + -H "Authorization: Bearer $GH_TOKEN" \ |
| 149 | + -H "Accept: application/vnd.github+json" \ |
| 150 | + "https://api.github.com/repos/${{ github.repository }}/pulls/${{ steps.pr.outputs.number }}/comments?per_page=100" \ |
| 151 | + | jq -r '[.[] | "**@\(.user.login) (review on \(.path)):** \(.body | .[0:2000])"] | join("\n\n---\n\n")') |
| 152 | + REVIEWS=$(curl -fsSL \ |
| 153 | + -H "Authorization: Bearer $GH_TOKEN" \ |
| 154 | + -H "Accept: application/vnd.github+json" \ |
| 155 | + "https://api.github.com/repos/${{ github.repository }}/pulls/${{ steps.pr.outputs.number }}/reviews?per_page=100" \ |
| 156 | + | jq -r '[.[] | select(.body != "") | "**@\(.user.login) (\(.state)):** \(.body | .[0:2000])"] | join("\n\n---\n\n")') |
148 | 157 | COMBINED=$(printf '%s\n\n%s\n\n%s' "$COMMENTS" "$REVIEW_COMMENTS" "$REVIEWS") |
149 | 158 | DELIM="PR_COMMENTS_$(date +%s%N)" |
150 | 159 | if printf '%s' "$COMBINED" | grep -qF "$DELIM"; then |
@@ -215,4 +224,8 @@ jobs: |
215 | 224 | env: |
216 | 225 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
217 | 226 | run: | |
218 | | - gh pr edit "${{ steps.pr.outputs.number }}" --add-label "design-extracted" |
| 227 | + curl -fsSL -X POST \ |
| 228 | + -H "Authorization: Bearer $GH_TOKEN" \ |
| 229 | + -H "Accept: application/vnd.github+json" \ |
| 230 | + "https://api.github.com/repos/${{ github.repository }}/issues/${{ steps.pr.outputs.number }}/labels" \ |
| 231 | + -d '{"labels":["design-extracted"]}' |
0 commit comments