fix: restore inputs from state in post#255
Conversation
📝 WalkthroughWalkthroughThe action entrypoint is refactored to use GitHub Action state ( ChangesState-based input persistence for GitHub Action post step
🎯 2 (Simple) | ⏱️ ~8 minutes
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/index.ts`:
- Line 34: The code unconditionally calls JSON.parse(getState('inputs')) when
assigning const inputs in src/index.ts, which can throw if getState('inputs') is
missing/empty/corrupted; wrap the retrieval and parse in a safe guard: read
const raw = getState('inputs'), check raw is truthy before parsing, and/or parse
inside a try/catch that falls back to a safe default (e.g., undefined or an
empty Inputs-like object) and logs the parse error, so the post-cleanup path
(and the rest of the process) cannot be interrupted by JSON.parse; update the
assignment of inputs accordingly to use the guarded value.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 86c3a3df-8941-4d0f-80fb-43dd0041dfb5
⛔ Files ignored due to path filters (1)
dist/index.jsis excluded by!**/dist/**
📒 Files selected for processing (1)
src/index.ts
📜 Review details
🔇 Additional comments (2)
src/index.ts (2)
11-15: Good post/main dispatch split.Using
getState('is_post')to route between phases is clear and matches the intended GitHub Action lifecycle fix.
18-21: Good: inputs are persisted before main work starts.Saving inputs up front reduces drift risk between main and post, especially for composite-action invocations.
Fixes #253
Summary by CodeRabbit