Skip to content

fix(vscode): remove internal markup from end-user features #1055

fix(vscode): remove internal markup from end-user features

fix(vscode): remove internal markup from end-user features #1055

Workflow file for this run

# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
name: Go checks
on:
pull_request:
branches: [ main ]
permissions:
contents: write
pull-requests: write
jobs:
check-paths:
runs-on: ubuntu-latest
outputs:
any_changed: ${{ steps.changed-files.outputs.any_changed }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v45
with:
files: |
go/**
spec/**
.github/workflows/go.yml
go-mod-tidy-check:
needs: check-paths
if: needs.check-paths.outputs.any_changed == 'true'
runs-on: ubuntu-latest
name: go.sum Check
steps:
- name: Checkout Repo
uses: actions/checkout@v6
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.RELEASE_PLEASE_TOKEN || github.token }}
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: stable
- name: Check if this is a release-please PR
id: check-release-please
run: |
if [[ "${GITHUB_HEAD_REF}" == release-please--* ]]; then
echo "is_release_please=true" >> $GITHUB_OUTPUT
else
echo "is_release_please=false" >> $GITHUB_OUTPUT
fi
- name: Update go.sum for release-please PR
if: steps.check-release-please.outputs.is_release_please == 'true'
working-directory: go
run: |
echo "Updating go.sum for release-please PR..."
go mod tidy
- name: Commit go.sum updates
if: steps.check-release-please.outputs.is_release_please == 'true'
run: |
# Use CLA-covered maintainer identity from MAINTAINERS.yaml
git config user.name "$(yq '.ci.commit_author.name' MAINTAINERS.yaml)"
git config user.email "$(yq '.ci.commit_author.email' MAINTAINERS.yaml)"
if ! git diff --quiet go/go.sum go/go.mod; then
git add go/go.sum go/go.mod
git commit -m "chore: update go.mod and go.sum"
git push
echo "go.sum updated and pushed"
else
echo "No go.sum changes needed"
fi
- name: Check go.mod and go.sum are tidy
working-directory: go
run: |
go mod tidy
if ! git diff --quiet go.sum go.mod; then
echo "❌ go.mod or go.sum is not tidy. Run 'go mod tidy' in the go/ directory."
git diff go.sum go.mod
exit 1
fi
echo "✅ go.mod and go.sum are tidy"
format-check:
needs: check-paths
if: needs.check-paths.outputs.any_changed == 'true'
runs-on: ubuntu-latest
name: Go Format Check
steps:
- name: Checkout Repo
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: stable
- name: Check formatting with gofmt
run: |
UNFORMATTED=$(gofmt -l go/)
if [ -n "${UNFORMATTED}" ]; then
echo "❌ The following Go files need formatting:"
echo "${UNFORMATTED}"
echo ""
echo "Run 'gofmt -w go/' or 'scripts/format_go_files' to fix."
exit 1
fi
echo "✅ All Go files are properly formatted."
tests:
runs-on: ubuntu-latest
needs: [check-paths, format-check]
if: needs.check-paths.outputs.any_changed == 'true'
strategy:
matrix:
go-version: ["1.25.x", "1.26.x"]
fail-fast: false
name: Go ${{ matrix.go-version }} Tests
steps:
- name: Checkout Repo
uses: actions/checkout@v6
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v6
with:
go-version: ${{ matrix.go-version }}
- name: Install govulncheck
run: go install golang.org/x/vuln/cmd/govulncheck@latest
- name: Check build
run: go build -C go -v ./...
- name: Run tests
run: go test -C go -v ./...
- name: Run vulncheck
run: govulncheck -C go ./...
go-checks-all:
if: always()
needs: [go-mod-tidy-check, format-check, tests]
runs-on: ubuntu-latest
steps:
- name: Check overall status
run: |
if [[ "${NEEDS_GO_MOD_TIDY_CHECK_RESULT}" == "failure" || "${NEEDS_FORMAT_CHECK_RESULT}" == "failure" || "${NEEDS_TESTS_RESULT}" == "failure" ]]; then
echo "Go checks failed"
exit 1
fi
echo "Go checks passed or were skipped"
exit 0
env:
NEEDS_GO_MOD_TIDY_CHECK_RESULT: ${{ needs.go-mod-tidy-check.result }}
NEEDS_FORMAT_CHECK_RESULT: ${{ needs.format-check.result }}
NEEDS_TESTS_RESULT: ${{ needs.tests.result }}