From aa4e4375733db03bcc53321deabe00f6686741f2 Mon Sep 17 00:00:00 2001 From: Christopher Friedt Date: Fri, 1 Jul 2022 08:51:01 -0400 Subject: [PATCH] ci: backports: check if a backport PR has a valid issue This is an automated check for the Backports project to require one or more `Fixes #` items in the body of the pull request. Fixes #46164 Signed-off-by: Christopher Friedt --- .github/workflows/backport_issue_check.yml | 30 ++++++++++++++++++++++ scripts/release/list_backports.py | 3 +-- 2 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/backport_issue_check.yml diff --git a/.github/workflows/backport_issue_check.yml b/.github/workflows/backport_issue_check.yml new file mode 100644 index 00000000000..533d853a1be --- /dev/null +++ b/.github/workflows/backport_issue_check.yml @@ -0,0 +1,30 @@ +name: Backport Issue Check + +on: + pull_request_target: + branches: + - v*-branch + +jobs: + backport: + name: Backport Issue Check + runs-on: ubuntu-latest + + steps: + - name: Check out source code + uses: actions/checkout@v2 + + - name: Install Python dependencies + run: | + sudo pip3 install -U setuptools wheel pip + pip3 install -U pygithub + + - name: Run backport issue checker + env: + GITHUB_TOKEN: ${{ secrets.ZB_GITHUB_TOKEN }} + run: | + ./scripts/release/list_backports.py \ + -o ${{ github.event.repository.owner.login }} \ + -r ${{ github.event.repository.name }} \ + -b ${{ github.event.pull_request.base.ref }} \ + -p ${{ github.event.pull_request.number }} diff --git a/scripts/release/list_backports.py b/scripts/release/list_backports.py index da4756803b0..8d72e43dc44 100755 --- a/scripts/release/list_backports.py +++ b/scripts/release/list_backports.py @@ -254,8 +254,7 @@ class Backport(object): self._pulls_without_an_issue.append(p) continue - # FIXME: when we have upgrade to python3.9+, use "issue_map | issues_for_this_pr" - issue_map = {**issue_map, **issues_for_this_pr} + issue_map = issue_map | issues_for_this_pr issues = list(issue_map.values())