From e256066b10553aa8d24d9a51d7a6c7bb26381f45 Mon Sep 17 00:00:00 2001 From: Dave Henderson Date: Wed, 15 Jan 2020 19:06:11 -0500 Subject: [PATCH] Tidy Go modules in CI Signed-off-by: Dave Henderson --- .github/workflows/mod-tidy.yml | 36 ++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/mod-tidy.yml diff --git a/.github/workflows/mod-tidy.yml b/.github/workflows/mod-tidy.yml new file mode 100644 index 00000000..0aea7931 --- /dev/null +++ b/.github/workflows/mod-tidy.yml @@ -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