Skip to content

Commit

Permalink
Add input setting for core.autocrlf (#116)
Browse files Browse the repository at this point in the history
* Add input setting for core.autocrlf

Resolves: #101

* Update action.yml

* Update entrypoint.sh

* Update README.md

* Update action.yml
  • Loading branch information
jackton1 committed Nov 24, 2021
1 parent bafc8fe commit a8eae92
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ Verify that certain files or directories did or did not change during the workfl
| Input | type | required | default | description |
|:-------------:|:-----------:|:--------------:|:-----------------------------:|:--------------------------:|
| token | `string` | `true` | `${{ github.token }}` <br/> | [GITHUB\_TOKEN](https://docs.github.com/en/free-pro-team@latest/actions/reference/authentication-in-a-workflow#using-the-github_token-in-a-workflow) <br /> or a repo scoped <br /> [Personal Access Token](https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token) |
| files | `string[]` OR `string` | `true` | | Check for uncommited changes <br> using only <br> these list of file(s) |
| files | `string[]` OR `string` | `true` | | Check for uncommited changes <br> using only <br> these list of file(s) |
| autocrlf | `string` | `true` | `input` | Modify the [core.autocrlf](https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration#_core_autocrlf) <br> setting possible values <br> (true, false, input). |

## Outputs

Expand Down
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ inputs:
files:
description: List of files to check for changes.
required: true
autocrlf:
description: Modify the core.autocrlf setting possible values (true, false, input)
default: 'input'
required: true

outputs:
files_changed:
Expand All @@ -33,6 +37,7 @@ runs:
# https://github.community/t/input-variable-name-is-not-available-in-composite-run-steps/127611
INPUT_TOKEN: ${{ inputs.token }}
INPUT_FILES: ${{ inputs.files }}
INPUT_AUTO_CRLF: ${{ inputs.autocrlf }}
branding:
icon: file-text
Expand Down
6 changes: 1 addition & 5 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@

set -e

if [[ "$PLATFORM" == 'Windows' ]]; then
git config --local core.autocrlf true
else
git config --local core.autocrlf input
fi
git config --local core.autocrlf "$INPUT_AUTO_CRLF"

CHANGED_FILES=()

Expand Down

0 comments on commit a8eae92

Please sign in to comment.