Skip to content

Comments

Add working-directory input for monorepo support#371

Open
guillaume-sainthillier wants to merge 2 commits intolaminas:1.33.xfrom
silarhi:claude/add-working-directory-option-dFO6H
Open

Add working-directory input for monorepo support#371
guillaume-sainthillier wants to merge 2 commits intolaminas:1.33.xfrom
silarhi:claude/add-working-directory-option-dFO6H

Conversation

@guillaume-sainthillier
Copy link

Summary

This PR adds support for monorepo configurations by introducing a working-directory input parameter that allows the action to operate within a specific subdirectory of the repository.

Key Changes

  • New Input Parameter: Added working-directory input to action.yml with a default value of . (current directory)

    • Allows users to specify a subdirectory where composer.json and other configuration files are located
    • Marked as optional to maintain backward compatibility
  • Diff Filtering Logic: Implemented filtering in entrypoint.sh to:

    • Extract only files that exist within the specified working directory
    • Strip the working directory prefix from file paths to make them relative
    • Provide clear logging of filtered results
  • Directory Navigation: Added logic to change into the working directory before executing the main action script

    • Ensures all subsequent operations (composer analysis, etc.) run in the correct context
    • Includes error handling if directory change fails

Implementation Details

  • The WORKING_DIR variable defaults to . if INPUT_WORKING_DIRECTORY is not set, preserving existing behavior
  • Diff filtering only applies when a non-default working directory is specified
  • File paths are compared with the working directory prefix to ensure accurate filtering
  • Clear console output indicates when filtering occurs and reports which files are affected

@guillaume-sainthillier guillaume-sainthillier force-pushed the claude/add-working-directory-option-dFO6H branch from 294efb8 to e0c00d2 Compare February 4, 2026 15:07
This adds a new `working-directory` input that allows users to specify
a subdirectory where the action should look for composer.json and other
configuration files. This is useful for monorepo setups where packages
are located in subdirectories.

When a working directory is specified:
- The action changes to that directory before running
- Git diff uses --relative to automatically filter and relativize paths

Signed-off-by: Guillaume Sainthillier <guillaume.sainthillier@gmail.com>
@guillaume-sainthillier guillaume-sainthillier force-pushed the claude/add-working-directory-option-dFO6H branch 3 times, most recently from 621495b to abfc27a Compare February 4, 2026 15:47
- Add monorepo support section to README with usage example
- Add shell test script verifying git diff --relative behavior
- Add shell-testing job to CI workflow

https://claude.ai/code/session_01DHWfTeAZF4BbLrQRzdbRKX
Signed-off-by: Claude <noreply@anthropic.com>
@guillaume-sainthillier guillaume-sainthillier force-pushed the claude/add-working-directory-option-dFO6H branch from abfc27a to 56ed56e Compare February 4, 2026 15:50
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