Skip to content

Commit c989bf3

Browse files
committed
docs: update README
1 parent a790c74 commit c989bf3

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

README.md

+16-9
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,6 @@ Add a step like this to your workflow:
2727
# Default: depends on the default_author input
2828
author_email: mail@example.com
2929

30-
# The name of the branch to use, if different from the one that triggered the workflow.
31-
# Default: the branch that triggered the run
32-
branch: some-branch
33-
34-
# How the action should behave when the targeted branch is missing: "create" will create a new one on the remote, "throw" will exit
35-
# Default: throw
36-
branch_mode: create
37-
3830
# The name of the custom committer you want to use, if different from the author of the commit.
3931
# Default: the name of the author (set with either author_name or default_author)
4032
committer_name: Committer Name
@@ -58,6 +50,10 @@ Add a step like this to your workflow:
5850
# Default: 'Commit from GitHub Actions (name of the workflow)'
5951
message: 'Your commit message'
6052

53+
# If this input is set, the action will push the commit to a new branch with this name.
54+
# Default: ''
55+
new_branch: custom-new-branch
56+
6157
# The way the action should handle pathspec errors from the add and remove commands. Three options are available:
6258
# - ignore -> errors will be logged but the step won't fail
6359
# - exitImmediately -> the action will stop right away, and the step will fail
@@ -101,7 +97,7 @@ You can also use JSON or YAML arrays (e.g. `'["first", "second"]'`, `"['first',
10197

10298
### Pushing
10399

104-
By default the action runs the following command: `git push origin ${branch input} --set-upstream`. You can use the `push` input to modify this behavior, here's what you can set it to:
100+
By default the action runs the following command: `git push origin ${new_branch input} --set-upstream`. You can use the `push` input to modify this behavior, here's what you can set it to:
105101

106102
- `true`: this is the default value, it will behave as usual.
107103
- `false`: this prevents the action from pushing at all, no `git push` command is run.
@@ -110,6 +106,17 @@ By default the action runs the following command: `git push origin ${branch inpu
110106

111107
One way to use this is if you want to force push to a branch of your repo: you'll need to set the `push` input to, for example, `origin yourBranch --force`.
112108

109+
### Creating a new branch
110+
111+
If you want the action to commit in a new branch, you can use the `new_branch` input.
112+
113+
Please note that if the branch exists, the action will still try push to it, but it's possible that the push will be rejected by the remote as non-straightforward.
114+
115+
If that's the case, you need to make sure that the branch you want to commit to is already checked out before you run the action. If you want to commit files "across different branches", here are two ways to do it:
116+
117+
1. You can check them out in two different directories, generate your files, move them to your destination and then run `add-and-commit` in the destination directory using the `cwd` input.
118+
2. You can manually commit those files with `git` commands as you would on your machine. There are several ways to do this depending on the scenario. One of them if to stash your changes, checkout the destination branch, and popping the stash. You can then use the `add-and-commit` action as usual. Please note that this is just an example and may not work for you, since your use case may be different.
119+
113120
### Tagging
114121

115122
You can use the `tag` option to enter the arguments for a `git add` command. In order for the action to isolate the tag name from the rest of the arguments, it should be the first word not preceded by an hyphen (e.g. `-a tag-name -m "some other stuff"` is ok).

0 commit comments

Comments
 (0)