Skip to content

Commit 9a89471

Browse files
committed
init
1 parent 9830842 commit 9a89471

File tree

1 file changed

+29
-7
lines changed

1 file changed

+29
-7
lines changed
Lines changed: 29 additions & 7 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,15 +7,36 @@ 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:
17-
launch:
15+
# To avoid excessive scheduled runs this job checks if there are new commits
16+
# since the last run. More precisely, it checks if the latest commit is older
17+
# than 24h. That means the previous run already tested this commit.
18+
check_for_new_commits:
1819
if: github.repository == 'intel/llvm'
20+
runs-on: ubuntu-latest
21+
name: Check for new commits
22+
outputs:
23+
is_new_commit: ${{ steps.is_new_commit.outputs.is_new_commit }}
24+
steps:
25+
- name: Check
26+
id: check
27+
# if: github.event_name == 'schedule'
28+
run: |
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+
echo "is_new_commit=$([ "$diff" -lt 86400 ] && echo true || echo false)" >> $GITHUB_OUTPUT
35+
36+
launch:
37+
needs: [check_for_new_commits]
38+
# if: ${{ github.repository == 'intel/llvm' && needs.check_for_new_commits.outputs.is_new_commit != 'false' }}
39+
if: ${{ github.repository == 'intel/llvm' && needs.check_for_new_commits.outputs.is_new_commit != 'false' }}
1940
permissions:
2041
actions: write
2142
runs-on: ubuntu-latest
@@ -24,4 +45,5 @@ jobs:
2445
env:
2546
GH_TOKEN: ${{ github.token }}
2647
run: |
27-
gh workflow run sycl-rel-nightly.yml --repo ${{ github.repository }} --ref sycl-rel-6_2
48+
# gh workflow run sycl-rel-nightly.yml --repo ${{ github.repository }} --ref sycl-rel-6_2
49+
echo "launch"

0 commit comments

Comments
 (0)