From 719a9cf63d321039af5c2cfcb6f6dd64230171ae Mon Sep 17 00:00:00 2001 From: Ramya Parimi Date: Tue, 7 Sep 2021 06:07:13 -0500 Subject: [PATCH 1/7] Create close-on-invalid-label.yaml Workflow to close issue/PR on adding `invalid` label. --- .github/workflows/close-on-invalid-label.yaml | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/close-on-invalid-label.yaml diff --git a/.github/workflows/close-on-invalid-label.yaml b/.github/workflows/close-on-invalid-label.yaml new file mode 100644 index 0000000000..32e72e6cfb --- /dev/null +++ b/.github/workflows/close-on-invalid-label.yaml @@ -0,0 +1,26 @@ +name: Close issue/PR on adding invalid label + +on: + issues: + types: [labeled] + pull_request: + types: [labeled] + +jobs: + close-on-adding-invalid-label: + if: github.repository == 'github/docs' + runs-on: ubuntu-latest + + steps: + - name: Close issue + if: ${{ github.event_name == 'issues' }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: gh issue close ${{ github.event.issue.html_url }} + + - name: Close PR + if: ${{ github.event_name == 'pull_request' }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: gh pr close ${{ github.event.pull_request.html_url }} -d + From 9aa2880ddfacf07b315bd2a7f83043a52f050a96 Mon Sep 17 00:00:00 2001 From: Ramya Parimi Date: Tue, 7 Sep 2021 06:39:09 -0500 Subject: [PATCH 2/7] Update .github/workflows/close-on-invalid-label.yaml Co-authored-by: Steve Guntrip <12534592+stevecat@users.noreply.github.com> --- .github/workflows/close-on-invalid-label.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/close-on-invalid-label.yaml b/.github/workflows/close-on-invalid-label.yaml index 32e72e6cfb..177e0a1266 100644 --- a/.github/workflows/close-on-invalid-label.yaml +++ b/.github/workflows/close-on-invalid-label.yaml @@ -8,7 +8,7 @@ on: jobs: close-on-adding-invalid-label: - if: github.repository == 'github/docs' + if: github.repository == 'github/docs' && github.event.label.name == 'invalid' runs-on: ubuntu-latest steps: From 846dac866c1c2c155b32bb9e578ad94ae08f9583 Mon Sep 17 00:00:00 2001 From: Ramya Parimi Date: Tue, 7 Sep 2021 10:23:46 -0500 Subject: [PATCH 3/7] Update .github/workflows/close-on-invalid-label.yaml Co-authored-by: James M. Greene --- .github/workflows/close-on-invalid-label.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/close-on-invalid-label.yaml b/.github/workflows/close-on-invalid-label.yaml index 177e0a1266..f24ce062f1 100644 --- a/.github/workflows/close-on-invalid-label.yaml +++ b/.github/workflows/close-on-invalid-label.yaml @@ -8,7 +8,7 @@ on: jobs: close-on-adding-invalid-label: - if: github.repository == 'github/docs' && github.event.label.name == 'invalid' + if: github.repository == 'github/docs' && github.event.label.name == 'invalid' runs-on: ubuntu-latest steps: From c4d099e2922686cf1c3960a4344610e2140dc78a Mon Sep 17 00:00:00 2001 From: Ramya Parimi Date: Tue, 7 Sep 2021 10:24:36 -0500 Subject: [PATCH 4/7] prettier --- .github/workflows/close-on-invalid-label.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/close-on-invalid-label.yaml b/.github/workflows/close-on-invalid-label.yaml index 177e0a1266..fd37eacc84 100644 --- a/.github/workflows/close-on-invalid-label.yaml +++ b/.github/workflows/close-on-invalid-label.yaml @@ -10,7 +10,7 @@ jobs: close-on-adding-invalid-label: if: github.repository == 'github/docs' && github.event.label.name == 'invalid' runs-on: ubuntu-latest - + steps: - name: Close issue if: ${{ github.event_name == 'issues' }} @@ -23,4 +23,3 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: gh pr close ${{ github.event.pull_request.html_url }} -d - From 9e008851993c7a6556ef687a6c205313c6a5128b Mon Sep 17 00:00:00 2001 From: Ramya Parimi Date: Tue, 7 Sep 2021 10:27:37 -0500 Subject: [PATCH 5/7] Update .github/workflows/close-on-invalid-label.yaml Co-authored-by: James M. Greene --- .github/workflows/close-on-invalid-label.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/close-on-invalid-label.yaml b/.github/workflows/close-on-invalid-label.yaml index 8cc03af167..772bcb0991 100644 --- a/.github/workflows/close-on-invalid-label.yaml +++ b/.github/workflows/close-on-invalid-label.yaml @@ -22,4 +22,4 @@ jobs: if: ${{ github.event_name == 'pull_request' }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: gh pr close ${{ github.event.pull_request.html_url }} -d + run: gh pr close ${{ github.event.pull_request.html_url }} From 60fdce01a66cbee5da6f018fa386a89a228a8c0f Mon Sep 17 00:00:00 2001 From: Ramya Parimi Date: Tue, 7 Sep 2021 10:28:06 -0500 Subject: [PATCH 6/7] Update .github/workflows/close-on-invalid-label.yaml Co-authored-by: James M. Greene --- .github/workflows/close-on-invalid-label.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/close-on-invalid-label.yaml b/.github/workflows/close-on-invalid-label.yaml index 772bcb0991..9d79f5d3bb 100644 --- a/.github/workflows/close-on-invalid-label.yaml +++ b/.github/workflows/close-on-invalid-label.yaml @@ -6,6 +6,10 @@ on: pull_request: types: [labeled] +permissions: + issues: write + pull-requests: write + jobs: close-on-adding-invalid-label: if: github.repository == 'github/docs' && github.event.label.name == 'invalid' From 9e4357984d96920e6657ff4b275b075633c394c2 Mon Sep 17 00:00:00 2001 From: Ramya Parimi Date: Tue, 7 Sep 2021 10:54:15 -0500 Subject: [PATCH 7/7] prettier, suggested changes --- .github/workflows/close-on-invalid-label.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/close-on-invalid-label.yaml b/.github/workflows/close-on-invalid-label.yaml index 8cc03af167..9d79f5d3bb 100644 --- a/.github/workflows/close-on-invalid-label.yaml +++ b/.github/workflows/close-on-invalid-label.yaml @@ -6,6 +6,10 @@ on: pull_request: types: [labeled] +permissions: + issues: write + pull-requests: write + jobs: close-on-adding-invalid-label: if: github.repository == 'github/docs' && github.event.label.name == 'invalid' @@ -22,4 +26,4 @@ jobs: if: ${{ github.event_name == 'pull_request' }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: gh pr close ${{ github.event.pull_request.html_url }} -d + run: gh pr close ${{ github.event.pull_request.html_url }}