fix(action): implement potential fixes for 4 code quality findings from GitHub#10
Conversation
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> Signed-off-by: Andrei Jiroh Halili <ajhalili2006@andreijiroh.dev>
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> Signed-off-by: Andrei Jiroh Halili <ajhalili2006@andreijiroh.dev>
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> Signed-off-by: Andrei Jiroh Halili <ajhalili2006@andreijiroh.dev>
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> Signed-off-by: Andrei Jiroh Halili <ajhalili2006@andreijiroh.dev>
📝 WalkthroughWalkthroughThis PR tightens input validation for INPUT_INJECT_ENV_VARS, simplifies the options debug callback, and updates secrets loading to track pre- and post-decryption encrypted prefixes to refine decryption warnings and masking. ChangesSecrets handling and input validation improvements
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 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 docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ajhalili2006
left a comment
There was a problem hiding this comment.
LGTM, might need to manually approve this via @MFHellscapes
There was a problem hiding this comment.
Pull request overview
This PR addresses several automated code-quality findings in the GitHub Action implementation, focusing on safer input handling and clearer behavior when decrypting/masking secrets.
Changes:
- Add a warning + fallback behavior when
INPUT_INJECT_ENV_VARSis set to an unrecognized value. - Simplify boolean expressions (e.g.,
debug: core.isDebug()). - Avoid potential runtime errors by guarding
.startsWith("encrypted:")checks withtypeof === "string"and reusing computed flags.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
See #10 (comment) for context Assisted-by: GitHub Copilot via PR reviews Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Andrei Jiroh Halili <ajhalili2006@andreijiroh.dev>
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 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 `@action.js`:
- Around line 34-35: The debug log currently serializes opts (inside the
core.group callback) and may expose opts.key; before calling
core.debug(JSON.stringify(...)) create a sanitized version (e.g., const safeOpts
= { ...opts, key: opts.key ? '[REDACTED]' : opts.key }) or use a JSON replacer
to omit or mask the key, then call core.debug(JSON.stringify(safeOpts, null, 2))
so the private key is not written to logs; update the code where
core.group("options debug", ...) and core.debug are used to reference the
sanitized object.
- Around line 21-25: The bundled runtime (dist/index.js) doesn't match
action.js: update the getBoolInputEnv() implementation in dist/index.js to
mirror action.js by adding the invalid-value branch that calls core.warning with
the same message and returns false so invalid INPUT_INJECT_ENV_VARS values fall
back to false at runtime; ideally regenerate the dist bundle from source to
ensure parity, but if editing manually, modify the getBoolInputEnv function in
dist/index.js to include the warning + return false branch identical to
action.js.
- Around line 34-37: Remove the redundant core.endGroup() calls that live inside
core.group(...) callbacks: locate each core.group usage (e.g., the callback
invoking core.debug(JSON.stringify(opts, null, 2)) for the "options debug" group
and the other groups named "Parsed data (w/o decryption)" and "dotenv-keys meta
configs") and delete the explicit core.endGroup() call from the callback body;
keep the core.group(...) call and its contents intact since `@actions/core`
handles endGroup() automatically.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
Fix some async-await related type errors on options debug log group, alongside a minimal code comment update. Signed-off-by: Andrei Jiroh Halili <ajhalili2006@andreijiroh.dev>
bda516a to
1af9bda
Compare
MFHellscapes
left a comment
There was a problem hiding this comment.
@ajhalili2006 on the line here, LGTMing
This PR applies 4/5 suggestions from code quality AI findings. 1 suggestion was skipped to avoid creating conflicts.
Summary by CodeRabbit
Bug Fixes
Chores