feat: add support for custom working dir#5
Conversation
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 2 minutes and 23 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughAdds a configurable Changes
Sequence DiagramsequenceDiagram
participant Workflow as pr-checks.yml
participant Composed as composed/pr-checks
participant Base as Base Actions
participant Shell as Shell/Runner
Workflow->>Workflow: receive inputs (working-directory)
Workflow->>Workflow: export HOLDEX_WORKING_DIR to $GITHUB_ENV
Workflow->>Composed: call composed/pr-checks (with working-directory)
Composed->>Composed: set HOLDEX_WORKING_DIR (input or existing)
Composed->>Base: invoke base actions (commit-check, prettier, markdown-check, setup-runtime)
Base->>Base: set step working-directory: ${{ env.HOLDEX_WORKING_DIR || '.' }}
Base->>Shell: run commands in configured directory (e.g., package.json checks, linters)
Shell-->>Base: command results
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 |
Time Submission Status
You can submit time with the command. Example: See available commands to help comply with our Guidelines. |
|
@holdex pr submit-time 30m |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
.github/actions/base/prettier/action.yml (1)
22-33:⚠️ Potential issue | 🟠 MajorRebase/filter changed file paths to the working directory before running Prettier.
Line 29/32 stores file paths as-is, while Line 98 executes from
HOLDEX_WORKING_DIR. With subdirectory runs, root-relative paths become invalid and checks can fail incorrectly. Normalize to paths relative to the active working directory (and drop out-of-scope files).Suggested fix in resolve step
- name: Resolve changed files id: resolved-files shell: bash working-directory: ${{ env.HOLDEX_WORKING_DIR || '.' }} run: | + WORKDIR="${{ env.HOLDEX_WORKING_DIR || '.' }}" if [ -n "${{ inputs.changed-files }}" ]; then - echo "any-changed=true" >> "$GITHUB_OUTPUT" - echo "files=${{ inputs.changed-files }}" >> "$GITHUB_OUTPUT" + RAW_FILES="${{ inputs.changed-files }}" else - echo "any-changed=${{ steps.changed-files.outputs.any_changed }}" >> "$GITHUB_OUTPUT" - echo "files=${{ steps.changed-files.outputs.all_changed_files }}" >> "$GITHUB_OUTPUT" + RAW_FILES="${{ steps.changed-files.outputs.all_changed_files }}" + fi + + normalized_files=() + for file in $RAW_FILES; do + if [ "$WORKDIR" = "." ]; then + normalized_files+=("$file") + elif [[ "$file" == "$WORKDIR/"* ]]; then + normalized_files+=("${file#"$WORKDIR"/}") + fi + done + + if [ "${`#normalized_files`[@]}" -eq 0 ]; then + echo "any-changed=false" >> "$GITHUB_OUTPUT" + echo "files=" >> "$GITHUB_OUTPUT" + else + echo "any-changed=true" >> "$GITHUB_OUTPUT" + echo "files=${normalized_files[*]}" >> "$GITHUB_OUTPUT" fi🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/actions/base/prettier/action.yml around lines 22 - 33, The resolve step (id resolved-files) currently emits file paths unchanged into the outputs (files and any-changed) which breaks when working from a subdirectory (HOLDEX_WORKING_DIR); update the logic in that step to rebase and normalize each path to be relative to ${HOLDEX_WORKING_DIR:-.} (or drop files that are outside that directory) before writing "files=" and "any-changed=" to GITHUB_OUTPUT, and ensure you still set any-changed=false when no in-scope files remain; reference the resolved-files step and the outputs files/any-changed as the places to change..github/actions/base/markdown-check/action.yml (1)
31-52:⚠️ Potential issue | 🟠 MajorNormalize markdown file paths to the active working directory.
The resolved
filesoutput is not rebased, but Line 77 executes lint fromHOLDEX_WORKING_DIR. In subdirectory mode, root-relative paths can break and produce false failures. Rebase/filter files before writingfiles=....Suggested fix pattern
run: | + WORKDIR="${{ env.HOLDEX_WORKING_DIR || '.' }}" if [ -z "${{ inputs.changed-files }}" ]; then - echo "any-changed=${{ steps.changed-markdown-files.outputs.any_changed }}" >> "$GITHUB_OUTPUT" - echo "files=${{ steps.changed-markdown-files.outputs.all_changed_files }}" >> "$GITHUB_OUTPUT" - exit 0 + RAW_FILES="${{ steps.changed-markdown-files.outputs.all_changed_files }}" + else + RAW_FILES="${{ inputs.changed-files }}" fi markdown_files=() - for file in ${{ inputs.changed-files }}; do + for file in $RAW_FILES; do + if [ "$WORKDIR" != "." ] && [[ "$file" == "$WORKDIR/"* ]]; then + file="${file#"$WORKDIR"/}" + elif [ "$WORKDIR" != "." ]; then + continue + fi case "$file" in *.md|*.mdx) markdown_files+=("$file") ;; esac done🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/actions/base/markdown-check/action.yml around lines 31 - 52, The outputs written for "files" can be root-relative and break linting when the action runs from HOLDEX_WORKING_DIR; normalize each entry before adding to markdown_files and before echoing "files=" by rebasing paths to the action's working directory (e.g., $GITHUB_WORKSPACE or $PWD). Update the loop that processes inputs.changed-files to convert each matched file (in the markdown_files array) to a rebased/relative path (strip leading slashes or use realpath --relative-to="$PWD" "$file") and then write the normalized list to the "files" output (keeping the any-changed logic intact).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/actions/composed/pr-checks/action.yml:
- Around line 29-33: Update the "Set working directory" step to validate the
chosen directory before exporting HOLDEX_WORKING_DIR: determine the directory
value from inputs.working-directory or env.HOLDEX_WORKING_DIR, test that it
exists (e.g., [ -d "$dir" ]), and if not print a clear error referencing the
invalid working-directory and exit 1; otherwise export it to $GITHUB_ENV as
before. Use the existing step name "Set working directory" and the variables
HOLDEX_WORKING_DIR and inputs.working-directory to locate where to add this
guard.
In `@ACTIONS.md`:
- Around line 131-137: The markdown lines describing HOLDEX_WORKING_DIR and
usage with pr-checks.yml / composed/pr-checks exceed the repo's MD013 line
length and must be wrapped; update the paragraph(s) that mention
HOLDEX_WORKING_DIR, pr-checks.yml, and composed/pr-checks so each line is within
the configured limit (break sentences or insert soft line breaks between
clauses), keeping wording unchanged except for line breaks to satisfy the
linter.
---
Outside diff comments:
In @.github/actions/base/markdown-check/action.yml:
- Around line 31-52: The outputs written for "files" can be root-relative and
break linting when the action runs from HOLDEX_WORKING_DIR; normalize each entry
before adding to markdown_files and before echoing "files=" by rebasing paths to
the action's working directory (e.g., $GITHUB_WORKSPACE or $PWD). Update the
loop that processes inputs.changed-files to convert each matched file (in the
markdown_files array) to a rebased/relative path (strip leading slashes or use
realpath --relative-to="$PWD" "$file") and then write the normalized list to the
"files" output (keeping the any-changed logic intact).
In @.github/actions/base/prettier/action.yml:
- Around line 22-33: The resolve step (id resolved-files) currently emits file
paths unchanged into the outputs (files and any-changed) which breaks when
working from a subdirectory (HOLDEX_WORKING_DIR); update the logic in that step
to rebase and normalize each path to be relative to ${HOLDEX_WORKING_DIR:-.} (or
drop files that are outside that directory) before writing "files=" and
"any-changed=" to GITHUB_OUTPUT, and ensure you still set any-changed=false when
no in-scope files remain; reference the resolved-files step and the outputs
files/any-changed as the places to change.
🪄 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
Run ID: 6070ef6f-0e8a-4d06-bee6-bced50a18af3
📒 Files selected for processing (7)
.github/actions/base/commit-check/action.yml.github/actions/base/markdown-check/action.yml.github/actions/base/prettier/action.yml.github/actions/base/setup-runtime/action.yml.github/actions/composed/pr-checks/action.yml.github/workflows/pr-checks.ymlACTIONS.md
ref: https://github.com/holdex/wizard/issues/1080
Summary by CodeRabbit
New Features
Documentation