consul/.github/workflows/reusable-check-go-mod.yml

40 lines
1.2 KiB
YAML

name: check-go-mod
on:
workflow_call:
inputs:
runs-on:
description: An expression indicating which kind of runners to use.
required: true
type: string
repository-name:
required: true
type: string
go-version:
required: true
type: string
secrets:
elevated-github-token:
required: true
jobs:
check-go-mod:
runs-on: ${{ fromJSON(inputs.runs-on) }}
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
# NOTE: This step is specifically needed for ENT. It allows us to access the required private HashiCorp repos.
- name: Setup Git
if: ${{ endsWith(inputs.repository-name, '-enterprise') }}
run: git config --global url."https://${{ secrets.elevated-github-token }}:@github.com".insteadOf "https://github.com"
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version: ${{ inputs.go-version }}
# Run on all go.mod (include submodules).
- run: make go-mod-tidy
- run: |
if [[ -n $(git status -s) ]]; then
echo "Git directory has changes"
git status -s
exit 1
fi