fix(ci): pr-iphone-deploy.yml fails to parse — indent python3 body inside run: | #14

Merged
millianlmx merged 3 commits from fix/ci-yaml-indent into main 2026-07-20 09:51:21 +02:00
Owner

Bug

pr-iphone-deploy.yml does not run on any PR. The workflow file fails to parse, so Gitea Actions never creates a run for it.

Root cause

In PR #13, the LGTM scanner was rewritten as an inline python3 heredoc inside wait-approval's run: | block. The python body was written at column 0:

            DECISION=$(python3 - "$COMMENTS" <<'PY'
import json, re, sys      # ← column 0
...
PY
            )

But YAML block scalars require content to be more indented than the parent key. YAML exits the block scalar at the first column-0 line (import json, re, sys) and tries to parse the python as YAML, failing with:

could not find expected ':' at line 257, column 1

The result: pr-iphone-deploy.yml couldn't load at all, so no run was ever created — even on PRs that touched the Swift app. The trigger fix and self-merge fix from PR #13 are both on main and correct, but unreachable because the file doesn't parse.

PR #13 was merged before this issue was noticed, so this fix ships as a separate PR.

Fix

Switch the inline python from a <<'PY' heredoc (column-0 body) to python3 -c '...' with the body indented to sit inside the run: | block scalar. Behavior is identical — same json.loads + \bLGTM\b/\bKO\b regexes, same sentinel-marker skip, same KO-before-LGTM precedence.

Verified locally

  • yaml.safe_load now parses the workflow cleanly → jobs changes, build-deploy, wait-approval, all gates wired.
  • Extracted the python exactly as act will execute it and ran all three scenarios:
    • bot-only → PENDING (the self-merge fix from PR #13 still holds)
    • bot + reviewer LGTM → LGTM (squash-merge still fires)
    • bot + reviewer KO → KO (block still fires)

Validation on merge

After merge, the next PR that touches tabatago-swift/** should finally produce a pr-iphone-deploy.yml run with all three jobs (changesbuild-deploywait-approval). Watch for: no auto-merge within ~30s of the « Prêt à tester » comment (self-merge fix), then LGTM to merge.

Files

  • .github/workflows/pr-iphone-deploy.yml — indent python body only (1-file, ~27-line diff)
## Bug `pr-iphone-deploy.yml` does not run on any PR. The workflow file fails to parse, so Gitea Actions never creates a run for it. ## Root cause In PR #13, the LGTM scanner was rewritten as an inline `python3` heredoc inside `wait-approval`'s `run: |` block. The python body was written at **column 0**: ```yaml DECISION=$(python3 - "$COMMENTS" <<'PY' import json, re, sys # ← column 0 ... PY ) ``` But YAML block scalars require content to be **more indented than the parent key**. YAML exits the block scalar at the first column-0 line (`import json, re, sys`) and tries to parse the python as YAML, failing with: > `could not find expected ':'` at line 257, column 1 The result: **`pr-iphone-deploy.yml` couldn't load at all**, so no run was ever created — even on PRs that touched the Swift app. The trigger fix and self-merge fix from PR #13 are both on `main` and correct, but unreachable because the file doesn't parse. PR #13 was merged before this issue was noticed, so this fix ships as a separate PR. ## Fix Switch the inline python from a `<<'PY'` heredoc (column-0 body) to `python3 -c '...'` with the body **indented to sit inside the `run: |` block scalar**. Behavior is identical — same `json.loads` + `\bLGTM\b`/`\bKO\b` regexes, same sentinel-marker skip, same KO-before-LGTM precedence. ## Verified locally - `yaml.safe_load` now parses the workflow cleanly → jobs `changes`, `build-deploy`, `wait-approval`, all gates wired. - Extracted the python exactly as `act` will execute it and ran all three scenarios: - bot-only → **PENDING** (the self-merge fix from PR #13 still holds) - bot + reviewer LGTM → **LGTM** (squash-merge still fires) - bot + reviewer KO → **KO** (block still fires) ## Validation on merge After merge, the next PR that touches `tabatago-swift/**` should finally produce a `pr-iphone-deploy.yml` run with all three jobs (`changes` → `build-deploy` → `wait-approval`). Watch for: no auto-merge within ~30s of the « Prêt à tester » comment (self-merge fix), then `LGTM` to merge. ## Files - `.github/workflows/pr-iphone-deploy.yml` — indent python body only (1-file, ~27-line diff)
millianlmx added 1 commit 2026-07-20 09:22:11 +02:00
fix(ci): indent python3 -c body so YAML block scalar parses
Some checks failed
CI / Deploy (pull_request) Has been skipped
PR → Build → devicectl Deploy → LGTM / Build & Deploy to iPhone (devicectl) (pull_request) Successful in 2m39s
PR → Build → devicectl Deploy → LGTM / Wait for LGTM comment (pull_request) Failing after 31s
PR → Build → devicectl Deploy → LGTM / Detect Changes (pull_request) Successful in 3s
CI / Detect Changes (pull_request) Successful in 4s
CI / YouTube Worker (pull_request) Has been skipped
47106ff281
The python3 inline script in wait-approval was written at column 0 (lines 257-283), but YAML block scalars require content to be more indented than the parent key. YAML exited the run: | block at the first column-0 line ("import json, re, sys") and tried to parse the python as YAML, failing with "could not find expected :" at line 257 — which prevented pr-iphone-deploy.yml from running at all (no run was ever created for PRs that touched only the workflow file).

Fix: switch to python3 -c with the body indented to sit inside the run: | block scalar.

Verified locally:
  - yaml.safe_load parses the workflow cleanly (jobs: changes, build-deploy, wait-approval).
  - The extracted python, run exactly as act will execute it, returns:
      bot-only            -> PENDING  (was self-merging before)
      bot + reviewer LGTM -> LGTM     (squash-merge still fires)
      bot + reviewer KO   -> KO       (block still fires)
Author
Owner

📱 Prêt à tester !

L'app est déployée sur l'iPhone (devicectl).

  • Teste les changements
  • Reply LGTM pour merger
  • Reply KO pour bloquer
## 📱 Prêt à tester ! L'app est déployée sur l'iPhone (devicectl). <!-- tabatago:ready-to-test --> - Teste les changements - Reply **LGTM** pour merger - Reply **KO** pour bloquer
millianlmx added 1 commit 2026-07-20 09:34:30 +02:00
Standalone Python scanner extracted from the inline python in wait-approval. Embedding multi-line Python in a YAML run: | block scalar is fragile: YAML dedents block-scalar content to the first line's indent, which produced both YAML parse failures and Python IndentationErrors in earlier iterations of this workflow. A standalone script file sidesteps all of that and is testable locally.

Behavior preserved:
  - json.loads + \bLGTM\b / \bKO\b word-boundary regex (case-insensitive)
  - skip bot comments tagged with <!-- tabatago:ready-to-test -->
  - KO checked BEFORE LGTM (PR with both signals blocks)

Verified locally across 8 scenarios (bot-only, LGTM, KO, both, empty, usage error, KOM/LGTMX non-match, case-insensitive).
millianlmx added 1 commit 2026-07-20 09:34:31 +02:00
fix(ci): call scripts/pr_lgtm_scanner.py instead of inline python
All checks were successful
CI / Detect Changes (pull_request) Successful in 3s
PR → Build → devicectl Deploy → LGTM / Detect Changes (pull_request) Successful in 4s
CI / Deploy (pull_request) Has been skipped
PR → Build → devicectl Deploy → LGTM / Build & Deploy to iPhone (devicectl) (pull_request) Successful in 4m39s
CI / YouTube Worker (pull_request) Has been skipped
PR → Build → devicectl Deploy → LGTM / Wait for LGTM comment (pull_request) Successful in 11m52s
2d1facfb41
The inline python3 -c body in wait-approval raised IndentationError: unexpected indent because YAML block scalars dedent content to the first line's indent, leaving the python body with leading whitespace.

Replace with a call to scripts/pr_lgtm_scanner.py (added in the previous commit). Add a shallow Checkout step to wait-approval so the script is present on the runner.

This is the third indentation fix attempt for this scanner:
  - column-0 python  → YAML parse failure
  - indented python  → Python IndentationError
  - standalone file  → no indentation concerns (this commit)
Author
Owner

📱 Prêt à tester !

L'app est déployée sur l'iPhone (devicectl).

  • Teste les changements
  • Reply LGTM pour merger
  • Reply KO pour bloquer
## 📱 Prêt à tester ! L'app est déployée sur l'iPhone (devicectl). <!-- tabatago:ready-to-test --> - Teste les changements - Reply **LGTM** pour merger - Reply **KO** pour bloquer
Author
Owner

📱 Prêt à tester !

L'app est déployée sur l'iPhone (devicectl).

  • Teste les changements
  • Reply LGTM pour merger
  • Reply KO pour bloquer
## 📱 Prêt à tester ! L'app est déployée sur l'iPhone (devicectl). <!-- tabatago:ready-to-test --> - Teste les changements - Reply **LGTM** pour merger - Reply **KO** pour bloquer
Author
Owner

LGTM

LGTM
millianlmx merged commit e4b97b4d14 into main 2026-07-20 09:51:21 +02:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: millianlmx/tabatago#14