diff --git a/.github/workflows/go-verdiff.yaml b/.github/workflows/go-verdiff.yaml index 27773799c9..783861fed1 100644 --- a/.github/workflows/go-verdiff.yaml +++ b/.github/workflows/go-verdiff.yaml @@ -11,4 +11,12 @@ jobs: with: fetch-depth: 0 - name: Check golang version - run: hack/tools/check-go-version.sh "${{ github.event.pull_request.base.sha }}" + run: | + export LABELS="$(gh api repos/$OWNER/$REPO/pulls/$PR --jq '.labels.[].name')" + hack/tools/check-go-version.sh "${{ github.event.pull_request.base.sha }}" + shell: bash + env: + GH_TOKEN: ${{ github.token }} + OWNER: ${{ github.repository_owner }} + REPO: ${{ github.event.repository.name }} + PR: ${{ github.event.pull_request.number }} diff --git a/hack/tools/check-go-version.sh b/hack/tools/check-go-version.sh index 307f203dcf..6848c8e197 100755 --- a/hack/tools/check-go-version.sh +++ b/hack/tools/check-go-version.sh @@ -14,6 +14,7 @@ fi GO_MAJOR=${MAX_VER[0]} GO_MINOR=${MAX_VER[1]} GO_PATCH=${MAX_VER[2]} +OVERRIDE_LABEL="override-go-verdiff" RETCODE=0 @@ -77,4 +78,17 @@ for f in $(find . -name "*.mod"); do fi done +for l in ${LABELS}; do + if [ "$l" == "${OVERRIDE_LABEL}" ]; then + if [ ${RETCODE} -eq 1 ]; then + echo "Found ${OVERRIDE_LABEL} label, overriding failed results." + RETCODE=0 + fi + fi +done + +if [ ${RETCODE} -eq 1 ]; then + echo "This test result may be overridden by applying the (${OVERRIDE_LABEL}) label to this PR and re-running the CI job." +fi + exit ${RETCODE}