From 830fade09dfdac9f1748d682c9aceadfbe0854dd Mon Sep 17 00:00:00 2001 From: alankritdabral <95607957+alankritdabral@users.noreply.github.com> Date: Wed, 3 Jan 2024 13:31:03 +0530 Subject: [PATCH] Update labeler.yml --- .github/workflows/labeler.yml | 30 +++++++----------------------- 1 file changed, 7 insertions(+), 23 deletions(-) diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 052bf31dcb..a6cdeff9c8 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -10,12 +10,18 @@ jobs: pull-requests: write runs-on: ubuntu-latest steps: + - name: Remove existing labels + uses: actions/labeler@v5 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + action: remove + - name: Run Labeler uses: actions/labeler@v5 with: repo-token: ${{ secrets.GITHUB_TOKEN }} sync-labels: true - + # label based on PR title - uses: github/issue-labeler@v3.3 with: @@ -25,25 +31,3 @@ jobs: enable-versioned-regex: 0 repo-token: ${{ secrets.GITHUB_TOKEN }} sync-labels: true - - remove-unused-labels: - runs-on: ubuntu-latest - needs: labeler - steps: - - name: Get current labels - run: | - current_labels=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ - "https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/labels" | \ - jq -r '.[].name') - echo "Current labels: $current_labels" - - - name: Remove unused labels - run: | - unused_labels="chore docs fix feature" - for label in $unused_labels; do - if [[ ! "$current_labels" =~ "$label" ]]; then - echo "Removing label: $label" - curl -X DELETE -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ - "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels/$label" - fi - done