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
+9-19Lines changed: 9 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,6 +24,10 @@ Add a step like this to your workflow:
24
24
# Default: '.'
25
25
cwd: './path/to/the/repo'
26
26
27
+
# Whether to use the --force option on git add, in order to bypass eventual gitignores
28
+
# Default: false
29
+
force: true
30
+
27
31
# The message for the commit
28
32
# Default: 'Commit from GitHub Actions'
29
33
message: 'Your commit message'
@@ -36,9 +40,10 @@ Add a step like this to your workflow:
36
40
# Default: '*.*'
37
41
pattern: "*.js"
38
42
39
-
# Whether to use the --force option on git add, in order to bypass eventual gitignores
40
-
# Default: false
41
-
force: true
43
+
# The files to remove
44
+
# Default: ''
45
+
remove: "./dir/old_file.js"
46
+
42
47
env:
43
48
# This is necessary in order to push a commit to the repo
44
49
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Leave this line unchanged
@@ -51,22 +56,7 @@ With that said, you can just copy the example line and don't worry about it. If
51
56
52
57
### Deleting files:
53
58
54
-
This action only **adds** files so in order to commit a file deletion you need to stage that separately: for that, you can run `git rm` in a previous step. Here's a quick example:
55
-
56
-
```yaml
57
-
- run: git rm delete_me.txt
58
-
59
-
- uses: EndBug/add-and-commit@v2
60
-
with:
61
-
author_name: Your Name
62
-
author_email: mail@example.com
63
-
message: "Remove file"
64
-
path: "."
65
-
pattern: "*.js" # The path is not important, the file will get removed anyway: that means you can still use the action as usual
66
-
force: true
67
-
env:
68
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
69
-
```
59
+
You can delete files with the `remove` option: that runs a `git remove` command that will stage the files in the given path for removal. Please keep in mind that if the path is wrong the action will stop.
0 commit comments