Ariane scheduled workflows #855
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.14' | |
hourModulo: 1 | |
- branch: '1.15' | |
hourModulo: 2 | |
- branch: '1.16' | |
hourModulo: 3 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout branch | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
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 |