Skip to content

Commit 98ce691

Browse files
authored
Merge pull request actions#3 from EndBug/force
Add force option
2 parents 04cd48b + abd5c01 commit 98ce691

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@ Add a step like this to your workflow:
1111

1212
```yaml
1313
- name: Commit changes # This is the step name that will be displayed in your runs
14-
uses: EndBug/add-and-commit@v2.0.0 # You can change this to use a specific version
14+
uses: EndBug/add-and-commit@v2.1.0 # You can change this to use a specific version
1515
with: # See more info about inputs below
1616
author_name: Your Name
1717
author_email: mail@example.com
1818
message: "Your commit message"
1919
path: "."
2020
pattern: "*.js"
21+
force: false
2122
env:
2223
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Leave this line unchanged
2324
```
@@ -29,6 +30,7 @@ Add a step like this to your workflow:
2930
- `message` : the message for the commit
3031
- `path` : the path(s) to stage files from
3132
- `pattern` : the pattern that matches file names
33+
- `force` : whether to use the force option on git add, in order to bypass eventual gitignores
3234

3335
### Environment variables:
3436

@@ -63,7 +65,7 @@ jobs:
6365
run: eslint "src/**" --fix
6466
6567
- name: Commit changes
66-
uses: EndBug/add-and-commit@v2.0.0
68+
uses: EndBug/add-and-commit@v2.1.0
6769
with:
6870
author_name: Your Name
6971
author_email: mail@example.com

action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ inputs:
1010
description: 'The email of the user that will be displayed as the author of the commit'
1111
required: true
1212
default: 'actions@github.com'
13+
force:
14+
description: 'Whether to use the force option on git add, in order to bypass eventual gitignores'
15+
required: false
16+
default: false
1317
message:
1418
description: 'The message for the commit'
1519
required: true

entrypoint.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ EOF
1919
}
2020

2121
add() {
22-
find $INPUT_PATH -name "$INPUT_PATTERN" | while read x; do git add $x; done
22+
if $INPUT_FORCE
23+
then find $INPUT_PATH -name "$INPUT_PATTERN" | while read x; do git add -f $x; done
24+
else find $INPUT_PATH -name "$INPUT_PATTERN" | while read x; do git add $x; done
25+
fi
2326
}
2427

2528
# This is needed to make the check work for untracked files

0 commit comments

Comments
 (0)