diff --git a/.github/workflows/go.yaml b/.github/workflows/go.yaml index 99314ef8a..453398bca 100644 --- a/.github/workflows/go.yaml +++ b/.github/workflows/go.yaml @@ -6,6 +6,7 @@ on: pull_request: branches: - '**' + types: [opened, synchronize, reopened, labeled, unlabeled] workflow_dispatch: merge_group: jobs: @@ -55,3 +56,21 @@ jobs: run: go env - name: Run go-apidiff uses: joelanford/go-apidiff@main + id: check-api + continue-on-error: true + - name: Check for override label + if: ${{ steps.check-api.outcome == 'failure' }} + run: | + if gh api repos/$OWNER/$REPO/pulls/$PR --jq '.labels.[].name' | grep -q "${OVERRIDE_LABEL}"; then + echo "Found ${OVERRIDE_LABEL} label, overriding failed results." + exit 0 + else + echo "No ${OVERRIDE_LABEL} label found, failing the job." + exit 1 + fi + env: + GH_TOKEN: ${{ github.token }} + OWNER: ${{ github.repository_owner }} + REPO: ${{ github.event.repository.name }} + PR: ${{ github.event.pull_request.number }} + OVERRIDE_LABEL: "go-apidiff-override"