Skip to content

Commit

Permalink
feat: add presubmit-go-mod-vendor workflow
Browse files Browse the repository at this point in the history
adds a gate to ensure all dependency vendoring is up to date

Signed-off-by: Caleb Woodbine <[email protected]>
  • Loading branch information
BobyMCbobs committed May 31, 2023
1 parent 00463f9 commit 0770f4f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/reusable-go-container-apps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ jobs:
uses: BobyMCbobs/sample-ko-monorepo/.github/workflows/reusable-update-go-version.yml@main
with:
autoMerge: ${{ inputs.updateGoVersionAutoMerge }}
presubmit-go-mod-vendor:
if: ${{ contains(fromJSON('["workflow_call", "pull_request"]'), github.event_name) }}
uses: BobyMCbobs/sample-ko-monorepo/.github/workflows/reusable-presubmit-go-mod-vendor.yml@main
release-please:
if: ${{ contains(fromJSON('["workflow_call", "push"]'), github.event_name) && github.ref == 'refs/heads/main' }}
uses: BobyMCbobs/sample-ko-monorepo/.github/workflows/reusable-release-please.yml@main
29 changes: 29 additions & 0 deletions .github/workflows/reusable-presubmit-go-mod-vendor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: reusable presubmit go mod vendor
on:
workflow_call: {}
jobs:
presubmit-go-mod-vendor:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
go-version-file: go.mod
cache-dependency-path: go.sum
- name: run go mod vendor
run: |
go mod vendor -v
- id: changes
name: determine changes
run: |
git add --all ./vendor
if ( git ls-files --other --directory --exclude-standard | grep 'vendor/' || git diff --name-only --diff-filter=ACMRT | grep 'vendor/' ); then
echo "changes=true" >> $GITHUB_OUTPUT
fi
- if: ${{ steps.changes.outputs.changes == 'true' }}
env:
READMEPATH: ${{ inputs.readmePath }}
run: |
echo "changes detected" >/dev/stderr
echo "Please run 'git add --all ./vendor/' to add all vendor changes and commit again."
exit 1

0 comments on commit 0770f4f

Please sign in to comment.