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
+29-27Lines changed: 29 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ If your use case is not covered by git-auto-commit, you might want to check out
20
20
21
21
Adding git-auto-commit to your Workflow only takes a couple lines of code.
22
22
23
-
1. Set the `contents`-permission of the default GITHUB_TOKEN to `true`. (Required to push new commits to the repository)
23
+
1. Set the `contents`-permission of the default GITHUB_TOKEN to `write`. (Required to push new commits to the repository)
24
24
2. Add the following step at the end of your job, after other steps that might add or change files.
25
25
26
26
```yaml
@@ -69,7 +69,7 @@ The following is an extended example with all available options.
69
69
# Defaults to "Apply automatic changes"
70
70
commit_message: Automated Change
71
71
72
-
# Optional. Remote branch name where commit is going to be pushed to.
72
+
# Optional. Remote branch name where commit is going to be pushed to.
73
73
# Defaults to the current branch.
74
74
branch: feature-123
75
75
@@ -92,8 +92,8 @@ The following is an extended example with all available options.
92
92
commit_user_name: My GitHub Actions Bot # defaults to "github-actions[bot]"
93
93
commit_user_email: my-github-actions-bot@example.org # defaults to "41898282+github-actions[bot]@users.noreply.github.com"
94
94
commit_author: Author <actions@github.com> # defaults to "username <numeric_id+username@users.noreply.github.com>", where "numeric_id" and "username" belong to the author of the commit that triggered the run
95
-
96
-
# Optional. Tag name to be created in the local repository and
95
+
96
+
# Optional. Tag name to be created in the local repository and
97
97
# pushed to the remote repository on the defined branch.
98
98
# If only one of `tag_name` or `tagging_message` is provided, the value of the provided field will be used for both tag name and message.
99
99
tag_name: 'v1.0.0'
@@ -102,7 +102,7 @@ The following is an extended example with all available options.
102
102
# If only one of `tag_name` or `tagging_message` is provided, the value of the provided field will be used for both tag name and message.
103
103
tagging_message: 'Codename "Sunshine"'
104
104
105
-
# Optional. Option used by `git-status` to determine if the repository is
105
+
# Optional. Option used by `git-status` to determine if the repository is
106
106
# dirty. See https://git-scm.com/docs/git-status#_options
107
107
status_options: '--untracked-files=no'
108
108
@@ -113,27 +113,27 @@ The following is an extended example with all available options.
113
113
# Optional. Options used by `git-push`.
114
114
# See https://git-scm.com/docs/git-push#_options
115
115
push_options: '--force'
116
-
116
+
117
117
# Optional. Disable dirty check and always try to create a commit and push
118
-
skip_dirty_check: true
118
+
skip_dirty_check: true
119
119
120
120
# Optional. Skip internal call to `git fetch`
121
121
skip_fetch: true
122
122
123
123
# Optional. Skip internal call to `git checkout`
124
124
skip_checkout: true
125
-
125
+
126
126
# Optional. Skip internal call to `git push`
127
127
skip_push: true
128
128
129
-
# Optional. Prevents the shell from expanding filenames.
129
+
# Optional. Prevents the shell from expanding filenames.
# Optional. Create given branch name in local and remote repository.
134
134
create_branch: true
135
135
136
-
# Optional. Creates a new tag and pushes it to remote without creating a commit.
136
+
# Optional. Creates a new tag and pushes it to remote without creating a commit.
137
137
# Skips dirty check and changed files. Must be used in combination with `tag` and `tagging_message`.
138
138
create_git_tag_only: false
139
139
```
@@ -214,11 +214,11 @@ The goal of this Action is to be "the Action for committing files for the 80% us
214
214
215
215
The following is a list of edge cases the Action knowingly does not support:
216
216
217
-
**No `git pull` when the repository is out of date with remote.** The Action will not do a `git pull` before doing the `git push`. **You** are responsible for keeping the repository up to date in your Workflow runs.
217
+
**No `git pull` when the repository is out of date with remote.** The Action will not do a `git pull` before doing the `git push`. **You** are responsible for keeping the repository up to date in your Workflow runs.
218
218
219
219
**No support for running the Action in build matrices**. If your Workflow is using build matrices, and you want that each job commits and pushes files to the remote, you will run into the issue, that the repository in the workflow will become out of date. As the Action will not do a `git pull` for you, you have to do that yourself.
220
220
221
-
**No support for `git rebase` or `git merge`**. There are many strategies on how to integrate remote upstream changes to a local repository. `git-auto-commit` does not want to be responsible for doing that.
221
+
**No support for `git rebase` or `git merge`**. There are many strategies on how to integrate remote upstream changes to a local repository. `git-auto-commit` does not want to be responsible for doing that.
222
222
223
223
**No support for detecting line break changes between CR (Carriage Return) and LF (Line Feed)**. This is a low level issue, you have to resolve differently in your project. Sorry.
224
224
@@ -272,7 +272,7 @@ Does your workflow change a file, but "git-auto-commit" does not detect the chan
272
272
273
273
### Multiline Commit Messages
274
274
275
-
If your commit message should span multiple lines, you have to create a separate step to generate the string.
275
+
If your commit message should span multiple lines, you have to create a separate step to generate the string.
276
276
277
277
The example below can be used as a starting point to generate a multiline commit meesage. Learn more how multiline strings in GitHub Actions work in the [GitHub documentation](https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-commands#multiline-strings).
278
278
@@ -298,11 +298,11 @@ The example below can be used as a starting point to generate a multiline commit
If you would like to sign your commits using a GPG key, you will need to use an additional action.
305
+
If you would like to sign your commits using a GPG key, you will need to use an additional action.
306
306
You can use the [crazy-max/ghaction-import-gpg](https://github.com/crazy-max/ghaction-import-gpg) action and follow its setup instructions.
307
307
308
308
As git-auto-commit by default does not use **your** username and email when creating a commit, you have to override these values in your workflow.
@@ -329,6 +329,7 @@ See discussion [#334](https://github.com/stefanzweifel/git-auto-commit-action/di
329
329
330
330
### Use in forks from private repositories
331
331
332
+
332
333
By default, GitHub Actions doesn't run Workflows on forks from **private** repositories. To enable Actions for **private** repositories enable "Run workflows from pull requests" in your repository settings.
333
334
334
335
See [this announcement from GitHub](https://github.blog/2020-08-03-github-actions-improvements-for-fork-and-pull-request-workflows/) or the [GitHub docs](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#enabling-workflows-for-private-repository-forks) for details.
@@ -342,20 +343,20 @@ See [this announcement from GitHub](https://github.blog/2020-08-03-github-action
342
343
> \
343
344
> **If you use this Action in combination with a linter/fixer, it's easier if you run the Action on `push` on your `main`-branch.**
344
345
345
-
> [!WARNING]
346
+
> [!WARNING]
346
347
> Due to limitations of GitHub, this Action currently can't push commits to a base repository, if the fork _lives_ under an organisation. See [github/community#6634](https://github.com/orgs/community/discussions/5634) and [this comment](https://github.com/stefanzweifel/git-auto-commit-action/issues/211#issuecomment-1428849944) for details.
347
348
348
-
By default, this Action will not run on Pull Requests which have been opened by forks. (This is a limitation by GitHub, not by us.)
349
-
However, there are a couple of ways to use this Actions in Workflows that should be triggered by forked repositories.
349
+
By default, this Action will not run on Pull Requests which have been opened by forks. (This is a limitation by GitHub, not by us.)
350
+
However, there are a couple of ways to use this Action in Workflows that should be triggered by forked repositories.
350
351
351
352
### Workflow should run in **base** repository
352
353
353
354
> [!CAUTION]
354
-
> The following section explains how you can use git-auto-commit in combination with the `pull_request_target` trigger.
355
-
> **Using `pull_request_target` in your workflows can lead to repository compromise as [mentioned](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/) by GitHub's own security team. This means, that a bad actor could potentially leak/steal your GitHub Actions repository secrets.**
355
+
> The following section explains how you can use git-auto-commit in combination with the `pull_request_target` trigger.
356
+
> **Using `pull_request_target` in your workflows can lead to repository compromise as [mentioned](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/) by GitHub's own security team. This means, that a bad actor could potentially leak/steal your GitHub Actions repository secrets.**
356
357
> Please be aware of this risk when using `pull_request_target` in your workflows.
357
-
>
358
-
> If your workflow runs code-fixing tools, consider running the workflow on your default branch by listening to the `push` event or use a third-party tool like [autofix.ci](https://autofix.ci/).
358
+
>
359
+
> If your workflow runs code-fixing tools, consider running the workflow on your default branch by listening to the `push` event or use a third-party tool like [autofix.ci](https://autofix.ci/).
359
360
> We keep this documentation around, as many questions came in over the years, on how to use this action for public forks.
360
361
361
362
The workflow below runs whenever a commit is pushed to the `main`-branch or when activity on a pull request happens, by listening to the [`pull_request_target`](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target) event.
@@ -404,7 +405,7 @@ For more information about running Actions on forks, see [this announcement from
404
405
405
406
If you would like to use this Action to create a commit using [`--amend`](https://git-scm.com/docs/git-commit#Documentation/git-commit.txt---amend) and [`--no-edit`](https://git-scm.com/docs/git-commit#Documentation/git-commit.txt---no-edit) you need to make some adjustments.
406
407
407
-
> [!CAUTION]
408
+
> [!CAUTION]
408
409
> You should understand the implications of rewriting history if you amend a commit that has already been published. [See rebasing](https://git-scm.com/docs/git-rebase#_recovering_from_upstream_rebase).
409
410
410
411
First, you need to extract the previous commit message by using `git log -1 --pretty=%s`.
@@ -417,7 +418,7 @@ Finally, you have to use `push_options: '--force'` to overwrite the git history
417
418
The steps in your workflow might look like this:
418
419
419
420
```yaml
420
-
- uses: actions/checkout@4
421
+
- uses: actions/checkout@v4
421
422
with:
422
423
# Fetch the last 2 commits instead of just 1. (Fetching just 1 commit would overwrite the whole history)
423
424
fetch-depth: 2
@@ -442,6 +443,7 @@ The steps in your workflow might look like this:
442
443
See discussion in [#159](https://github.com/stefanzweifel/git-auto-commit-action/issues/159#issuecomment-845347950) for details.
443
444
444
445
## Troubleshooting
446
+
445
447
### Action does not push commit to repository
446
448
447
449
Make sure to [checkout the correct branch](#checkout-the-correct-branch).
@@ -460,7 +462,7 @@ If you still can't push the commit, and you're using branch protection rules or
460
462
The default `GITHUB_TOKEN` issued by GitHub Action does not have permission to make changes to workflow files located in `.github/workflows/`.
461
463
To fix this, please create a personal access token (PAT) and pass the token to the `actions/checkout`-step in your workflow. (Similar to [how to push to protected branches](https://github.com/stefanzweifel/git-auto-commit-action?tab=readme-ov-file#push-to-protected-branches)).
462
464
463
-
If a PAT does not work for you, you could also create a new GitHub app and use it's token in your workflows. See [this comment in #87](https://github.com/stefanzweifel/git-auto-commit-action/issues/87#issuecomment-1939138661) for details.
465
+
If a PAT does not work for you, you could also create a new GitHub app and use its token in your workflows. See [this comment in #87](https://github.com/stefanzweifel/git-auto-commit-action/issues/87#issuecomment-1939138661) for details.
464
466
465
467
See [#322](https://github.com/stefanzweifel/git-auto-commit-action/issues/322) for details and discussions around this topic.
466
468
@@ -483,7 +485,7 @@ If you create a fine-grained personal access token, apply the `Contents`-permiss
483
485
You can learn more about Personal Access Token in the [GitHub documentation](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens).
484
486
485
487
486
-
> [!TIP]
488
+
> [!TIP]
487
489
> If you're working in an organisation, and you don't want to create the PAT from your personal account, we recommend using a bot-account for such tokens.
488
490
489
491
If you go the "force pushes" route, you have to enable force pushes to a protected branch (see [documentation](https://docs.github.com/en/github/administering-a-repository/enabling-force-pushes-to-a-protected-branch)) and update your Workflow to use force push like this.
@@ -509,7 +511,7 @@ See [Issue #227](https://github.com/stefanzweifel/git-auto-commit-action/issues/
509
511
510
512
### Custom `file_pattern`, changed files but seeing "Working tree clean. Nothing to commit." in the logs
511
513
512
-
If you're using a custom `file_pattern` and the Action does not detect the changes made in your worfklow, you're probably running into a globbing issue.
514
+
If you're using a custom `file_pattern` and the Action does not detect the changes made in your workflow, you're probably running into a globbing issue.
513
515
514
516
Let's imagine you use `file_pattern: '*.md'` to detect and commit changes to all Markdown files in your repository.
515
517
If your Workflow now only updates `.md`-files in a subdirectory, but you have an untouched `.md`-file in the root of the repository, the git-auto-commit Action will display "Working tree clean. Nothing to commit." in the Workflow log.
Copy file name to clipboardExpand all lines: UPGRADING.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,8 @@
4
4
5
5
The previously removed options `create_branch`, `skip_fetch`, and `skip_checkout` have been reintroduced in git-auto-commit v7. If you had removed these options from your workflows when upgrading to v6, you can now add them back if needed.
6
6
7
-
Tagging a commit has been reworked. In addition to the existing `tagging_message`-option, a new `tag_name` option has been added. If you were using `tagging_message`, you can continue to do so, but if you want to specify a custom tag name and tag message, you can now use the `tag_name` and `tagging_message` option.
7
+
Tagging a commit has been reworked. In addition to the existing `tagging_message`-option, a new `tag_name` option has been added. If you were using `tagging_message`, you can continue to do so, but if you want to specify a custom tag name and tag message, you can now use the `tag_name` and `tagging_message` options.
8
+
8
9
(Specifying a `tagging_message` without a `tag_name` will create a tag with the name and message both set to the value of `tagging_message`.)
0 commit comments