Skip to content

Commit

Permalink
Add workflow to synchronize go mod changes with submodules
Browse files Browse the repository at this point in the history
Signed-off-by: Cody Soyland <[email protected]>
  • Loading branch information
codysoyland committed Oct 14, 2024
1 parent 7f63a20 commit ccb3168
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/synchronize-go-mod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Synchronize go.mod in submodules

on:
pull_request:
branches:
- main
types:
- opened
- synchronize

permissions:
contents: write

jobs:
run-command:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1

- name: Install Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version-file: go.mod

- name: Synchronize go.mod in submodules
run: |
go mod tidy
cd examples/oci-image-verification; go mod tidy
- name: Commit and push changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [ -n "$(git status --porcelain)" ]; then
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add .
git commit -s -m "Synchronize go.mod in submodules"
git push origin HEAD:${{ github.event.pull_request.head.ref }}
else
echo "No changes to commit"
fi

0 comments on commit ccb3168

Please sign in to comment.