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@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 # 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@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 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