Skip to content

Scheduled sycl-rel-nightly launch #19

Scheduled sycl-rel-nightly launch

Scheduled sycl-rel-nightly launch #19

# Github Actions launch scheduled workflows of the main branch only (sycl).
# This is a workaround to set a scheduled launch of the sycl-rel-nightly.yml
# workflow, which is located on the sycl-rel-* branch.
name: Scheduled sycl-rel-nightly launch
permissions: read-all
on:
schedule:
- cron: '0 3 * * *'
workflow_dispatch:
jobs:
# To avoid excessive scheduled runs this job checks if there are new commits
# since the last run. More precisely, it checks if the latest commit is older
# than 24h. That means the previous run already tested this commit.
check_for_new_commits:
if: github.repository == 'intel/llvm'
runs-on: ubuntu-latest
name: Check for new commits
outputs:
is_new_commit: ${{ steps.is_new_commit.outputs.is_new_commit }}
steps:
- name: Check
id: check
# if: github.event_name == 'schedule'
run: |
latest_commit_time=$(curl -s https://api.github.com/repos/intel/llvm/commits/sycl-rel-6_2 | jq -r '.commit.committer.date')
echo $latest_commit_time
latest_commit_epoch=$(date -d "$latest_commit_time" +%s)
now_epoch=$(date +%s)
diff=$((now_epoch - latest_commit_epoch))
echo "is_new_commit=$([ "$diff" -lt 86400 ] && echo true || echo false)" >> $GITHUB_OUTPUT
launch:
needs: [check_for_new_commits]
# if: ${{ github.repository == 'intel/llvm' && needs.check_for_new_commits.outputs.is_new_commit != 'false' }}
if: ${{ github.repository == 'intel/llvm' && needs.check_for_new_commits.outputs.is_new_commit != 'false' }}
permissions:
actions: write
runs-on: ubuntu-latest
steps:
- name: Launch
env:
GH_TOKEN: ${{ github.token }}
run: |
# gh workflow run sycl-rel-nightly.yml --repo ${{ github.repository }} --ref sycl-rel-6_2
echo "launch"