From 8d174f35da1f35fe6635d03859f4856b7a25536e Mon Sep 17 00:00:00 2001 From: Josh Marinacci Date: Mon, 29 Jun 2026 09:45:45 -0700 Subject: [PATCH 1/5] add sparse checkout Signed-off-by: Josh Marinacci --- action.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/action.yml b/action.yml index 84ce4a5..89bf28d 100644 --- a/action.yml +++ b/action.yml @@ -32,6 +32,17 @@ inputs: description: 'Whether to checkout submodules (true/false/recursive)' default: 'false' required: false + checkout-sparse: + description: > + Do a sparse checkout on given patterns. + Each pattern should be separated with new lines. + default: null + required: false + checkout-sparse-cone-mode: + description: > + Specifies whether to use cone-mode when doing a sparse checkout. + default: true + required: false setup-node: description: 'Whether to setup Node.js' required: false @@ -259,6 +270,8 @@ runs: echo "Ref: ${{ inputs.checkout-ref }}" echo "Fetch Depth: ${{ inputs.checkout-fetch-depth }}" echo "Submodules: ${{ inputs.checkout-submodules }}" + echo "Sparse: ${{inputs.checkout-sparse }}" + echo "Sparse Cone Mode: ${{inputs.checkout-sparse-cone-mode }}" echo "::endgroup::" - name: Checkout Code @@ -272,6 +285,8 @@ runs: token: ${{ inputs.checkout-token }} path: ${{ inputs.checkout-path }} persist-credentials: ${{ inputs.checkout-persist }} + sparse-checkout: ${{ inputs.checkout-sparse }} + sparse-checkout-cone-mode: ${{inputs.checkout-sparse-cone-mode }} - name: Set Up Java Parameters id: setup-java-params From 8757eebb8003ebd341a02ef65ade224509a00d29 Mon Sep 17 00:00:00 2001 From: Josh Marinacci Date: Mon, 29 Jun 2026 11:06:43 -0700 Subject: [PATCH 2/5] update the readme Signed-off-by: Josh Marinacci --- README.md | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index a7beaf5..2c398f4 100644 --- a/README.md +++ b/README.md @@ -33,15 +33,17 @@ Common steps for initializing a job for GitHub actions. This composite action co **Repository Checkout** -| Input | Description | Required | Default | Options | -|----------------------|------------------------------------------------------------------------------|----------|---------|----------------------------| -| checkout | Whether to checkout the repository | No | - | `true`/`false` | -| checkout-ref | The branch, tag or SHA to checkout | No | - | any `branch`/`tag`/`SHA` | -| checkout-token | Personal access token (PAT) used to fetch the repository | No | - | `Token` used for checkout | -| checkout-path | Path to checkout the repository into (relative to `${GITHUB_WORKSPACE}`) | No | `.` | any relative path | -| checkout-fetch-depth | Depth of commit history to fetch | No | 1 | `0` (full)/`1`/`2`/... | -| checkout-persist | Whether to configure the token with the local git config | No | true | `true`/`false` | -| checkout-submodules | Whether to fetch submodules | No | false | `true`/`false`/`recursive` | +| Input | Description | Required | Default | Options | +|-----------------------------|--------------------------------------------------------------------------|----------|---------|----------------------------| +| checkout | Whether to checkout the repository | No | - | `true`/`false` | +| checkout-ref | The branch, tag or SHA to checkout | No | - | any `branch`/`tag`/`SHA` | +| checkout-token | Personal access token (PAT) used to fetch the repository | No | - | `Token` used for checkout | +| checkout-path | Path to checkout the repository into (relative to `${GITHUB_WORKSPACE}`) | No | `.` | any relative path | +| checkout-fetch-depth | Depth of commit history to fetch | No | 1 | `0` (full)/`1`/`2`/... | +| checkout-persist | Whether to configure the token with the local git config | No | true | `true`/`false` | +| checkout-submodules | Whether to fetch submodules | No | false | `true`/`false`/`recursive` | +| checkout-sparse | Do a sparse checkout on given patterns | No | - | path | +| checkout-sparse-cone-mode | Specifies whether to use cone-mode when doing a sparse checkout | No | true | | **Java** From bef6b52d744643e1e86c4eed6ade3222e87de7e7 Mon Sep 17 00:00:00 2001 From: Josh Marinacci Date: Mon, 29 Jun 2026 11:19:30 -0700 Subject: [PATCH 3/5] add sparse checkout tests Signed-off-by: Josh Marinacci --- .github/workflows/test.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index eb572ff..9fe1cbb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -180,6 +180,23 @@ jobs: echo "Is Shallow Repository: ${shallow_value}" test "${shallow_value}" = "true" + - name: Run Sparse Checkout Action + uses: ./ + id: test-sparse-checkout + with: + checkout: true + checkout-ref: main + checkout-token: ${{ secrets.GITHUB_TOKEN }} + checkout-sparse: '.github/workflows/support' + + - name: Verify Sparse Checkout Outputs + run: | + echo "Checkout Ref: ${{ steps.test-sparse-checkout.outputs.checkout-ref }}" + echo "Checkout Commit: ${{ steps.test-sparse-checkout.outputs.checkout-commit }}" + sparse_list=$(git sparse-checkout list) + echo "sparse list: ${sparse_list}" + test "${sparse_list}" = ".github" + test-setup-java: name: Test Setup Java Action runs-on: ubuntu-latest From 603ff77799d19a0a10e97c547875ac18429a74db Mon Sep 17 00:00:00 2001 From: Josh Marinacci Date: Mon, 29 Jun 2026 11:33:26 -0700 Subject: [PATCH 4/5] update test Signed-off-by: Josh Marinacci --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9fe1cbb..7d04792 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -187,7 +187,7 @@ jobs: checkout: true checkout-ref: main checkout-token: ${{ secrets.GITHUB_TOKEN }} - checkout-sparse: '.github/workflows/support' + checkout-sparse: '.github' - name: Verify Sparse Checkout Outputs run: | From 1bbdba0f268a0701346426d02c6a490d414201eb Mon Sep 17 00:00:00 2001 From: Josh Marinacci Date: Mon, 29 Jun 2026 12:26:32 -0700 Subject: [PATCH 5/5] move sparse checkout to it's own test Signed-off-by: Josh Marinacci --- .github/workflows/test.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7d04792..93ed1cc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -180,6 +180,19 @@ jobs: echo "Is Shallow Repository: ${shallow_value}" test "${shallow_value}" = "true" + test-sparse-checkout: + name: Test Sparse Checkout Action + runs-on: ubuntu-latest + steps: + - name: Harden Runner + id: harden-runner + uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4 + with: + egress-policy: audit + + - name: Checkout Repository + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + - name: Run Sparse Checkout Action uses: ./ id: test-sparse-checkout