From 832fd02c5377579e001def481fc02c97b66e7d15 Mon Sep 17 00:00:00 2001 From: sentriz Date: Wed, 28 Dec 2022 00:59:13 +0000 Subject: [PATCH] chore(ci): don't build nightly image unless code as changed fixes #258 --- .github/workflows/nightly-release.yaml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/nightly-release.yaml b/.github/workflows/nightly-release.yaml index 5cea07f..9aff752 100644 --- a/.github/workflows/nightly-release.yaml +++ b/.github/workflows/nightly-release.yaml @@ -4,8 +4,22 @@ on: - cron: "0 0 * * *" workflow_dispatch: {} jobs: + check-date: + runs-on: ubuntu-latest + name: Check latest commit + outputs: + should_run: ${{ steps.check.outputs.should_run }} + steps: + - uses: actions/checkout@v3 + - id: check + run: | + test -n "$(git rev-list --after="24 hours" ${{ github.sha }})" \ + && echo "::set-output name=should_run::true" \ + || echo "::set-output name=should_run::false" test: name: Lint and test + needs: check-date + if: ${{ needs.check-date.outputs.should_run == 'true' }} runs-on: ubuntu-latest steps: - name: Checkout @@ -28,8 +42,9 @@ jobs: run: go test ./... build-release: name: Build and release Docker image + needs: [check-date, test] + if: ${{ needs.check-date.outputs.should_run == 'true' }} runs-on: ubuntu-latest - needs: [test] steps: - name: Checkout repository uses: actions/checkout@v2