From 0b36cb53b091abd622972fafbc8d3e904f6f5a42 Mon Sep 17 00:00:00 2001 From: Lia Stratopoulos <167905060+lia-viam@users.noreply.github.com> Date: Tue, 24 Sep 2024 16:58:35 -0400 Subject: [PATCH] add prepare block for scheduling logic --- .github/workflows/conan.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.github/workflows/conan.yml b/.github/workflows/conan.yml index 52ca377de..75cce5c2e 100644 --- a/.github/workflows/conan.yml +++ b/.github/workflows/conan.yml @@ -1,11 +1,33 @@ name: Test conan packages on: + # Run weekdays at 11:15pm UTC, and specify below to only run if there's been new commits + schedule: + - cron: "15 11 * * 1-5" workflow_dispatch: jobs: + prepare: + # if: github.repository_owner == 'viamrobotics' + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Get new commit count + id: new_commit_count + shell: bash + run: echo "commit_count=$(git log --oneline --since '24 hours ago' | wc -l)" >> $GITHUB_OUTPUT + + - name: Cancelling scheduled build with no new commits + uses: andymckay/cancel-action@0.2 + if: | + steps.new_commit_count.outputs.commit_count == '0' && + github.event_name == 'schedule' + build_macos: # if: github.repository_owner == 'viamrobotics' + needs: [prepare] runs-on: macos-latest strategy: fail-fast: false @@ -38,6 +60,7 @@ jobs: build_linux_ubuntu_jammy: # if: github.repository_owner == 'viamrobotics' + needs: [prepare] runs-on: ${{ matrix.runs_on }} container: image: ${{ matrix.image }} @@ -95,6 +118,7 @@ jobs: build_linux_debian: # if: github.repository_owner == 'viamrobotics' + needs: [prepare] runs-on: ${{ matrix.runs_on }} container: image: ${{ matrix.image }}