docs: finally some working examples for a lot of commands #949
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Check for diff after go mod tidy and generated targets | |
on: | |
pull_request: {} | |
workflow_call: | |
jobs: | |
diff-check-manifests: | |
name: Check for diff | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: '${{ github.workspace }}/go.mod' | |
cache: false | |
- name: Get go environment for use with cache | |
run: | | |
echo "go_cache=$(go env GOCACHE)" >> $GITHUB_ENV | |
echo "go_modcache=$(go env GOMODCACHE)" >> $GITHUB_ENV | |
# This step will only reuse the go mod and build cache from main made during the Build, | |
# see lint_and_test.yaml => "test" Job | |
# This means it never caches by itself and PRs cannot cause cache pollution / thrashing | |
# This is because we have huge storage requirements for our cache because of the mass of dependencies | |
- name: Restore / Reuse Cache from central build | |
id: cache-golang-restore | |
uses: actions/cache/restore@v4 # Only Restore, not build another cache (too big) | |
with: | |
path: | | |
${{ env.go_cache }} | |
${{ env.go_modcache }} | |
key: ${{ env.cache_name }}-${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}-${{ hashFiles('**/go.mod') }} | |
restore-keys: | | |
${{ env.cache_name }}-${{ runner.os }}-go- | |
env: | |
cache_name: run-tests-go-cache # needs to be the same key in the end as in the build step | |
- name: Make generate and deepcopy | |
run: | | |
make -f hack/Makefile mdref && make -f hack/Makefile go-bindata && make generate && make generate-deepcopy | |
- name: go mod tidy | |
run: | | |
go mod tidy | |
- name: Check for diff | |
run: | | |
gitStatus="$(git status --porcelain)" | |
if [[ -z "${gitStatus}" ]]; then | |
exit 0 | |
fi | |
echo "${gitStatus}" | |
exit 1 |