diff --git a/.github/workflows/auto-labels.yml b/.github/workflows/auto-labels.yml new file mode 100644 index 000000000..45eaf09a4 --- /dev/null +++ b/.github/workflows/auto-labels.yml @@ -0,0 +1,45 @@ +name: Auto add and remove labels + +on: + issues: + types: [closed] + pull_request: + types: [closed] + +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 + 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 + 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 }}