diff --git a/README.md b/README.md index b19aff9..83b93e9 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ Add a step like this to your workflow: message: "Your commit message" path: "." pattern: "*.js" + force: false env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Leave this line unchanged ``` @@ -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: @@ -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.0.1 with: author_name: Your Name author_email: mail@example.com diff --git a/action.yml b/action.yml index 1205a00..1d13a38 100644 --- a/action.yml +++ b/action.yml @@ -10,6 +10,10 @@ inputs: description: 'The email of the user that will be displayed as the author of the commit' required: true default: 'actions@github.com' + 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 diff --git a/entrypoint.sh b/entrypoint.sh index 9e1b8d8..6032cb4 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -19,7 +19,8 @@ EOF } add() { - find $INPUT_PATH -name "$INPUT_PATTERN" | while read x; do git add $x; done + if $INPUT_FORCE 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 } # This is needed to make the check work for untracked files