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}