From 310614663ab478630a2654d0b13f6f6499101af7 Mon Sep 17 00:00:00 2001 From: ginuerzh Date: Sat, 2 Dec 2023 13:03:16 +0800 Subject: [PATCH] check date for nightly trigger --- .github/workflows/trigger-nightly.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/trigger-nightly.yml b/.github/workflows/trigger-nightly.yml index 6387c36..f98119d 100644 --- a/.github/workflows/trigger-nightly.yml +++ b/.github/workflows/trigger-nightly.yml @@ -7,7 +7,24 @@ on: workflow_dispatch: jobs: + check_date: + runs-on: ubuntu-latest + name: Check latest commit + outputs: + should_run: ${{ steps.should_run.outputs.should_run }} + steps: + - uses: actions/checkout@v4 + - 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" + trigger-nightly: + needs: check_date + if: ${{ needs.check_date.outputs.should_run != 'false' }} name: Push tag for nightly build runs-on: ubuntu-latest steps: