Problem when running git rebase

Hi all!

First of all I want to say I absolutely love github actions, great work! I used them every day and they are a delight. I started to poke around and build my own actions.
My aim with one of them is to, whenever I push a commit to my publish branch of a given repo, I want an action to run and run git rebase publish on the master branch. Seems pretty straight forward. 
I built and tested it here: https://github.com/MaximeHeckel/github-action-rebase/tree/publish

However, I can’t seem to perform a successful rebase operation:

/usr/bin/git rebase publish

First, rewinding head to replay your work on top of it...
Applying: Initial Commit
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
CONFLICT (add/add): Merge conflict in README.md
Auto-merging README.md
No changes -- Patch already applied.
Applying: feat(action): First iteration of the rebase github action
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
CONFLICT (add/add): Merge conflict in index.js
Auto-merging index.js
CONFLICT (add/add): Merge conflict in dist/index.js
Auto-merging dist/index.js
CONFLICT (add/add): Merge conflict in .gitignore
Auto-merging .gitignore
CONFLICT (add/add): Merge conflict in .github/workflows/test.yml
Auto-merging .github/workflows/test.yml
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch' to see the failed patch
Patch failed at 0002 feat(action): First iteration of the rebase github action
Resolve all conflicts manually, mark them as resolved with
"git add/rm <conflicted_files>", then run "git rebase --continue".
You can instead skip this commit: run "git rebase --skip".
To abort and get back to the state before "git rebase", run "git rebase --abort".

Despite looking around and trying different approaches to debug this, I can’t make it work.
The branches do not conflict when running the same command manually obviously.

What am I doing wrong? Am I missing something obvious?

Workflow example: https://github.com/MaximeHeckel/github-action-rebase/blob/publish/.github/workflows/test.yml

Source: https://github.com/MaximeHeckel/github-action-rebase/blob/publish/index.js

Thank you in advance!

After a lot of trial and error I realized that using the --onto flag would make it work!

Instead of running git rebase branchA on master I run git rebase --onto branchA master and I get the expected result!