From dc75960a74c62d0db526046fbeb94684267ba4fc Mon Sep 17 00:00:00 2001 From: yardasol Date: Wed, 2 Feb 2022 17:02:33 -0600 Subject: [PATCH 1/4] initial version of auto-labels.yml --- .github/workflows/auto-labels.yml | 48 +++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/auto-labels.yml diff --git a/.github/workflows/auto-labels.yml b/.github/workflows/auto-labels.yml new file mode 100644 index 000000000..72f8b0eb6 --- /dev/null +++ b/.github/workflows/auto-labels.yml @@ -0,0 +1,48 @@ +name: Auto add and remove labels + +on: + issue: + types: [closed, labeled] + pull_request: + types: [closed, labeled, review_requested] + +jobs: + # job for issue events + auto-labels-issues: + if: ${{ !github.event.issue.pull_request }} + runs-on: ubuntu-latest + defaults: + run: + shell: bash -l {0} + + steps: + - uses: actions/checkout@v2 + - name: Remove Priority and Status labels + if: github.event.issue.action == "closed" + run: | + id=${{ github.event.issue.number }} + gh issue edit $id --remove-label "Priority:*" + gh issue edit $id --remove-label "Status:*" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + + + # job for pr events + auto-labels-pr: + if: ${{ github.event.issue.pull_reqeust }} + runs-on: ubuntu-latest + defaults: + run: + shell: bash -l {0} + + steps: + - uses: actions/checkout@v2 + - name: Remove Priority and Status labels + if: github.event.pull_request.action == "closed" + run: | + id=${{ github.event.pull_reqeust.number }} + gh pr edit $id --remove-label "Priority:*" + gh pr edit $id --remove-label "Status:*" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 09e000c572b7713491b02a70cb1ec7ff8667548c Mon Sep 17 00:00:00 2001 From: yardasol Date: Wed, 2 Feb 2022 17:12:50 -0600 Subject: [PATCH 2/4] issue->issues in trigger events --- .github/workflows/auto-labels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/auto-labels.yml b/.github/workflows/auto-labels.yml index 72f8b0eb6..24c5405db 100644 --- a/.github/workflows/auto-labels.yml +++ b/.github/workflows/auto-labels.yml @@ -1,7 +1,7 @@ name: Auto add and remove labels on: - issue: + issues: types: [closed, labeled] pull_request: types: [closed, labeled, review_requested] From c07bafd43fed687aae93c292a5486af1408a6f21 Mon Sep 17 00:00:00 2001 From: yardasol Date: Thu, 3 Feb 2022 10:59:15 -0600 Subject: [PATCH 3/4] start working on flow to add lables --- .github/workflows/auto-labels.yml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/auto-labels.yml b/.github/workflows/auto-labels.yml index 24c5405db..2006bbe4f 100644 --- a/.github/workflows/auto-labels.yml +++ b/.github/workflows/auto-labels.yml @@ -2,9 +2,9 @@ name: Auto add and remove labels on: issues: - types: [closed, labeled] + types: [closed] pull_request: - types: [closed, labeled, review_requested] + types: [closed, review_requested] jobs: # job for issue events @@ -26,6 +26,8 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Update Priority/Status labels on linked PRs + # job for pr events @@ -46,3 +48,12 @@ jobs: gh pr edit $id --remove-label "Status:*" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Update linked issues + if: github.event.pull_request.action == "review_requested" + run: | + id=${{ github.event.pull_request.number }} + gh pr edit $id --remove-label "Status:*" + gh pr edit $id --add-label "Status:In Review" + + From 7c23fd63e242e71704c9001cb9d6ff18a2a7a35f Mon Sep 17 00:00:00 2001 From: yardasol Date: Thu, 3 Feb 2022 13:06:31 -0600 Subject: [PATCH 4/4] remove unnecessary if statements in the workflow --- .github/workflows/auto-labels.yml | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/.github/workflows/auto-labels.yml b/.github/workflows/auto-labels.yml index 2006bbe4f..45eaf09a4 100644 --- a/.github/workflows/auto-labels.yml +++ b/.github/workflows/auto-labels.yml @@ -4,7 +4,7 @@ on: issues: types: [closed] pull_request: - types: [closed, review_requested] + types: [closed] jobs: # job for issue events @@ -18,7 +18,6 @@ jobs: steps: - uses: actions/checkout@v2 - name: Remove Priority and Status labels - if: github.event.issue.action == "closed" run: | id=${{ github.event.issue.number }} gh issue edit $id --remove-label "Priority:*" @@ -26,9 +25,6 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Update Priority/Status labels on linked PRs - - # job for pr events auto-labels-pr: @@ -41,19 +37,9 @@ jobs: steps: - uses: actions/checkout@v2 - name: Remove Priority and Status labels - if: github.event.pull_request.action == "closed" run: | id=${{ github.event.pull_reqeust.number }} gh pr edit $id --remove-label "Priority:*" gh pr edit $id --remove-label "Status:*" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Update linked issues - if: github.event.pull_request.action == "review_requested" - run: | - id=${{ github.event.pull_request.number }} - gh pr edit $id --remove-label "Status:*" - gh pr edit $id --add-label "Status:In Review" - -