Skip to content

multiple dependent repos fixes #48

multiple dependent repos fixes

multiple dependent repos fixes #48

Workflow file for this run

name: CI-Scripts
on:
workflow_dispatch:
inputs:
build-dependent:
description: 'Should build dependent repositories?'
required: false
default: false
type: boolean
push:
branches:
- 'master'
schedule:
- cron: "42 23 31 12 *"
jobs:
create-dependent-matrix:
runs-on: ubuntu-latest
name: 'Find dependent repositories'
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout repository
uses: actions/[email protected]
- name: Create dependent build matrix (or empty)
id: set-matrix
shell: bash
run: |
BUILD_DEPENDENT="${{ inputs.build-dependent || github.event.inputs.build-dependent || 'false' }}"
# Enabled on push/schedule, or when explicitly requested via input
if [[ "${{ github.event_name }}" == "push" || "${{ github.event_name }}" == "schedule" || "${BUILD_DEPENDENT}" == "true" ]]; then
if [[ ! -f ./.github/dependent-repositories.txt ]]; then
echo "Dependent builds: disabled: dependent-repositories.txt not found"
echo 'matrix=[]' >> "$GITHUB_OUTPUT"
exit 0
fi
matrix="$(tr -d '[:space:]' < ./.github/dependent-repositories.txt)"
if [[ -z "${matrix}" || "${matrix}" == "[]" ]]; then
echo "Dependent builds: disabled: dependent-repositories.txt empty"
echo 'matrix=[]' >> "$GITHUB_OUTPUT"
exit 0
fi
echo "Dependent builds: enabled"
echo "matrix=$matrix" >> "$GITHUB_OUTPUT"
exit 0
fi
echo "Dependent builds: disabled: event=${{ github.event_name }} (set build-dependent=true to enable)"
echo 'matrix=[]' >> "$GITHUB_OUTPUT"
build-dependent:
needs: [create-dependent-matrix]
runs-on: ubuntu-latest
name: 'Build dependent'
if: ${{ needs.create-dependent-matrix.outputs.matrix != '[]' && needs.create-dependent-matrix.outputs.matrix != '' }}
strategy:
matrix: ${{fromJson(needs.create-dependent-matrix.outputs.matrix)}}
steps:
- name: Start ${{ matrix.repository }} build
uses: benc-uk/[email protected]
with:
workflow: Nightly
repo: ${{ matrix.repository }}
ref: ${{ matrix.branch }}
token: ${{ secrets.WORKFLOW_ACCESS_TOKEN }}
inputs: '{ "build-dependent": "${{ matrix.build-dependent }}" }'