mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Trigger schedule(nightly) builds on non default branches
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
parent
2dbdea9065
commit
01a465fa88
2 changed files with 43 additions and 0 deletions
14
.github/workflows/nightly.yml
vendored
14
.github/workflows/nightly.yml
vendored
|
@ -4,6 +4,7 @@
|
|||
name: Nightly
|
||||
|
||||
on:
|
||||
workflow_dispatch: {}
|
||||
schedule:
|
||||
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onschedule
|
||||
- cron: '0 3 * * *' # Every day at 3AM
|
||||
|
@ -16,6 +17,7 @@ env:
|
|||
permissions:
|
||||
contents: read # for dorny/paths-filter to fetch a list of changed files
|
||||
pull-requests: read # for dorny/paths-filter to read pull requests
|
||||
actions: write # to trigger branch nightly builds
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.repository }}-${{ github.head_ref || github.run_id }}
|
||||
|
@ -23,6 +25,17 @@ concurrency:
|
|||
|
||||
jobs:
|
||||
|
||||
trigger-branch-nightly-builds:
|
||||
name: Trigger Branch Schedule Workflows
|
||||
if: ${{ github.event_name == 'schedule' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Trigger 3006.x branch
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
gh workflow run nightly.yml --repo ${{ github.repository }} --ref 3006.x
|
||||
|
||||
prepare-workflow:
|
||||
name: Prepare Workflow Run
|
||||
runs-on: ubuntu-latest
|
||||
|
@ -1732,6 +1745,7 @@ jobs:
|
|||
if: always()
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- trigger-branch-nightly-builds
|
||||
- prepare-workflow
|
||||
- pre-commit
|
||||
- lint
|
||||
|
|
29
.github/workflows/templates/nightly.yml.jinja
vendored
29
.github/workflows/templates/nightly.yml.jinja
vendored
|
@ -4,6 +4,7 @@
|
|||
<%- block on %>
|
||||
|
||||
on:
|
||||
workflow_dispatch: {}
|
||||
schedule:
|
||||
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onschedule
|
||||
- cron: '0 3 * * *' # Every day at 3AM
|
||||
|
@ -18,6 +19,34 @@ concurrency:
|
|||
|
||||
<%- endblock concurrency %>
|
||||
|
||||
<%- block permissions %>
|
||||
<{- super() }>
|
||||
<%- if workflow_slug == "nightly" %>
|
||||
actions: write # to trigger branch nightly builds
|
||||
<%- endif %>
|
||||
<%- endblock permissions %>
|
||||
|
||||
<%- block pre_jobs %>
|
||||
|
||||
<%- set job_name = "trigger-branch-nightly-builds" %>
|
||||
<%- set branches = ["3006.x"] %>
|
||||
|
||||
<{ job_name }>:
|
||||
<%- do conclusion_needs.append(job_name) %>
|
||||
name: Trigger Branch Schedule Workflows
|
||||
if: ${{ github.event_name == 'schedule' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
<%- for branch in branches %>
|
||||
- name: Trigger <{ branch }> branch
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
gh workflow run <{ gh_environment }>.yml --repo ${{ github.repository }} --ref <{ branch }>
|
||||
<%- endfor %>
|
||||
|
||||
<%- endblock pre_jobs %>
|
||||
|
||||
<%- block jobs %>
|
||||
<{- super() }>
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue