Only run if commit in last 24hr
To stop unnecessary runs this checks if there has been a commit within the past 24hrs, if there has it will then continue.
@@ -9,8 +9,26 @@ env:
RUSTFLAGS: "-D warnings"
jobs:
+ nightly-last-run:
+ 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"
+
build-nightly-clean:
runs-on: ubuntu-latest
+ needs: [ nightly-last-run ]
+ if: ${{ needs.nightly-last-run.outputs.should_run != 'false' }}
steps:
- name: Delete old release assets
uses: mknejp/delete-release-assets@v1
