Skip to content

feature: run a clean-up job when uninstalling #11374

feature: run a clean-up job when uninstalling

feature: run a clean-up job when uninstalling #11374

Workflow file for this run

# make sure the pr is labeled as wanted, case: we could generate changelog by the pr label
name: PR Label Check
# Trigger the workflow on pull requests only
on:
pull_request:
types: [opened, labeled, unlabeled, synchronize]
env:
LEASE_ONE_OF_LABELS: "release/bug release/feature-new release/feature-changed release/none pr/robot_update"
FORBID_LABELS: "pr/not-ready not-ready"
jobs:
check-label:
name: Check label set
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
# must set one of required label, for release note generator
- name: check label
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -x
PR_NUMBER="${{ github.event.number }}"
[ -n "${PR_NUMBER}" ] || { echo "no PR number" ; exit 1 ; }
gh pr view ${PR_NUMBER}
PR_LABEL=` gh pr view ${PR_NUMBER} | grep -i "^labels:" | tr ',' ' ' | tr -s ' ' | sed 's/labels://g' `
[ -n "${PR_LABEL}" ] || { echo "no PR_LABEL " ; exit 1 ; }
echo "============ checking forbidden label ============ "
for LABEL in ${PR_LABEL} ; do
if grep -i " ${LABEL} " <<< " ${{ env.FORBID_LABELS }} " &>/dev/null ; then
echo "error, forbidden label ${LABEL} is not clear, all forbidden labels: '${{ env.FORBID_LABELS }}' "
exit 1
fi
done
echo "============ checking required label ============ "
COUNTER=0
for LABEL in ${PR_LABEL} ; do
! grep -i " ${LABEL} " <<< " ${{ env.LEASE_ONE_OF_LABELS }} " &>/dev/null || (( COUNTER=COUNTER+1 ))
done
if (( COUNTER == 0 )) ; then
echo "error, at lease, one of '${{ env.LEASE_ONE_OF_LABELS }}' should be set "
exit 1
fi
echo "============ result ============ "
echo "pr labels: ${PR_LABEL}"
echo "required one label: ${{ env.LEASE_ONE_OF_LABELS }} "
echo "forbideen labels: ${{ env.FORBID_LABELS }} "