Support for sparse commit after sparse checkout
When I checkout my repository, I use
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
sparse-checkout: urls.txt
After all the action steps, I do git add --sparse results and commit
I tried to replace my commits with your actions but it seems like it doesn't support sparse, would like to know if you can add that?
- uses: EndBug/add-and-commit@v9
with:
add: "results"
pull: "--rebase --autostash ..."
default_author: "github_actions"
message: "update: ${{ matrix.sites.url }}"
[Scan (<action>)]
Error: The following paths and/or pathspecs matched paths that exist
outside of your sparse-checkout definition, so will not be
updated in the index:
results
hint: If you intend to update such entries, try one of the following:
hint: * Use the --sparse option.
hint: * Disable or modify the sparsity rules.
hint: Disable this message with "git config set advice.updateSparsePath false"
Have you tried this?
with:
add: "--sparse results"
Will try that thanks :)
A bit different now:
Add input parsed as single string, running 1 git add command.
> Using 'github-actions <123456789+github-actions[bot]@users.noreply.github.com>' as author.
> Using "update: site" as commit message.
Internal logs
> Staging files...
> Adding files...
> No files to remove.
> Checking for uncommitted changes in the git working tree...
> Found 12 changed files.
> Fetching repo...
{
raw: '',
remote: 'https://github.com/<owner>/<repo>',
branches: [ { name: 'gh-pages', tracking: 'origin/gh-pages' } ],
tags: [],
updated: [],
deleted: []
}
> Pulling from remote...
{
raw: '',
remote: null,
branches: [],
tags: [],
updated: [],
deleted: []
}
Error: Error: Could not read from remote repository.
Outputs
committed: false
commit_long_sha: undefined
commit_sha: undefined
pushed: false
tagged: false
tag_pushed: false
Error: Error: Could not read from remote repository.
Hmm that's weird, can you share the workflow file and/or a link to the logs (if the repo is public)
The weird part is remote: 'https://github.com/<owner>/<repo>',, it looks like something is misconfigured in the previous steps
Well it's a public repo but I don't want to link any thing about it. That's why I replaced it with
Here is a basic repository example https://github.com/Quentium-Forks/action-commit-sparse
Workflow: https://github.com/Quentium-Forks/action-commit-sparse/actions/runs/17436737200/job/49508500697
@QuentiumYT Sorry for the late reply, had a couple of busy weeks: can you run the workflow in debug mode?
Hello, no problem, here it the job https://github.com/Quentium-Forks/action-commit-sparse/actions/runs/17436737200/job/50368076944
Any update @EndBug? Thanks
Hi
I just had a look but honestly I don't know
It's really weird that it happens only with sparse checkout, so either actions/checkout is doing something funny when doing that kind of checkout, or my action is experiencing a side effect from any of the git commands.
You could try seeing if running the commands manually causes the same issue
Hi, well I don't really know about the generated git commands from either actions/checkout nor EndBug/add-and-commit, is there any logs?
My action just logs the parsed arguments, the commands are pretty basic, just append the arguments to checkout, pull, fetch etc
I don't know about actions/checkout, you could try just running a sparse checkout command to see what happens