From ebfdb64fde5e3290321230e14e5889c4a139b928 Mon Sep 17 00:00:00 2001 From: Corentin Thomasset Date: Sun, 9 Apr 2023 15:27:58 +0200 Subject: [PATCH] chore(cd): don't run nightly release if their is no new commits --- .github/workflows/docker-nightly-release.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/docker-nightly-release.yml b/.github/workflows/docker-nightly-release.yml index 8126d02c..c75d9281 100644 --- a/.github/workflows/docker-nightly-release.yml +++ b/.github/workflows/docker-nightly-release.yml @@ -6,8 +6,26 @@ on: - cron: '0 0 * * *' jobs: + check_date: + runs-on: ubuntu-latest + name: Check latest commit + outputs: + should_run: ${{ steps.should_run.outputs.should_run }} + steps: + - uses: actions/checkout@v2 + - name: print latest_commit + run: echo ${{ github.sha }} + + - id: should_run + continue-on-error: true + name: check latest commit is less than a day + if: ${{ github.event_name == 'schedule' }} + run: test -z $(git rev-list --after="24 hours" ${{ github.sha }}) && echo "::set-output name=should_run::false" + ci: runs-on: ubuntu-latest + needs: check_date + if: ${{ needs.check_date.outputs.should_run != 'false' }} steps: - uses: actions/checkout@v3