Skip to content

Commit

Permalink
Tidy Go modules in CI
Browse files Browse the repository at this point in the history
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
  • Loading branch information
Dave Henderson committed Jan 16, 2020
1 parent fa8815e commit e256066
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/mod-tidy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Tidy Go modules

on:
push:
paths:
- .github/workflows/mod-tidy.yml
- go.mod
- go.sum

jobs:
tidy:
runs-on: ubuntu-latest
container:
image: hairyhenderson/gomplate-ci-build:latest
steps:
- name: Checkout
uses: actions/checkout@v1
- uses: actions/setup-go@v1
with:
go-version: 1.13.x
- name: Reattach HEAD
run: git checkout ${GITHUB_REF#refs/heads/}
- name: Tidy
run: rm -f go.sum; go mod tidy
- name: Configure git
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git
- name: Commit and push changes
run: |
git add go.sum go.mod
if output=$(git status --porcelain) && [ ! -z "$output" ]; then
git commit -m 'chore(deps) Tidy go modules'
git push
fi

0 comments on commit e256066

Please sign in to comment.