From 8095bfda8bbcc48a8a37fea897e8208629f5ae3a Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Thu, 27 Aug 2026 13:23:10 +0300 Subject: [PATCH] Run every Molecule scenario when the shared files change molecule-shared/ and the workflow itself are used by every scenario, so a change to either has to run all of them rather than only the roles whose own files moved. They were also missing from the paths filter, so such a change would not have triggered the workflow at all. Co-Authored-By: Claude Opus 5 (1M context) --- .github/workflows/molecule.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/molecule.yml b/.github/workflows/molecule.yml index 432d072c3..abdc571bb 100644 --- a/.github/workflows/molecule.yml +++ b/.github/workflows/molecule.yml @@ -14,10 +14,12 @@ on: # yamllint disable-line rule:truthy push: paths: - "roles/custom/**" + - "molecule-shared/**" - ".github/workflows/molecule.yml" pull_request: paths: - "roles/custom/**" + - "molecule-shared/**" - ".github/workflows/molecule.yml" workflow_dispatch: inputs: @@ -90,13 +92,22 @@ jobs: ;; esac + # molecule-shared/ is used by every scenario, so a change there means + # every role has to run, not just the ones whose own files moved. + shared_changed="" if [ -n "${base}" ]; then + shared_changed="$(git diff --name-only "${base}" HEAD -- 'molecule-shared/*' '.github/workflows/molecule.yml' || true)" + fi + + if [ -n "${base}" ] && [ -z "${shared_changed}" ]; then changed="$(git diff --name-only "${base}" HEAD -- 'roles/custom/*' || true)" candidates="$(printf '%s\n' "${changed}" | awk -F/ 'NF>2 {print $3}' | sort -u)" echo "Changed roles: ${candidates:-none}" else + if [ -n "${shared_changed}" ]; then + echo "Shared Molecule files changed; considering every role" + fi candidates="$(find roles/custom -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | sort)" - echo "No usable diff base; considering every role" fi selected=""