diff --git a/.github/workflows/f6-1-patch-presentation-ci.yml b/.github/workflows/f6-1-patch-presentation-ci.yml new file mode 100644 index 0000000..399140b --- /dev/null +++ b/.github/workflows/f6-1-patch-presentation-ci.yml @@ -0,0 +1,72 @@ +name: F6.1 patch presentation CI + +on: + push: + branches: + - 'release/f6-1-presentation-territory' + paths: + - '.github/workflows/f6-1-patch-presentation-ci.yml' + +permissions: + contents: write + +jobs: + patch: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + ref: release/f6-1-presentation-territory + fetch-depth: 0 + + - name: Update clean migration rehearsal contract + run: | + python - <<'PY' + from pathlib import Path + path=Path('.github/workflows/ci.yml') + text=path.read_text() + text=text.replace( + '# F5.1 intentionally ends with zero operational/domain instances. The\n # technical family and finding masters remain, but territory preload,\n # imports, applicability links and old audits are deliberately gone.', + '# F5.1 performs the historical clean start. F6.1 then seeds only the\n # presentation territory approved by DH: 7 Departamentos, 64 Áreas,\n # 230 Yacimientos and 12 real Empresas.' + ) + text=text.replace( + ' territory_sources integer;\n', + ' territory_sources integer;\n presentation_sources integer;\n' + ) + old=""" IF domain_assets <> 0 THEN + RAISE EXCEPTION 'F5.1 clean start must contain 0 Assets, got %', domain_assets; + END IF;""" + new=""" IF domain_assets <> 313 THEN + RAISE EXCEPTION 'F6.1 presentation preload must contain 313 Assets, got %', domain_assets; + END IF;""" + if old not in text: raise SystemExit('domain asset CI contract not found') + text=text.replace(old,new) + old=""" SELECT COUNT(*) INTO territory_sources + FROM source_documents + WHERE document_number='DH-F5-TERRITORY'; + IF territory_sources <> 0 THEN + RAISE EXCEPTION 'F5.1 must remove the old territory source preload, got % rows', territory_sources; + END IF; +""" + new=old+""" + SELECT COUNT(*) INTO presentation_sources + FROM source_documents + WHERE document_number='DH-F6.1-PRESENTATION-TERRITORY-20260909'; + IF presentation_sources <> 1 THEN + RAISE EXCEPTION 'F6.1 must contain exactly one presentation territory source, got %', presentation_sources; + END IF; +""" + if old not in text: raise SystemExit('territory source CI contract not found') + path.write_text(text.replace(old,new)) + Path('.github/workflows/f6-1-patch-presentation-ci.yml').unlink() + PY + + - name: Commit CI contract + run: | + set -Eeuo pipefail + git config user.name 'github-actions[bot]' + git config user.email '41898282+github-actions[bot]@users.noreply.github.com' + git add .github/workflows/ci.yml .github/workflows/f6-1-patch-presentation-ci.yml + git diff --cached --check + git commit -m 'ci(F6.1): rehearse presentation territory baseline' + git push origin HEAD:release/f6-1-presentation-territory