From 71813c48142c337e5055db2a7ff91fa132159a79 Mon Sep 17 00:00:00 2001 From: Scott Suarez Date: Mon, 9 Dec 2024 10:31:41 -0800 Subject: [PATCH 1/7] don't request reviews on closed pull_requests --- .github/workflows/request-reviewer.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/request-reviewer.yml b/.github/workflows/request-reviewer.yml index 03dbbb2b9afa..53f8c21e3852 100644 --- a/.github/workflows/request-reviewer.yml +++ b/.github/workflows/request-reviewer.yml @@ -15,7 +15,7 @@ on: jobs: request-review: - if: (github.event.action == 'created' && github.event.issue.draft == false && github.event.comment.user.login == github.event.issue.user.login) || (github.event.action != 'created' && github.event.pull_request.draft == false) + if: (github.event.issue.state != 'closed' && github.event.pull_request != 'closed') && ((github.event.action == 'created' && github.event.issue.draft == false && github.event.comment.user.login == github.event.issue.user.login) || (github.event.action != 'created' && github.event.pull_request.draft == false)) runs-on: ubuntu-latest permissions: pull-requests: write @@ -37,5 +37,6 @@ jobs: cd .ci/magician go build . - name: Request reviewer + if: github.event.issue.state == 'open' run: .ci/magician/magician request-reviewer ${{ github.event.pull_request.number || github.event.issue.number }} From fa14e00afd91c959aeb9fd8352003610b8d6dfbe Mon Sep 17 00:00:00 2001 From: Scott Suarez Date: Mon, 9 Dec 2024 10:34:15 -0800 Subject: [PATCH 2/7] simplify logic --- .github/workflows/request-reviewer.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/request-reviewer.yml b/.github/workflows/request-reviewer.yml index 53f8c21e3852..d55dea918eb6 100644 --- a/.github/workflows/request-reviewer.yml +++ b/.github/workflows/request-reviewer.yml @@ -15,7 +15,7 @@ on: jobs: request-review: - if: (github.event.issue.state != 'closed' && github.event.pull_request != 'closed') && ((github.event.action == 'created' && github.event.issue.draft == false && github.event.comment.user.login == github.event.issue.user.login) || (github.event.action != 'created' && github.event.pull_request.draft == false)) + if: (github.event.issue.state != 'closed' && github.event.pull_request.state != 'closed') && ((github.event.action == 'created' && github.event.issue.draft == false && github.event.comment.user.login == github.event.issue.user.login) || (github.event.action != 'created' && github.event.pull_request.draft == false)) runs-on: ubuntu-latest permissions: pull-requests: write From 142e1cb0d2afccf3864a28eca7aa21081c3dbd10 Mon Sep 17 00:00:00 2001 From: Scott Suarez Date: Mon, 9 Dec 2024 10:41:21 -0800 Subject: [PATCH 3/7] invert logic and only run if open --- .github/workflows/request-reviewer.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/request-reviewer.yml b/.github/workflows/request-reviewer.yml index d55dea918eb6..5385180761ff 100644 --- a/.github/workflows/request-reviewer.yml +++ b/.github/workflows/request-reviewer.yml @@ -15,7 +15,7 @@ on: jobs: request-review: - if: (github.event.issue.state != 'closed' && github.event.pull_request.state != 'closed') && ((github.event.action == 'created' && github.event.issue.draft == false && github.event.comment.user.login == github.event.issue.user.login) || (github.event.action != 'created' && github.event.pull_request.draft == false)) + if: (github.event.issue.state == 'open' || github.event.pull_request.state == 'open') && ((github.event.action == 'created' && github.event.issue.draft == false && github.event.comment.user.login == github.event.issue.user.login) || (github.event.action != 'created' && github.event.pull_request.draft == false)) runs-on: ubuntu-latest permissions: pull-requests: write From bbd2d8f654f5f4ba3b1a0929f02d97e2fd92fbf1 Mon Sep 17 00:00:00 2001 From: Scott Suarez Date: Mon, 9 Dec 2024 10:44:09 -0800 Subject: [PATCH 4/7] Update .github/workflows/request-reviewer.yml --- .github/workflows/request-reviewer.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/request-reviewer.yml b/.github/workflows/request-reviewer.yml index 5385180761ff..1484774f1012 100644 --- a/.github/workflows/request-reviewer.yml +++ b/.github/workflows/request-reviewer.yml @@ -37,6 +37,5 @@ jobs: cd .ci/magician go build . - name: Request reviewer - if: github.event.issue.state == 'open' run: .ci/magician/magician request-reviewer ${{ github.event.pull_request.number || github.event.issue.number }} From a396c4ddaafc4b623a4f6cd3d9ea8010087e93d9 Mon Sep 17 00:00:00 2001 From: Scott Suarez Date: Mon, 9 Dec 2024 10:51:19 -0800 Subject: [PATCH 5/7] safely access state based on action --- .github/workflows/request-reviewer.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/request-reviewer.yml b/.github/workflows/request-reviewer.yml index 5385180761ff..7e3f86597d5f 100644 --- a/.github/workflows/request-reviewer.yml +++ b/.github/workflows/request-reviewer.yml @@ -15,7 +15,7 @@ on: jobs: request-review: - if: (github.event.issue.state == 'open' || github.event.pull_request.state == 'open') && ((github.event.action == 'created' && github.event.issue.draft == false && github.event.comment.user.login == github.event.issue.user.login) || (github.event.action != 'created' && github.event.pull_request.draft == false)) + if: (github.event.action == 'created' && github.event.issue.state == 'open' && github.event.issue.draft == false && github.event.comment.user.login == github.event.issue.user.login) || (github.event.action != 'created' && github.event.pull_request.state == 'open' && github.event.pull_request.draft == false ) runs-on: ubuntu-latest permissions: pull-requests: write From 290a71fffea863155f8db8c5f2ccda4c18875d7b Mon Sep 17 00:00:00 2001 From: Scott Suarez Date: Mon, 9 Dec 2024 11:07:40 -0800 Subject: [PATCH 6/7] Update .github/workflows/request-reviewer.yml Co-authored-by: Stephen Lewis (Burrows) --- .github/workflows/request-reviewer.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/request-reviewer.yml b/.github/workflows/request-reviewer.yml index 4b913b5c3911..6dd27021d572 100644 --- a/.github/workflows/request-reviewer.yml +++ b/.github/workflows/request-reviewer.yml @@ -15,7 +15,7 @@ on: jobs: request-review: - if: (github.event.action == 'created' && github.event.issue.state == 'open' && github.event.issue.draft == false && github.event.comment.user.login == github.event.issue.user.login) || (github.event.action != 'created' && github.event.pull_request.state == 'open' && github.event.pull_request.draft == false ) + if: (github.event.issue.state == 'open' && github.event.issue.draft == false) && (github.event.action != 'created' || github.event.comment.user.login == github.event.issue.user.login) runs-on: ubuntu-latest permissions: pull-requests: write From 458f025b2f60e6e4b1d0f6a0f4c3cf8838902f26 Mon Sep 17 00:00:00 2001 From: Scott Suarez Date: Mon, 9 Dec 2024 11:22:40 -0800 Subject: [PATCH 7/7] Update .github/workflows/request-reviewer.yml Co-authored-by: Stephen Lewis (Burrows) --- .github/workflows/request-reviewer.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/request-reviewer.yml b/.github/workflows/request-reviewer.yml index 6dd27021d572..4b913b5c3911 100644 --- a/.github/workflows/request-reviewer.yml +++ b/.github/workflows/request-reviewer.yml @@ -15,7 +15,7 @@ on: jobs: request-review: - if: (github.event.issue.state == 'open' && github.event.issue.draft == false) && (github.event.action != 'created' || github.event.comment.user.login == github.event.issue.user.login) + if: (github.event.action == 'created' && github.event.issue.state == 'open' && github.event.issue.draft == false && github.event.comment.user.login == github.event.issue.user.login) || (github.event.action != 'created' && github.event.pull_request.state == 'open' && github.event.pull_request.draft == false ) runs-on: ubuntu-latest permissions: pull-requests: write