Skip to content

refactor: components used for QR hardware wallet flow #20715

refactor: components used for QR hardware wallet flow

refactor: components used for QR hardware wallet flow #20715

name: Remove labels after issue (or PR) closed
on:
issues:
types: [closed]
# Use pull_request_target so closed-PR cleanup always runs with the
# workflow definition from the default branch (not the PR head SHA).
# This ensures newly added cleanup labels are applied consistently.
pull_request_target:
types: [closed]
jobs:
cleanup:
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
issues: write
pull-requests: write
steps:
- name: Remove labels
env:
REPO: ${{ github.repository }}
ISSUE_NUMBER: ${{ github.event.issue.number || github.event.pull_request.number }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
LABELS=(
"blocked"
"design-in-progress"
"force-builds"
"force-e2e"
"in-progress"
"issues-found"
"needs-design"
"needs-dev-review"
"needs-qa"
"product-backlog"
"ready-for-dev"
"ready-for-release"
"retry-ci"
"skip-builds"
"skip-e2e"
"sprint-backlog"
)
for LABEL in "${LABELS[@]}"; do
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" \
-X DELETE \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/$REPO/issues/$ISSUE_NUMBER/labels/$LABEL")
# 200 = removed, 404 = label wasn't present (both are fine)
if [[ "$HTTP_CODE" != "200" && "$HTTP_CODE" != "404" ]]; then
echo "WARNING: Failed to remove label '$LABEL' (HTTP $HTTP_CODE)" >&2
fi
done