|
33 | 33 | GH_API_COMMENTS: ${{ github.event.pull_request.comments_url }} |
34 | 34 | GH_API_LABELS: ${{ github.event.pull_request.issue_url }}/labels |
35 | 35 | GH_API_ARTIFACTS: ${{ github.event.pull_request.base.repo.url }}/actions/artifacts |
36 | | - TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 36 | + TOKEN: ${{ secrets.MERLINOINS_PAT }} |
37 | 37 |
|
38 | 38 | # URL short-hands |
39 | 39 | ACTIONS_RUNS_ENDPOINT: ${{ github.event.repository.html_url }}/actions/runs |
@@ -293,8 +293,6 @@ jobs: |
293 | 293 | name: Evaluate diffs |
294 | 294 | runs-on: ubuntu-22.04 |
295 | 295 | needs: diff |
296 | | - permissions: |
297 | | - pull-requests: write |
298 | 296 | env: |
299 | 297 | earlier_diff_was_approved: ${{ contains(github.event.pull_request.labels.*.name, 'fuzzy-diff-looks-good') }} |
300 | 298 | current_diff_exists: ${{ needs.diff.outputs.diff_exits }} |
@@ -345,6 +343,11 @@ jobs: |
345 | 343 | Previous sha256: ${{ steps.approved_diff_info.outputs.hash }}\n\ |
346 | 344 | Current sha256: $current_diff_hash" |
347 | 345 | status=$(curl -sL -w "%{http_code}" -o output.txt -X DELETE -H "Authorization: Bearer $TOKEN" "$GH_API_LABELS/$LABEL_NAME") |
| 346 | + if [ "$status" -ne 200 ]; then |
| 347 | + echo "Something went wrong trying to remove the $LABEL_NAME label. Please, remove it manually." |
| 348 | + cat output.txt |
| 349 | + fi |
| 350 | + exit 2 |
348 | 351 | fi |
349 | 352 | else |
350 | 353 | if $current_diff_exists; then |
@@ -383,10 +386,13 @@ jobs: |
383 | 386 | env: |
384 | 387 | id: ${{ steps.diff_metadata.outputs.id }} |
385 | 388 | run: | |
386 | | - # FIXME (?) |
387 | 389 | if [ -z $id ]; then |
388 | 390 | printf "You seem to have tried to approve a diff that doesn't exist yet.\nWait for the diff to have been generated and then try again." |
389 | 391 | status=$(curl -sL -w "%{http_code}" -o output.txt -X DELETE -H "Authorization: Bearer $TOKEN" "$GH_API_LABELS/$LABEL_NAME") |
| 392 | + if [ "$status" -ne 200 ]; then |
| 393 | + echo "Something went wrong trying to remove the $LABEL_NAME label. Please, remove it manually." |
| 394 | + cat output.txt |
| 395 | + fi |
390 | 396 | exit 1 |
391 | 397 | else |
392 | 398 | echo "Diff has been approved." |
|
0 commit comments