Skip to content

Collection of handy online tools for developers, with great UX.

chore(cd): don't run nightly release if their is no new commits

Corentin Thomassetebfdb64fde5e
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