You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+33-16Lines changed: 33 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,10 +3,15 @@
3
3
[](https://github.com/search?o=desc&q=EndBug+add-and-commit+path%3A.github%2Fworkflows+language%3AYAML&s=&type=Code)
You can use this GitHub Action to commit changes made in your workflow run directly to your repo: for example, you use it to lint your code, update documentation, commit updated builds, etc....
6
+
You can use this GitHub Action to commit changes made in your workflow run directly to your repo: for example, you use it to lint your code, update documentation, commit updated builds, etc...
7
7
8
-
This is **heavily** inspired by [git-auto-commit-action](https://github.com/stefanzweifel/git-auto-commit-action) (by [Stefan Zweifel](https://github.com/stefanzweifel)): that action automatically detects changed files and commits them. While this is useful for most situations, this doesn't commit untracked files and can sometimes commit unintended changes (such as `package-lock.json` or similar, that may have happened during previous steps).
9
-
This action lets you choose the path that you want to use when adding & committing changes so that it works as you would normally do using `git` on your machine.
8
+
## Table of contents
9
+
10
+
-[Inputs](#inputs)
11
+
-[Outputs](#outputs)
12
+
-[FAQs](#faqs)
13
+
-[Examples](#examples)
14
+
-[Contributors](#contributors)
10
15
11
16
## Inputs
12
17
@@ -124,7 +129,21 @@ If you want to commit files "across different branches", here are two ways to do
124
129
125
130
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).
126
131
127
-
### Tokens
132
+
## Outputs
133
+
134
+
The action provides these outputs:
135
+
136
+
- `committed`: whether the action has created a commit (`'true'` or `'false'`)
137
+
- `commit_long_sha`: the full SHA of the commit that has just been created
138
+
- `commit_sha`: the short 7-character SHA of the commit that has just been created
139
+
- `pushed`: whether the action has pushed to the remote (`'true'` or `'false'`)
140
+
- `tagged`: whether the action has created a tag (`'true'` or `'false'`)
141
+
142
+
For more info on how to use outputs, see ["Context and expression syntax"](https://docs.github.com/en/free-pro-team@latest/actions/reference/context-and-expression-syntax-for-github-actions).
143
+
144
+
## FAQs
145
+
146
+
### About tokens
128
147
129
148
When pushing, the action uses the token that the local git repository has been configured with: that means that if you want to change it you'll need to do it in the steps that run before this action. For example: if you set up your repo with [`actions/checkout`](https://github.com/actions/checkout/) then you have to add the token there.
130
149
Changing the token with which the repo is configured can be useful if you want to run CI checks on the commit pushed by this action; anyway, it has to be set up outside of this action.
@@ -149,20 +168,10 @@ Some users reported that they were getting an error:
149
168
150
169
If you're getting this error and you're using `actions/checkout@v1`, try upgrading to `actions/checkout@v2`. If you're still having problems after upgrading, feel free to open an issue. Issue ref: [#146](https://github.com/EndBug/add-and-commit/issues/146)
151
170
152
-
## Outputs
153
-
154
-
The action provides these outputs:
155
-
156
-
- `committed`: whether the action has created a commit (`'true'` or `'false'`)
157
-
- `commit_long_sha`: the full SHA of the commit that has just been created
158
-
- `commit_sha`: the short 7-character SHA of the commit that has just been created
159
-
- `pushed`: whether the action has pushed to the remote (`'true'` or `'false'`)
160
-
- `tagged`: whether the action has created a tag (`'true'` or `'false'`)
161
-
162
-
For more info on how to use outputs, see ["Context and expression syntax"](https://docs.github.com/en/free-pro-team@latest/actions/reference/context-and-expression-syntax-for-github-actions).
163
-
164
171
## Examples
165
172
173
+
### Different author/committer configurations
174
+
166
175
If you don't want to use your GitHub username for the CI commits, you can use the `default_author` option to make it appear as if it was made by "github-actions"
Do you want to lint your JavaScript files, located in the `src` folder, with ESLint, so that fixable changes are done without your intervention? You can use a workflow like this:
204
215
205
216
```yaml
@@ -234,6 +245,8 @@ jobs:
234
245
add: '*.js'
235
246
```
236
247
248
+
### Running the action in a different directory
249
+
237
250
If you need to run the action on a repository that is not located in [`$GITHUB_WORKSPACE`](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/using-environment-variables#default-environment-variables), you can use the `cwd` option: the action uses a `cd` normal command, so the path should follow bash standards.
238
251
239
252
```yaml
@@ -322,6 +335,10 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
322
335
323
336
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
324
337
338
+
### Additional credits
339
+
340
+
This action is inspired by [`git-auto-commit-action`](https://github.com/stefanzweifel/git-auto-commit-action) by [Stefan Zweifel](https://github.com/stefanzweifel).
341
+
325
342
## License
326
343
327
344
This action is distributed under the MIT license, check the [license](LICENSE) for more info.
0 commit comments