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).
2
2
# This is a workaround to set a scheduled launch of the sycl-rel-nightly.yml
3
3
# workflow, which is located on the sycl-rel-* branch.
4
4
@@ -7,10 +7,8 @@ name: Scheduled sycl-rel-nightly launch
7
7
permissions : read-all
8
8
9
9
on :
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 * * *'
14
12
workflow_dispatch :
15
13
16
14
jobs :
23
21
- name : Launch
24
22
env :
25
23
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.
26
27
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