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
- Remove the need of a GITHUB_TOKEN. Users now have to use `actions/checkout@v2` or higher [#36](https://github.com/stefanzweifel/git-auto-commit-action/pull/36)
Copy file name to clipboardExpand all lines: README.md
+8-44Lines changed: 8 additions & 44 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,15 +3,17 @@
3
3
This GitHub Action automatically commits files which have been changed during a Workflow run and pushes the Commit back to GitHub.
4
4
The Committer is "GitHub Actions <actions@github.com>" and the Author of the Commit is "Your GitHub Username <github_username@users.noreply.github.com>.
5
5
6
-
If no changes are available, the Actions does nothing.
6
+
If no changes are detected, the Action does nothing.
7
7
8
8
This Action has been inspired and adapted from the [auto-commit](https://github.com/cds-snc/github-actions/tree/master/auto-commit
9
9
)-Action of the Canadian Digital Service and this [commit](https://github.com/elstudio/actions-js-build/blob/41d604d6e73d632e22eac40df8cc69b5added04b/commit/entrypoint.sh)-Action by Eric Johnson.
10
10
11
-
*This action currently can't be used in conjunction with pull requests of forks. See [issue #25](https://github.com/stefanzweifel/git-auto-commit-action/issues/25) for more information.*
11
+
*This Action currently can't be used in conjunction with pull requests of forks. See [issue #25](https://github.com/stefanzweifel/git-auto-commit-action/issues/25) for more information.*
12
12
13
13
## Usage
14
14
15
+
**Note:** This Action requires that you use `action/checkout@v2` or above to checkout your repository.
16
+
15
17
Add the following step at the end of your job.
16
18
17
19
```yaml
@@ -28,13 +30,8 @@ Add the following step at the end of your job.
28
30
29
31
# Optional repository path
30
32
repository: .
31
-
32
-
env:
33
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34
33
```
35
34
36
-
You **do not** have to create a new secret called `GITHUB_TOKEN` in your repository. `GITHUB_TOKEN` is a special token GitHub creates automatically during a Workflow run. (See [the documentation](https://help.github.com/en/articles/virtual-environments-for-github-actions#creating-and-using-secrets-encrypted-variables) for details)
37
-
38
35
The Action will only commit files back, if changes are available. The resulting commit **will not trigger** another GitHub Actions Workflow run!
39
36
40
37
It is recommended to use this Action in Workflows which listen to the `pull_request` event. If you want to use the Action on other events, you have to hardcode the value for `branch` as `github.head_ref` is only available in Pull Requests.
@@ -46,9 +43,6 @@ The most common use case for this, is when you're running a Linter or Code-Style
46
43
47
44
In this example I'm running `php-cs-fixer` in a PHP project.
48
45
49
-
50
-
### Example with `actions/checkout@v2`
51
-
52
46
```yaml
53
47
name: php-cs-fixer
54
48
@@ -70,46 +64,16 @@ jobs:
70
64
with:
71
65
commit_message: Apply php-cs-fixer changes
72
66
branch: ${{ github.head_ref }}
73
-
env:
74
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
75
-
76
-
```
77
-
78
-
### Example with `actions/checkout@v1`
79
-
80
-
```yaml
81
-
name: php-cs-fixer
82
-
83
-
on:
84
-
pull_request:
85
-
86
-
jobs:
87
-
php-cs-fixer:
88
-
runs-on: ubuntu-latest
89
-
90
-
steps:
91
-
- uses: actions/checkout@v1
92
-
with:
93
-
fetch-depth: 1
94
-
95
-
- name: Run php-cs-fixer
96
-
uses: docker://oskarstark/php-cs-fixer-ga
97
-
98
-
- name: Commit changed files
99
-
uses: stefanzweifel/git-auto-commit-action@v2.5.0
100
-
with:
101
-
commit_message: Apply php-cs-fixer changes
102
-
branch: ${{ github.head_ref }}
103
-
file_pattern: src/\*.php
104
-
env:
105
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
106
-
107
67
```
108
68
109
69
### Inputs
110
70
111
71
Checkout [`action.yml`](https://github.com/stefanzweifel/git-auto-commit-action/blob/master/action.yml) for a full list of supported inputs.
112
72
73
+
## Troubleshooting
74
+
75
+
- If your Workflow can't push the commit to the repository because of authentication issues, please update your Workflow configuration and usage of [`ations/checkout`](https://github.com/actions/checkout#usage). (Updating the `token` value with a Personal Access Token should fix your issues)
76
+
113
77
## Known Issues
114
78
115
79
- GitHub currently prohibits Actions like this to push changes from a fork to the upstream repository. See [issue #25](https://github.com/stefanzweifel/git-auto-commit-action/issues/25) for more information.
0 commit comments