Files
Knightly/.github/workflows/dispatcher.yml

94 lines
2.5 KiB
YAML

name: Dispatcher
on:
push:
branches:
- '**'
jobs:
dispatch:
runs-on: self-hosted
outputs:
engine: ${{ steps.check.outputs.engine }}
server: ${{ steps.check.outputs.server }}
ui: ${{ steps.check.outputs.ui }}
steps:
- name: Determine which tests to run
id: check
run: |
BRANCH="${{ github.ref_name }}"
echo "Branch: $BRANCH"
ENGINE=false
SERVER=false
UI=false
if [[ "$BRANCH" == *"Engine"* ]]; then
ENGINE=true
fi
if [[ "$BRANCH" == *"Server"* ]]; then
SERVER=true
fi
if [[ "$BRANCH" == *"UI"* ]]; then
UI=true
fi
# Run all on master
if [[ "$BRANCH" == "master" ]]; then
ENGINE=true
SERVER=true
UI=true
fi
echo "engine=$ENGINE" >> $GITHUB_OUTPUT
echo "server=$SERVER" >> $GITHUB_OUTPUT
echo "ui=$UI" >> $GITHUB_OUTPUT
- name: Trigger Engine Test
if: steps.check.outputs.engine == 'true'
uses: actions/github-script@v7
with:
script: |
github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'engine_test.yml',
ref: '${{ github.ref }}',
inputs: {
triggered_by: 'dispatch.yml',
branch: '${{ github.ref_name }}'
}
})
- name: Trigger Server Test
if: steps.check.outputs.server == 'true'
uses: actions/github-script@v7
with:
script: |
github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'server_test.yml',
ref: '${{ github.ref }}',
inputs: {
triggered_by: 'dispatch.yml',
branch: '${{ github.ref_name }}'
}
})
- name: Trigger UI Test
if: steps.check.outputs.ui == 'true'
uses: actions/github-script@v7
with:
script: |
github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'ui_test.yml',
ref: '${{ github.ref }}',
inputs: {
triggered_by: 'dispatch.yml',
branch: '${{ github.ref_name }}'
}
})