diff --git a/.github/workflows/auto-remove-review-label.yaml b/.github/workflows/auto-remove-pr-lifecycle-labels.yaml similarity index 53% rename from .github/workflows/auto-remove-review-label.yaml rename to .github/workflows/auto-remove-pr-lifecycle-labels.yaml index 7d04624b9..de8a8a20b 100644 --- a/.github/workflows/auto-remove-review-label.yaml +++ b/.github/workflows/auto-remove-pr-lifecycle-labels.yaml @@ -1,4 +1,4 @@ -name: Automatically remove committee review label from closed PRs +name: Automatically remove lifecycle labels from closed PRs "on": pull_request: @@ -17,15 +17,29 @@ jobs: labeler: if: github.event.pull_request.head.repo.full_name == github.repository && github.event.pull_request.user.type != 'Bot' - name: Remove committee review label from closed PR + name: Remove lifecycle labels from closed PR permissions: pull-requests: write # Needed to remove the label runs-on: ubuntu-latest steps: - env: + EVENT_ACTION: ${{ github.event.action }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} PR_REPO: ${{ github.repository }} PR_URL: ${{ github.event.pull_request.html_url }} - name: Remove committee review label from closed PR - run: gh pr edit "$PR_URL" --remove-label "awaiting committee review" --repo "$PR_REPO" + name: Remove lifecycle labels from closed PR + run: |- + set -euo pipefail + + labels=("awaiting committee review") + if [ "$EVENT_ACTION" = "closed" ]; then + labels+=("sync" "conflict") + fi + + args=() + for label in "${labels[@]}"; do + args+=(--remove-label "$label") + done + + gh pr edit "$PR_URL" "${args[@]}" --repo "$PR_REPO"