REF: make plotting less stateful (4) (#55872) #2064
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This bot updates the issue with number DEPRECATION_TRACKER_ISSUE | |
# with the PR number that issued the deprecation. | |
# It runs on commits to main, and will trigger if the PR linked to a merged commit has the "Deprecate" label | |
name: Deprecations Bot | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: read | |
jobs: | |
deprecation_update: | |
permissions: | |
issues: write | |
runs-on: ubuntu-22.04 | |
env: | |
DEPRECATION_TRACKER_ISSUE: 50578 | |
steps: | |
- uses: actions/github-script@v6 | |
id: update-deprecation-issue | |
with: | |
script: | | |
body = await github.rest.issues.get({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: ${{ env.DEPRECATION_TRACKER_ISSUE }}, | |
}) | |
body = body["data"]["body"]; | |
linkedPRs = await github.rest.repos.listPullRequestsAssociatedWithCommit({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
commit_sha: '${{ github.sha }}' | |
}) | |
linkedPRs = linkedPRs["data"]; | |
console.log(linkedPRs); | |
if (linkedPRs.length > 0) { | |
console.log("Found linked PR"); | |
linkedPR = linkedPRs[0] | |
isDeprecation = false | |
for (label of linkedPR["labels"]) { | |
if (label["name"] == "Deprecate") { | |
isDeprecation = true; | |
break; | |
} | |
} | |
PR_NUMBER = linkedPR["number"]; | |
body += ("\n- [ ] #" + PR_NUMBER); | |
if (isDeprecation) { | |
console.log("PR is a deprecation PR. Printing new body of issue"); | |
console.log(body); | |
github.rest.issues.update({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: ${{ env.DEPRECATION_TRACKER_ISSUE }}, | |
body: body | |
}) | |
} | |
} |