Skip to content

refactor(opentofu): in-progress PR comment updates, unified headers, collapsible output - #34

Merged
xnoto merged 3 commits into
mainfrom
refactor/opentofu-pr-comment-lifecycle
Aug 30, 2026
Merged

refactor(opentofu): in-progress PR comment updates, unified headers, collapsible output#34
xnoto merged 3 commits into
mainfrom
refactor/opentofu-pr-comment-lifecycle

Conversation

@xnoto

@xnoto xnoto commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Refactors the pinned PR comment behavior in opentofu.yml (both test and plan jobs):

  1. In-progress update before the job runs. A new first step in each job immediately updates the pinned comment to state that a run is in progress and will be updated when it completes, preserving the previous run's output in a collapsible "Previous run output" section (un-nested on repeat cycles so the comment can't accumulate stale history).
  2. Unified headers (plan style). Both comments now use:
    • #### OpenTofu Test / OpenTofu test passed. / OpenTofu test failed.
    • #### OpenTofu Plan / OpenTofu plan passed. / OpenTofu plan failed with exit code X.
  3. Removed the Validation output (redacted, last 12000 characters) line from the test comment (redaction itself is unchanged).
  4. Collapsible output. The output/diff body in both comments is wrapped in a <details> block with summary "View run output". Both comments keep/gain a "View the workflow run" link.

Caller impact

No interface change: inputs, secrets, permissions, runner labels, triggers, emitted checks, and artifacts are unchanged. Callers (tfroot-aws, tfroot-gcp, tfroot-libvirt, tfroot-github, tfroot-cloudflare, and any other @main consumers) pick this up on their next run without modification. Fork-PR behavior is unchanged (no comment steps run; the test in-progress step uses the same same-repository condition as the existing report step). The apply job is untouched.

Notes

  • The in-progress steps reuse the already-pinned actions/github-script@3a2844b... # v9.0.0 and existing pull-requests: write job permissions.
  • The test ANSI-strip regex is byte-identical to main (/\u001b\[[0-?]*[ -/]*[@-~]/g).

Validation

  • Repo CI (_ci.yml: pre-commit/actionlint/gitleaks) on this PR.
  • Behavioral verification of the new comment lifecycle will be observable on the next consumer-repo PR run after merge (no workflow dispatch performed here).

xnoto added 3 commits August 30, 2026 11:47
…ent headers

Post an in-progress update to the pinned test/plan PR comments before each
job runs, preserving the previous run's output in a collapsible section.
Unify both comments on the plan-style header (#### OpenTofu Test/Plan with
a passed/failed status line), drop the "Validation output (redacted, last
12000 characters)" line, and wrap the output body in a collapsible
"View run output" section.
Write the escape as the six-character sequence � instead of a raw
ESC control byte, which is not a valid YAML character.
@xnoto
xnoto requested a review from a team as a code owner August 30, 2026 17:53
@github-actions

Copy link
Copy Markdown

Shared workflows CI passed

View the workflow run.

Validation output (redacted, last 12000 characters)

[INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Initializing environment for https://github.com/gitleaks/gitleaks.
[INFO] Initializing environment for https://github.com/rhysd/actionlint.
[INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/gitleaks/gitleaks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/rhysd/actionlint.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
check for case conflicts.................................................Passed
check for merge conflicts................................................Passed
check for broken symlinks............................(no files to check)Skipped
check vcs permalinks.....................................................Passed
detect destroyed symlinks................................................Passed
detect private key.......................................................Passed
mixed line ending........................................................Passed
trim trailing whitespace.................................................Passed
Detect hardcoded secrets.................................................Passed
Lint GitHub Actions workflow files.......................................Passed

@xnoto
xnoto merged commit 4e0cdf8 into main Aug 30, 2026
2 checks passed
@xnoto
xnoto deleted the refactor/opentofu-pr-comment-lifecycle branch August 30, 2026 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant