Skip to content

Commit 8b2cf52

Browse files
authored
[CI][sycl-rel] Update scheduled launch (#19024)
sycl-rel-6_2 was updated and now ready for scheduled runs.
1 parent fda28ba commit 8b2cf52

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed
Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
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
77
permissions: read-all
88

99
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 * * *'
1412
workflow_dispatch:
1513

1614
jobs:
@@ -23,5 +21,19 @@ jobs:
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

0 commit comments

Comments
 (0)