Skip to content

Scheduled CI

Scheduled CI #163

Workflow file for this run

# Copyright © SixtyFPS GmbH <info@slint.dev>
# SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
# Run full CI on active branches 3x/day, only if they have recent changes
name: Scheduled CI
on:
schedule:
# One night build + two during the European working day
# 1:00 UTC = ~2:00-3:00 CET, 9:00 UTC = ~10:00-11:00 CET, 14:00 UTC = ~15:00-16:00 CET
- cron: '18 1,9,14 * * *'
workflow_dispatch:
inputs:
branch:
description: 'Specific branch to test (blank = auto-discover active branches)'
type: string
default: ''
jobs:
discover-and-trigger:
runs-on: ubuntu-latest
steps:
- name: Trigger CI on branches with recent changes
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [ -n "${{ inputs.branch }}" ]; then
echo "Triggering full CI for ${{ inputs.branch }}"
gh workflow run "CI" --repo ${{ github.repository }} --ref "${{ inputs.branch }}" -f full=true
exit 0
fi
BRANCHES=$(gh api repos/${{ github.repository }}/branches --paginate -q '.[].name | select(test("^(master|feature/|pre-release/)"))' )
for branch in $BRANCHES; do
# Check for commits in the last 9 hours
since=$(date -u -d '9 hours ago' '+%Y-%m-%dT%H:%M:%SZ')
count=$(gh api "repos/${{ github.repository }}/commits?sha=$branch&since=$since&per_page=1" -q 'length')
if [ "$count" -gt 0 ]; then
echo "Triggering full CI for $branch"
gh workflow run "CI" --repo ${{ github.repository }} --ref "$branch" -f full=true
else
echo "No recent changes on $branch, skipping"
fi
done