Skip to content

actions: add run-with-log composite action#136

Open
ppetrovicTT wants to merge 3 commits into
mainfrom
ppetrovic/ai-summary-run-with-log
Open

actions: add run-with-log composite action#136
ppetrovicTT wants to merge 3 commits into
mainfrom
ppetrovic/ai-summary-run-with-log

Conversation

@ppetrovicTT

Copy link
Copy Markdown
Contributor

Stacked on #135.

The writer half of the timeout-detection contract (parser added in #134). A composite action that runs a bash script like a normal run: step, tees combined output to a .log, and appends [==log-finish-line==] exit_code=N as the final line. Marker absent ⇒ the shell was killed before finishing (GitHub timeout-minutes) ⇒ ai_summary reports TIMEOUT instead of a false SUCCESS.

Replaces the hand-copied tee/PIPESTATUS block across ~10 test workflows.

Design notes

  • run (not a single command): written to a temp file and executed bash --noprofile --norc -eo pipefail, identical to how a run: step executes — full multi-line/heredoc/set -e fidelity.
  • working-directory default /work: composite steps can't inherit the job's defaults.run.working-directory (same reason composite run steps must declare shell:), so it's an input. Defaulted to the TT container workdir; override per call (multihost passes /home/user/tt-metal).
  • log-file: explicit path; parent dirs created (mkdir -p).
  • set +e in the wrapper: a failing script still gets the marker, so a normal failure stays a failure (marker present, nonzero exit) and never masquerades as a timeout.
  • Limitation: named $GITHUB_OUTPUT written inside the script doesn't propagate (composite actions only expose declared outputs); none of the target steps set outputs.

Verified locally: multi-line script + heredoc, set -e mid-script abort, nested log-file dir creation, exit-code forwarding, marker on success/failure, marker absent on hard kill.

Next: convert the ~10 tt-metal test impls to use it.

🤖 Generated with Claude Code

@ppetrovicTT ppetrovicTT requested a review from a team as a code owner June 16, 2026 14:55
ppetrovicTT and others added 2 commits June 17, 2026 10:32
Wraps a run step to tee output to a .log and append a completion marker,
so a GitHub timeout-minutes kill (marker absent) is distinguishable from a
crash. Replaces the tee/PIPESTATUS block copied across test workflows.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ppetrovicTT ppetrovicTT force-pushed the ppetrovic/ai-summary-run-with-log branch from e4666a0 to 5354aeb Compare June 17, 2026 08:33
@ppetrovicTT ppetrovicTT changed the base branch from ppetrovic/ai-summary-detection-patterns-yaml to main June 17, 2026 08:33
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 17, 2026 08:43
@ppetrovicTT ppetrovicTT force-pushed the ppetrovic/ai-summary-run-with-log branch from 5354aeb to 9bed8b2 Compare June 17, 2026 08:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new composite GitHub Action (run-with-log) that runs a multi-line bash script like a normal run: step while teeing combined output to a log file and appending a completion marker line. It also adds a dispatch-only workflow to smoke test success/failure/timeout behavior and documents the action.

Changes:

  • Add ./.github/actions/run-with-log composite action to tee output into a .log and append [==log-finish-line==] exit_code=N.
  • Add test-run-with-log workflow to validate marker behavior for success, failure, and timeout-minutes kills.
  • Add README documentation for usage, inputs, and propagation limitations.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
.github/workflows/test-run-with-log.yaml Adds a dispatch-only smoke test workflow validating marker presence/absence and ai_summary classification.
.github/actions/run-with-log/README.md Documents the new run-with-log composite action, its marker contract, and usage/limitations.
.github/actions/run-with-log/action.yml Implements the composite action wrapper that writes the script to a temp file, tees output, and appends the completion marker.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +42 to +47
bash --noprofile --norc -eo pipefail "$script" 2>&1 | tee "$RUN_WITH_LOG_FILE"
rc=${PIPESTATUS[0]}
rm -f "$script"

printf '[==log-finish-line==] exit_code=%s\n' "$rc" >> "$RUN_WITH_LOG_FILE"
exit $rc
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.

2 participants