From ba0445f67c2b729f393b516a808b150fb6d1a6ec Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 9 Jun 2026 09:57:46 +0000 Subject: [PATCH 1/3] feat: add optional repository input Add an optional `repository` input that points to a relative path under $GITHUB_WORKSPACE for the git repository to operate on. Defaults to `.` (the workspace root). The entrypoint adds the resolved path to safe.directory and cd's into it before running git status / ghcommit. This mirrors the behaviour of stefanzweifel/git-auto-commit-action and enables using the action on repositories checked out into a subdirectory of the workflow workspace. Co-Authored-By: Claude Opus 4.7 (1M context) --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index c9902b6..4c5b14d 100644 --- a/README.md +++ b/README.md @@ -63,8 +63,13 @@ Example showing all options: branch: ${{ github.head_ref || github.ref_name }} empty: true file_pattern: '*.txt *.md *.json *.hcl' + repository: 'path/to/subdir' env: GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} ``` +The `repository` input is optional. When set, it must be a relative path under +`$GITHUB_WORKSPACE` pointing to the git repository to operate on. Defaults to +the root of the repository (`.`). + See [`action.yaml`](./action.yaml) for current list of supported inputs. From f4e313e9749f5ca13e733d25fe43ada895db4fb4 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 9 Jun 2026 09:57:47 +0000 Subject: [PATCH 2/3] feat: add optional repository input Add an optional `repository` input that points to a relative path under $GITHUB_WORKSPACE for the git repository to operate on. Defaults to `.` (the workspace root). The entrypoint adds the resolved path to safe.directory and cd's into it before running git status / ghcommit. This mirrors the behaviour of stefanzweifel/git-auto-commit-action and enables using the action on repositories checked out into a subdirectory of the workflow workspace. Co-Authored-By: Claude Opus 4.7 (1M context) --- action.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/action.yaml b/action.yaml index e5f8ba1..e36fde3 100644 --- a/action.yaml +++ b/action.yaml @@ -24,6 +24,10 @@ inputs: description: File pattern used for `git add`. For example `src/*.js` required: false default: "." + repository: + description: Relative file path under $GITHUB_WORKSPACE to the git repository. Defaults to the root of the repository (`.`). + required: false + default: "." outputs: commit-url: @@ -40,3 +44,4 @@ runs: - ${{ inputs.branch }} - ${{ inputs.empty }} - ${{ inputs.file_pattern }} + - ${{ inputs.repository }} From 8842383ad2b8b82bee1813f1fe000ea1376a265d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 9 Jun 2026 09:57:48 +0000 Subject: [PATCH 3/3] feat: add optional repository input Add an optional `repository` input that points to a relative path under $GITHUB_WORKSPACE for the git repository to operate on. Defaults to `.` (the workspace root). The entrypoint adds the resolved path to safe.directory and cd's into it before running git status / ghcommit. This mirrors the behaviour of stefanzweifel/git-auto-commit-action and enables using the action on repositories checked out into a subdirectory of the workflow workspace. Co-Authored-By: Claude Opus 4.7 (1M context) --- entrypoint.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 6c7f739..a16fb46 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -48,8 +48,14 @@ REPO="${2:?Missing repo input}" BRANCH="${3:?Missing branch input}" EMPTY="${4:-false}" read -r -a FILE_PATTERNS <<<"${5:?Missing file_pattern input}" +REPOSITORY="${6:-.}" -git config --global --add safe.directory "$GITHUB_WORKSPACE" +REPOSITORY_PATH="$GITHUB_WORKSPACE/$REPOSITORY" +echo "Repository path: $REPOSITORY_PATH" + +git config --global --add safe.directory "$REPOSITORY_PATH" + +cd "$REPOSITORY_PATH" adds=() deletes=()