From 1ce20ea1dd9445fb2fff8d1ce32e58dbbe2d8b21 Mon Sep 17 00:00:00 2001 From: hc-github-team-consul-core Date: Thu, 20 Jul 2023 12:15:53 -0400 Subject: [PATCH] Backport of Fix Backport Assistant PR commenting into release/1.15.x (#18202) Fix Backport Assistant PR commenting (#18200) * Fix Backport Assistant failure PR commenting For general comments on a PR, it looks like you have to use the `/issue` endpoint rather than `/pulls`, which requires commit/other review-specific target details. This matches the endpoint used in `backport-reminder.yml`. * Remove Backport Reminder workflow This is noisy (even when adding multiple labels, individual comments per label are generated), and likely no longer needed: we haven't had this work in a long time due to an expired GH token, and we now have better automation for backport PR assignment. Manual backport of 1c7fcdf1888fce00242f425ea0ae72c9545acb01. --- .github/workflows/backport-assistant.yml | 2 +- .github/workflows/backport-reminder.yml | 26 ------------------------ 2 files changed, 1 insertion(+), 27 deletions(-) delete mode 100644 .github/workflows/backport-reminder.yml diff --git a/.github/workflows/backport-assistant.yml b/.github/workflows/backport-assistant.yml index b1640295bf..d842f1b167 100644 --- a/.github/workflows/backport-assistant.yml +++ b/.github/workflows/backport-assistant.yml @@ -64,4 +64,4 @@ jobs: curl -s -H "Authorization: token ${{ secrets.PR_COMMENT_TOKEN }}" \ -X POST \ -d "{ \"body\": \"${github_message}\"}" \ - "https://api.github.com/repos/${GITHUB_REPOSITORY}/pull/${{ github.event.pull_request.number }}/comments" + "https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${{ github.event.pull_request.number }}/comments" diff --git a/.github/workflows/backport-reminder.yml b/.github/workflows/backport-reminder.yml deleted file mode 100644 index 359451269d..0000000000 --- a/.github/workflows/backport-reminder.yml +++ /dev/null @@ -1,26 +0,0 @@ -# This workflow sends a reminder comment to PRs that have labels starting with -# `backport/` to check that the backport has run successfully. - -name: Backport Assistant Reminder - -on: - pull_request: - types: [ labeled ] - # Runs on PRs to main and all release branches - branches: - - main - - release/* - -jobs: - backport-label-check: - if: "startsWith(github.event.label.name, 'backport/')" - runs-on: ubuntu-latest - - steps: - - name: Comment on PR - run: | - github_message="After merging, confirm that you see linked PRs AND check them for CI errors." - curl -s -H "Authorization: token ${{ secrets.PR_COMMENT_TOKEN }}" \ - -X POST \ - -d "{ \"body\": \"${github_message}\"}" \ - "https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${{ github.event.pull_request.number }}/comments"