Skip to content

Ariane scheduled workflows #1095

Ariane scheduled workflows

Ariane scheduled workflows #1095

name: Ariane scheduled workflows
on:
# Run every 1 hours
# Tests are only run when current hour % 6 corresponds
# to the branch hourModulo value in the matrix
schedule:
- cron: '0 */1 * * *'
permissions:
# To be able to access the repository with actions/checkout
contents: read
# To trigger workflows via workflow_dispatch
actions: write
jobs:
ariane-scheduled:
name: Run Scheduled Workflows
strategy:
fail-fast: false
matrix:
include:
# DON'T USE hourModulo=0 to avoid running ariane scheduled-workflows
# at the same time as regular main scheduled workflows
- branch: '1.13'
hourModulo: 1
- branch: '1.14'
hourModulo: 2
- branch: '1.15'
hourModulo: 3
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
ref: v${{ matrix.branch }}
persist-credentials: false
- name: Manually run Ariane workflows from the branch
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
HOUR=$(date -u +"%H")
if (( HOUR % 6 == ${{ matrix.hourModulo }} )); then
echo "Running scheduled workflows for branch ${{ matrix.branch }}"
else
echo "Skipping scheduled workflows for branch ${{ matrix.branch }}"
exit 0
fi
BRANCH="${{ matrix.branch }}"
REF="v${BRANCH}"
SHA=$(git rev-parse ${REF})
readarray workflows < <(TRIGGER="/test-backport-${BRANCH}" yq '.triggers[env(TRIGGER)].workflows[]' .github/ariane-config.yaml)
for workflow in ${workflows[@]}; do
echo triggering ${workflow}
gh workflow run ${workflow} \
--ref ${REF} \
-f PR-number=${REF/./-} \
-f context-ref=${REF} \
-f SHA=${SHA}
done