Skip to content

Commit

Permalink
Merge pull request #2 from DecimalTurn/dev
Browse files Browse the repository at this point in the history
Add input checks
  • Loading branch information
DecimalTurn authored Jul 7, 2024
2 parents ffaf29f + 477f597 commit 21d2063
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,30 @@ inputs:
runs:
using: "composite"
steps:
- name: Check inputs
run: |
echo "extensions: '${{ inputs.extensions }}'"
if [[ -z "${{ inputs.extensions }}" ]]; then
echo "🔴 Error: No extensions provided."
echo "Make sure you include the extension input parameter. ie.:"
echo " uses: DecimalTurn/Enforce-CRLF@main"
echo " with:"
echo " extensions: .bas, .frm, .cls"
exit 1
fi
IFS=',' read -r -a ext_array <<< "${{ inputs.extensions }}"
for ext in "${ext_array[@]}"; do
ext=$(echo "$ext" | xargs) # Trim leading and trailing spaces
if [[ $ext != .* ]]; then
echo "🔴 Error: Extension '${ext}' does not begin with a dot."
exit 1
fi
if [[ $ext =~ \ ]]; then
echo "🔴 Error: Extension '${ext}' contains a space."
exit 1
fi
done
shell: bash
- name: Configure Git
run: |
git config --global core.autocrlf false
Expand Down

0 comments on commit 21d2063

Please sign in to comment.