Skip to content

multiple dependent repos fixes #49

multiple dependent repos fixes

multiple dependent repos fixes #49

Workflow file for this run

name: CI-Scripts

Check failure on line 1 in .github/workflows/ci-scripts.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/ci-scripts.yml

Invalid workflow file

(Line: 68, Col: 9): Unrecognized named-value: 'matrix'. Located at position 1 within expression: matrix.noop != true
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' }}"
EVENT="${{ github.event_name }}"
if [[ "$EVENT" != "push" && "$EVENT" != "schedule" && "$EVENT" != "workflow_dispatch" && "$EVENT" != "workflow_call" ]]; then
echo "Dependent builds: disabled: unsupported event=$EVENT"
echo 'matrix={"include":[{"noop":true}]}' >> "$GITHUB_OUTPUT"
exit 0
fi
if [[ ( "$EVENT" == "workflow_dispatch" || "$EVENT" == "workflow_call" ) && "$BUILD_DEPENDENT" != "true" ]]; then
echo "Dependent builds: disabled: build-dependent input is false"
echo 'matrix={"include":[{"noop":true}]}' >> "$GITHUB_OUTPUT"
exit 0
fi
if [[ ! -f ./.github/dependent-repositories.txt ]]; then
echo "Dependent builds: disabled: dependent-repositories.txt not found"
echo 'matrix={"include":[{"noop":true}]}' >> "$GITHUB_OUTPUT"
exit 0
fi
count="$(jq -e '.include | if type=="array" then length else error(".include must be an array") end' ./.github/dependent-repositories.txt)"
if [[ "$count" == "0" ]]; then
echo "Dependent builds: disabled: dependent-repositories.txt empty"
echo 'matrix={"include":[{"noop":true}]}' >> "$GITHUB_OUTPUT"
exit 0
fi
matrix="$(jq -c '.' ./.github/dependent-repositories.txt)"
echo "Dependent builds: enabled"
echo "matrix=$matrix" >> "$GITHUB_OUTPUT"
build-dependent:
needs: [create-dependent-matrix]
runs-on: ubuntu-latest
name: 'Build dependent'
if: ${{ matrix.noop != true }}
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 }}" }'