From 1edfe2c59a3811d0c1f88b6cbc15c59c9e8e2d4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Liebau?= Date: Thu, 19 Nov 2026 14:36:00 +0100 Subject: [PATCH] Remove duplicated list of repository names from github action and add a job that generates the list from the source of truth in config/repositories.yaml instead. Also adds a check that repository names are unique. --- .github/workflows/generate_prs.yml | 48 ++++++++++++++++++------------ config/repositories.yaml | 4 +-- playbook/playbook.yaml | 6 ++++ 3 files changed, 37 insertions(+), 21 deletions(-) diff --git a/.github/workflows/generate_prs.yml b/.github/workflows/generate_prs.yml index f619fc7b..1c1df0e8 100644 --- a/.github/workflows/generate_prs.yml +++ b/.github/workflows/generate_prs.yml @@ -23,32 +23,42 @@ on: permissions: {} jobs: + list-repositories: + runs-on: ubuntu-latest + permissions: + contents: read + outputs: + repositories: ${{ steps.list.outputs.repositories }} + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + # config/repositories.yaml is the single source of truth for the matrix below + - name: List repositories from config/repositories.yaml + id: list + run: | + set -euo pipefail + repos=$(yq -o=json -I=0 '[.repositories[].name]' config/repositories.yaml) + if [ "$(jq 'length' <<< "$repos")" -eq 0 ]; then + echo "::error::No repositories found in config/repositories.yaml" + exit 1 + fi + dupes=$(jq -r 'group_by(.)[] | select(length > 1) | .[0]' <<< "$repos") + if [ -n "$dupes" ]; then + echo "::error::Duplicate repository names in config/repositories.yaml: $dupes" + exit 1 + fi + echo "repositories=$repos" >> "$GITHUB_OUTPUT" + create-prs: + needs: list-repositories runs-on: ubuntu-latest permissions: contents: read strategy: fail-fast: ${{ inputs.fail-fast }} matrix: - # This should be the list of repository names from config/repositories.yaml: - # yq '.repositories | map(.name)' config/repositories.yaml - repository: - - airflow-operator - - commons-operator - - druid-operator - - hbase-operator - - hdfs-operator - - hive-operator - - kafka-operator - - nifi-operator - - listener-operator - - opa-operator - - opensearch-operator - - secret-operator - - spark-k8s-operator - - superset-operator - - trino-operator - - zookeeper-operator + repository: ${{ fromJSON(needs.list-repositories.outputs.repositories) }} steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: diff --git a/config/repositories.yaml b/config/repositories.yaml index 53ad63c9..8f048224 100644 --- a/config/repositories.yaml +++ b/config/repositories.yaml @@ -1,5 +1,5 @@ -# If you add a new repository here, you also need to add it to the list of -# repositories in ../.github/workflows/generate_prs.yml. +# This is the single source of truth for the list of repositories. +# ../.github/workflows/generate_prs.yml builds its matrix from the names in here. # # chart_description, keywords and artifacthub_category end up in the Helm chart's # Chart.yaml and are indexed by Artifact Hub and our own Hub. Descriptions deliberately diff --git a/playbook/playbook.yaml b/playbook/playbook.yaml index 91fc9900..2c681a98 100644 --- a/playbook/playbook.yaml +++ b/playbook/playbook.yaml @@ -12,6 +12,12 @@ with_fileglob: - "../config/*.yaml" + - name: Ensure repository names are unique + assert: + that: repositories | map(attribute='name') | unique | length == repositories | length + fail_msg: "Duplicate repository names in config/repositories.yaml" + tags: local + - name: Ensure work directory exists file: path: "{{ work_dir }}"