Skip to content

call-update

call-update #30

Workflow file for this run

name: call-update
on:
# Runs every Saturday at noon
schedule:
- cron: "*/5 * * * *"
# Allow manual triggering
workflow_dispatch:
inputs:
main:
type: boolean
default: true
nixos-24.05:
type: boolean
default: true
env:
# `inputs` are missing when run "scheduled", so set defaults
defaults: '{ "main": "true", "nixos-24.05": "true" }'
jobs:
setup-matrix:
name: Get selected branches
runs-on: ubuntu-latest
outputs:
branches: ${{ steps.selected.outputs.branches }}
env:
inputs: ${{ toJSON(github.event.inputs) }}
steps:
- name: Get selected branches
id: selected
run: |
# Combine $defaults & $inputs, then select keys with the value "true"
query='.[0] * .[1] | map_values(select(. == "true")) | keys'
selected=$(echo "[ $defaults, $inputs ]" | jq -c "$query")
echo "branches: $selected"
echo "branches=$selected" >> "$GITHUB_OUTPUT"
call-update:
name: Call update
runs-on: ubuntu-latest
needs: setup-matrix
strategy:
matrix:
branch: ${{ fromJSON(needs.setup-matrix.outputs.branches) }}
env:
GH_TOKEN: ${{ github.token }}
steps:
- name: Call update on ${{ matrix.branch }}
run: |
gh workflow run update.yml \
--repo ${{ github.repository}} \
--ref ${{ matrix.branch }}