fix(releasekit): ensure command output is visible in CI on failure#4666
fix(releasekit): ensure command output is visible in CI on failure#4666
Conversation
With `set -euo pipefail`, the pattern `OUTPUT=$(cmd 2>&1)` causes the shell to exit immediately when the command fails, before `echo "$OUTPUT"` ever runs. This makes CI logs show only "Process completed with exit code 1" with zero diagnostic info. Fix by temporarily disabling `set -e` around the capture, saving the exit code, always printing the output, then exiting with the original code. Also emits a GitHub Actions `::error::` annotation for better visibility in the workflow summary. Applied to all five capture sites across the three workflow files: - .github/workflows/releasekit-uv.yml (prepare + release) - releasekit/github/workflows/releasekit-uv.yml (prepare + release) - releasekit/github/workflows/releasekit-pnpm.yml (2x prepare + release)
Summary of ChangesHello @yesudeep, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a critical issue in CI workflows where Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Ignored Files
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request addresses an important issue in the CI workflows where command failures would cause the script to exit before printing diagnostic output, making debugging difficult. The proposed solution correctly captures and displays the output even on failure.
My review focuses on refining the implementation. The changes use set +e and set -e to temporarily disable error checking. I've suggested a more idiomatic approach using an || list, which is more localized and avoids modifying the global shell state. This is a minor refinement to an otherwise solid fix.
Per reviewer feedback, the `|| EXIT_CODE=$?` idiom is more localized
than toggling global shell state with set +e / set -e. The `||` list
only fires on failure, and `${EXIT_CODE:-0}` gracefully defaults to
0 on success (when EXIT_CODE is unset).
163ac05 to
d4b2b3e
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request addresses an important issue with CI visibility on command failures. The core change, which involves capturing command output and exit codes even when set -e is active, is well-implemented and consistently applied across all relevant workflow files. This will significantly improve diagnostics for failed CI runs. The pull request also includes several beneficial changes, such as adding timeouts to jobs and improving command portability by replacing grep -oP with sed. My review includes a suggestion to restore the collapsible log groups in the CI output, which were removed as part of the changes, to maintain log readability.
…ublish output capture Addresses several reliability and portability issues found during audit: 1. Add timeout-minutes to all jobs (prepare: 10, release: 10, publish: 30, notify: 5) to prevent runaway jobs from burning runner minutes. 2. Replace grep -oP (GNU Perl regex) with portable sed for URL parsing. grep -P is not available on BSD/macOS grep — sed works everywhere. 3. Add output capture (|| EXIT_CODE=$?) to publish steps, matching the pattern already applied to prepare and release. 4. Use uv sync --no-dev for workspace install in publish jobs — dev dependencies are not needed for building and publishing. 5. Add comments documenting GITHUB_TOKEN scope limitation for cross-repo dispatch in notify jobs. 6. Add comments documenting inputs.skip_publish behavior on PR-merge events (undefined evaluates to empty string, which is != true).
8007c7a to
a8c2f23
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request significantly improves the reliability and debuggability of the releasekit CI workflows. By ensuring that command output is always visible even on failure, it will be much easier to diagnose issues in the CI environment. The changes are implemented consistently across all relevant jobs in both the pnpm and uv workflow files.
Key improvements:
- Error Handling: The core change to capture command output and exit codes correctly when
set -eis active is a robust solution to the problem of suppressed error messages. - Portability: Replacing
grep -oPwith a more portablesedandtailcombination for parsing output is a good practice. - Robustness: Adding
timeout-minutesto jobs prevents them from running indefinitely and consuming resources. - Consistency: The addition of
set -euo pipefailto steps that were missing it improves script consistency and safety.
The changes are well-executed and a clear improvement to the CI process. I have no further suggestions.
With
set -euo pipefail, the patternOUTPUT=$(cmd 2>&1)causes the shell to exit immediately when the command fails — beforeecho "$OUTPUT"ever runs. This makes CI logs show only "Process completed with exit code 1" with zero diagnostic info, as seen in run #22007335034.Root cause:
set -etreats a non-zero exit from a command substitution as an immediate error. The output is captured into$OUTPUTbut the script exits before printing it.Fix: Temporarily disable
set -earound the capture, save the exit code into$EXIT_CODE, re-enableset -e, always print the output, then exit with the saved code if non-zero. Also emits a GitHub Actions::error::annotation for better visibility in the workflow summary.Applied to all five capture sites across three workflow files:
.github/workflows/releasekit-uv.yml(prepare + release)releasekit/github/workflows/releasekit-uv.yml(prepare + release)releasekit/github/workflows/releasekit-pnpm.yml(2× prepare + release)