Skip to content

Nightly trigger (beta) #133

Nightly trigger (beta)

Nightly trigger (beta) #133

# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This workflow is meant as an extended CI run that includes certain features that shall be tested
# and JDK versions that are supported but not considered default.
name: "Nightly trigger (beta)"
on:
schedule:
- cron: '0 2 * * *'
workflow_dispatch:
jobs:
Trigger:
#if: github.repository == 'apache/flink'
permissions:
actions: write
runs-on: ubuntu-latest
steps:
- name: "Flink Checkout"
uses: actions/checkout@v4
with:
persist-credentials: false
- name: "Extracts release branch from checkout"
id: release_branch_extraction_step
uses: "./.github/actions/release_branch_extraction"
- name: "Select release branch for nightly run"
id: select_release_branch
run: |
day_of_year="$(date +%j)"
echo "Day of year: $day_of_year"
# each release branch should run every 3rd day to reduce load on the Apache Infra runners
release_branch="no branch"
if [[ "$(( $day_of_year % 3))" -eq 1 ]]; then
release_branch="${{ steps.release_branch_extraction_step.outputs.newest_release }}"
else if [[ "$(( $day_of_year % 3))" -eq 2 ]]; then
release_branch="${{ steps.release_branch_extraction_step.outputs.penultimate_release }}"
fi
echo "$release_branch selected for nightly run"
echo "release_branch=${release_branch}" >> ${GITHUB_OUTPUT}
- name: "Trigger master nightly"
uses: actions/github-script@v7
with:
script: |
github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'nightly.yml',
ref: 'master'
})
- name: "Trigger nightly for ${{ steps.select_release_branch.release_branch }}"
uses: actions/github-script@v7
if: ${{ steps.select_release_branch.outputs.release_branch != 'no branch' }}
with:
script: |
github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'nightly.yml',
ref: '${{ steps.select_release_branch.outputs.release_branch }}'
})