Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .github/workflows/go-verdiff.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
14 changes: 14 additions & 0 deletions hack/tools/check-go-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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}