Skip to content

Commit

Permalink
Nick/goworksync action (#668)
Browse files Browse the repository at this point in the history
  • Loading branch information
nickzelei authored Nov 28, 2023
1 parent 8a9752b commit d849611
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/gowork.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
on:
pull_request:
paths:
- "**/go.mod"
- "**/go.sum"

name: Go Work
jobs:
go-work:
name: Go Work Sync
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: backend/go.mod
cache-dependency-path: backend/go.sum

- name: sync
run: go work sync

- name: check
run: |
AGAINST=HEAD
RESULT=$(git diff --name-only $AGAINST | wc -l)
if [ $RESULT -eq 0 ]; then
echo ":green_circle: Go Work Sync Success!" >> $GITHUB_STEP_SUMMARY
exit 0
else
echo ":red_circle: Go Work identified that at least one go.mod is out of sync." >> $GITHUB_STEP_SUMMARY
echo "Please run go work sync locally and commit those changes." >> $GITHUB_STEP_SUMMARY
exit 1
fi
Loading

0 comments on commit d849611

Please sign in to comment.