Skip to content

Commit d8420a0

Browse files
committed
Add condition of having > 0 commits in past 24hrs
If there have been no changes in the past 24 hours, then it's pointless to run this full build and test. We can save resources by skipping it.
1 parent ff7acaf commit d8420a0

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

.github/workflows/ci-nightly-build-test.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
# failures that might be missed when skipping the long-running tests or using
88
# caching to speed up the CI runs.
99
#
10+
# For efficiency, it checks if there have been any commits in the past 24 hrs
11+
# and does not proceed if there have been none.
12+
#
1013
# This workflow also can be invoked manually via the "Run workflow" button at
1114
# https://github.com/tensorflow/quantum/actions/workflows/ci-build-checks.yaml
1215
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -52,8 +55,27 @@ concurrency:
5255
group: ${{github.workflow}}-${{github.event.pull_request.number||github.ref}}
5356

5457
jobs:
58+
Decision:
59+
runs-on: ubuntu-24.04
60+
outputs:
61+
run: ${{steps.commits.outputs.count > 0}}
62+
steps:
63+
- name: Check out a sparse copy of the git repo for TFQ
64+
uses: actions/checkout@v4
65+
with:
66+
sparse-checkout: .
67+
68+
- name: Get number of commits in the last 24 hrs
69+
id: commits
70+
run: |
71+
set -x
72+
count=$(git log --oneline --since '24 hours ago' | wc -l)
73+
echo "count=$count" >> "$GITHUB_OUTPUT"
74+
5575
Nightly:
76+
if: needs.Decision.outputs.run == 'true'
5677
name: Build and test
78+
needs: Decision
5779
runs-on: ubuntu-20.04
5880
steps:
5981
- name: Check out a copy of the TFQ git repository

0 commit comments

Comments
 (0)