diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 9fa9522..9ee06db 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -25,7 +25,7 @@ jobs: run: pip install ".[dev]" - name: Session handover gate - run: python3 scripts/session_handover_check.py --strict + run: python3 scripts/session_handover_check.py --strict --ci - name: Validate governance assets env: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index da84fc7..40f340d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,7 @@ jobs: run: pip install ".[dev]" - name: Session handover gate - run: python3 scripts/session_handover_check.py --strict + run: python3 scripts/session_handover_check.py --strict --ci - name: Validate governance assets env: diff --git a/scripts/session_handover_check.py b/scripts/session_handover_check.py index b2ded16..7b354be 100755 --- a/scripts/session_handover_check.py +++ b/scripts/session_handover_check.py @@ -66,6 +66,7 @@ def _check_handover_entry( *, branch: str, strict: bool, + ci_mode: bool, errors: list[str], ) -> None: if not HANDOVER_LOG.exists(): @@ -87,7 +88,7 @@ def _check_handover_entry( if token not in latest: errors.append(f"latest handover entry missing token: {token}") - if strict: + if strict and not ci_mode: today_utc = datetime.now(UTC).date().isoformat() if today_utc not in latest: errors.append( @@ -117,6 +118,14 @@ def main() -> int: action="store_true", help="Enforce today-date and current-branch match on latest handover entry.", ) + parser.add_argument( + "--ci", + action="store_true", + help=( + "CI mode: keep structural/token checks but skip strict " + "today-date/current-branch matching." + ), + ) args = parser.parse_args() errors: list[str] = [] @@ -128,7 +137,12 @@ def main() -> int: elif branch in {"main", "master"}: errors.append(f"working branch must not be {branch}") - _check_handover_entry(branch=branch, strict=args.strict, errors=errors) + _check_handover_entry( + branch=branch, + strict=args.strict, + ci_mode=args.ci, + errors=errors, + ) if errors: print("[FAIL] session handover check failed")