Skip to content

feat(iit,#8236): ICT-43 Phase 0 — inventaire SAE multi-échelle mesuré au Hub #5900

feat(iit,#8236): ICT-43 Phase 0 — inventaire SAE multi-échelle mesuré au Hub

feat(iit,#8236): ICT-43 Phase 0 — inventaire SAE multi-échelle mesuré au Hub #5900

name: Notebook Papermill Ratchet
# #11155 (tier 2 of #11146) — ratchet gate: a PR that changes the outputs /
# execution_count of a notebook must not leave a metadata.papermill block
# byte-identical to base — that block describes the PREVIOUS run, not the one
# that produced the committed outputs. Legal escapes (by design of the issue):
# outputs untouched (markdown-only edit), block removed, block moved/added.
# No retroactive catch-up: the 576 stale candidates measured on main
# (#11146) never enter the diff, so the gate is green on main from day one.
on:
pull_request:
branches: [main]
types: [opened, synchronize, edited, reopened]
paths:
- '**.ipynb'
- 'scripts/notebook_tools/check_papermill_ratchet.py'
- '.github/workflows/notebook-papermill-ratchet.yml'
workflow_dispatch:
inputs:
base_ref:
description: 'Base ref to ratchet against (default origin/main)'
required: false
default: 'origin/main'
permissions:
contents: read
concurrency:
group: notebook-papermill-ratchet-${{ github.ref }}
cancel-in-progress: true
jobs:
ratchet:
name: Papermill ratchet (base vs PR)
# Route vers la jambe Linux auto-hebergee (#13378 tranche 1, decision ai-01
# 2026-09-01) : garde Python pur, sans secret ni usage du GITHUB_TOKEN. La garde
# same-repo ci-dessous saute les PRs de fork (pr_gate.py compte `skipped` comme
# OK) : aucun code de fork n'atteint le runner. Retour arriere = revert de la PR.
runs-on: [self-hosted, coursia-ephemeral, coursia-linux]
if: github.event.pull_request.head.repo.full_name == null || github.event.pull_request.head.repo.full_name == github.repository
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
filter: blob:none
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
# Refs reach the script via env, never inline in the run script
# (script-injection guard, same as notebook-exec-sequence-ratchet.yml).
- name: Ratchet check
env:
BASE_REF: ${{ github.event.inputs.base_ref }}
PR_BASE: ${{ github.base_ref }}
run: |
BASE="${BASE_REF:-origin/${PR_BASE:-main}}"
python scripts/notebook_tools/check_papermill_ratchet.py "$BASE"
- name: Ratchet unit tests
run: |
python -m pip install --quiet pytest
python -m pytest scripts/notebook_tools/tests/test_check_papermill_ratchet.py -q