File tree Expand file tree Collapse file tree 1 file changed +18
-6
lines changed Expand file tree Collapse file tree 1 file changed +18
-6
lines changed Original file line number Diff line number Diff line change 1- # Gihub Actions launch scheduled workflows of the main branch only (sycl).
1+ # Github Actions launch scheduled workflows of the main branch only (sycl).
22# This is a workaround to set a scheduled launch of the sycl-rel-nightly.yml
33# workflow, which is located on the sycl-rel-* branch.
44
@@ -7,10 +7,8 @@ name: Scheduled sycl-rel-nightly launch
77permissions : read-all
88
99on :
10- # The sycl-rel-nightly.yml workflow file on the sycl-rel-6_2 branch is most
11- # likely stale. Do not schedule before it's updated.
12- # schedule:
13- # - cron: '0 3 * * *'
10+ schedule :
11+ - cron : ' 0 3 * * *'
1412 workflow_dispatch :
1513
1614jobs :
2321 - name : Launch
2422 env :
2523 GH_TOKEN : ${{ github.token }}
24+ # To avoid excessive scheduled runs this script also checks if there are
25+ # new commits since the last run - it checks if the latest commit is
26+ # older >24h. That means the previous run already tested this commit.
2627 run : |
27- gh workflow run sycl-rel-nightly.yml --repo ${{ github.repository }} --ref sycl-rel-6_2
28+ if [ "$GITHUB_EVENT_NAME" = "schedule" ]; then
29+ latest_commit_time=$(curl -s https://api.github.com/repos/intel/llvm/commits/sycl-rel-6_2 | jq -r '.commit.committer.date')
30+ echo $latest_commit_time
31+ latest_commit_epoch=$(date -d "$latest_commit_time" +%s)
32+ now_epoch=$(date +%s)
33+ diff=$((now_epoch - latest_commit_epoch))
34+ if [ "$diff" -lt 86400 ]; then
35+ gh workflow run sycl-rel-nightly.yml --repo "${GITHUB_REPOSITORY}" --ref sycl-rel-6_2
36+ fi
37+ else
38+ gh workflow run sycl-rel-nightly.yml --repo "${GITHUB_REPOSITORY}" --ref sycl-rel-6_2
39+ fi
You can’t perform that action at this time.
0 commit comments