From fe3ebc70e88ff54ffe275d09d7be12e5633f754b Mon Sep 17 00:00:00 2001 From: Patrick Hoefler Date: Wed, 1 Mar 2023 22:50:20 +0100 Subject: [PATCH] CI: Add bot to track deprecation prs --- .../workflows/deprecation-tracking-bot.yml | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/deprecation-tracking-bot.yml diff --git a/.github/workflows/deprecation-tracking-bot.yml b/.github/workflows/deprecation-tracking-bot.yml new file mode 100644 index 0000000000000..c0d871ed54ed6 --- /dev/null +++ b/.github/workflows/deprecation-tracking-bot.yml @@ -0,0 +1,31 @@ +name: Deprecations Bot + +on: + pull_request: + branches: + - main + types: + [closed] + + +permissions: + contents: read + +jobs: + deprecation_update: + permissions: + issues: write + if: >- + contains(github.event.pull_request.labels.*.name, 'Deprecate') && github.event.pull_request.merged == true + runs-on: ubuntu-22.04 + env: + DEPRECATION_TRACKER_ISSUE: 50578 + steps: + - name: Checkout + run: | + echo "Adding deprecation PR number to deprecation tracking issue" + export PR=${{ github.event.pull_request.number }} + BODY=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/issues/${DEPRECATION_TRACKER_ISSUE} | + python3 -c "import sys, json, os; x = {'body': json.load(sys.stdin)['body']}; pr = os.environ['PR']; x['body'] += f'\n- [ ] #{pr}'; print(json.dumps(x))") + echo ${BODY} + curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -X PATCH -d "${BODY}" https://api.github.com/repos/${{ github.repository }}/issues/${DEPRECATION_TRACKER_ISSUE}