Skip to content

Add force option #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ Add a step like this to your workflow:

```yaml
- name: Commit changes # This is the step name that will be displayed in your runs
uses: EndBug/add-and-commit@v2.0.0 # You can change this to use a specific version
uses: EndBug/add-and-commit@v2.1.0 # You can change this to use a specific version
with: # See more info about inputs below
author_name: Your Name
author_email: [email protected]
message: "Your commit message"
path: "."
pattern: "*.js"
force: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Leave this line unchanged
```
Expand All @@ -29,6 +30,7 @@ Add a step like this to your workflow:
- `message` : the message for the commit
- `path` : the path(s) to stage files from
- `pattern` : the pattern that matches file names
- `force` : whether to use the force option on git add, in order to bypass eventual gitignores

### Environment variables:

Expand Down Expand Up @@ -63,7 +65,7 @@ jobs:
run: eslint "src/**" --fix

- name: Commit changes
uses: EndBug/add-and-commit@v2.0.0
uses: EndBug/add-and-commit@v2.1.0
with:
author_name: Your Name
author_email: [email protected]
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ inputs:
description: 'The email of the user that will be displayed as the author of the commit'
required: true
default: '[email protected]'
force:
description: 'Whether to use the force option on git add, in order to bypass eventual gitignores'
required: false
default: false
message:
description: 'The message for the commit'
required: true
Expand Down
5 changes: 4 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ EOF
}

add() {
find $INPUT_PATH -name "$INPUT_PATTERN" | while read x; do git add $x; done
if $INPUT_FORCE
then find $INPUT_PATH -name "$INPUT_PATTERN" | while read x; do git add -f $x; done
else find $INPUT_PATH -name "$INPUT_PATTERN" | while read x; do git add $x; done
fi
}

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