Skip to content

Commit

Permalink
🐛 Fixes small regex bug
Browse files Browse the repository at this point in the history
  • Loading branch information
rickstaa committed Jan 7, 2021
1 parent 6105e35 commit 62293f9
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 26 deletions.
42 changes: 21 additions & 21 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,47 +8,47 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

> 7 January 2021
- :bug: Fixes a small bug that occured when -q flag was supplied [`bdac073`](https://github.com/rickstaa/action-black/commit/bdac07366af31352da423f14e895e0d7d07f2ab1)
* :bug: Fixes a small bug that occured when -q flag was supplied [`bdac073`](https://github.com/rickstaa/action-black/commit/bdac07366af31352da423f14e895e0d7d07f2ab1)

#### [v1.0.7](https://github.com/rickstaa/action-black/compare/v1.0.6...v1.0.7)

> 7 January 2021
- :fire: Removes redundant file [`be796de`](https://github.com/rickstaa/action-black/commit/be796deafc8c447c397d850bca7e0bb51f54d6f3)
* :fire: Removes redundant file [`be796de`](https://github.com/rickstaa/action-black/commit/be796deafc8c447c397d850bca7e0bb51f54d6f3)

#### [v1.0.6](https://github.com/rickstaa/action-black/compare/v1.0.5...v1.0.6)

> 7 January 2021
- :green_heart: Updates gh-action tests [`f558f66`](https://github.com/rickstaa/action-black/commit/f558f66104333772525bcce3e12f6e9703693af6)
- :twisted_rightwards_arrows: Merge branches 'main' and 'main' of github.com:rickstaa/action-black into main [`9c8c722`](https://github.com/rickstaa/action-black/commit/9c8c72204516a28346cb75c4943be98f95972294)
- :heart: Create funding.yml [`2d27a23`](https://github.com/rickstaa/action-black/commit/2d27a239aea7b054a2779692f4062818ade26c85)
* :green_heart: Updates gh-action tests [`f558f66`](https://github.com/rickstaa/action-black/commit/f558f66104333772525bcce3e12f6e9703693af6)
* :twisted_rightwards_arrows: Merge branches 'main' and 'main' of github.com:rickstaa/action-black into main [`9c8c722`](https://github.com/rickstaa/action-black/commit/9c8c72204516a28346cb75c4943be98f95972294)
* :heart: Create funding.yml [`2d27a23`](https://github.com/rickstaa/action-black/commit/2d27a239aea7b054a2779692f4062818ade26c85)

#### [v1.0.5](https://github.com/rickstaa/action-black/compare/v1.0.4...v1.0.5)

> 7 January 2021
- :bug: Fixes small regex bug [`225e7fc`](https://github.com/rickstaa/action-black/commit/225e7fcc711d2e80c0bd740915ade2efdbdf179b)
* :bug: Fixes small regex bug [`225e7fc`](https://github.com/rickstaa/action-black/commit/225e7fcc711d2e80c0bd740915ade2efdbdf179b)

#### [v1.0.4](https://github.com/rickstaa/action-black/compare/v1.0.3...v1.0.4)

> 7 January 2021
- :art: Updates code comments [`74c21d6`](https://github.com/rickstaa/action-black/commit/74c21d65892f47f21bd499e2e7b5fcc4da15db66)
* :art: Updates code comments [`74c21d6`](https://github.com/rickstaa/action-black/commit/74c21d65892f47f21bd499e2e7b5fcc4da15db66)

#### [v1.0.3](https://github.com/rickstaa/action-black/compare/v1.0.2...v1.0.3)

> 7 January 2021
- :memo: Updates README.md [`ee96003`](https://github.com/rickstaa/action-black/commit/ee960032905448ea58b01c5176e07eb839860f3b)
* :memo: Updates README.md [`ee96003`](https://github.com/rickstaa/action-black/commit/ee960032905448ea58b01c5176e07eb839860f3b)

#### [v1.0.2](https://github.com/rickstaa/action-black/compare/v1.0.1...v1.0.2)

> 7 January 2021
- :page_facing_up: Creates LICENSE [`718a1a1`](https://github.com/rickstaa/action-black/commit/718a1a1d2b6ad697b4ea7a73f627086844683c31)
- :memo: Updates CHANGELOG [`04fd83d`](https://github.com/rickstaa/action-black/commit/04fd83db4738561c668301643bd885d0ba82cbc2)
- :art: Updates action description [`1cd27b6`](https://github.com/rickstaa/action-black/commit/1cd27b68039cfd809a1dbf0b69221ccdb6c108e6)
* :page_facing_up: Creates LICENSE [`718a1a1`](https://github.com/rickstaa/action-black/commit/718a1a1d2b6ad697b4ea7a73f627086844683c31)
* :memo: Updates CHANGELOG [`04fd83d`](https://github.com/rickstaa/action-black/commit/04fd83db4738561c668301643bd885d0ba82cbc2)
* :art: Updates action description [`1cd27b6`](https://github.com/rickstaa/action-black/commit/1cd27b68039cfd809a1dbf0b69221ccdb6c108e6)

#### [v1.0.1](https://github.com/rickstaa/action-black/compare/v1.0...v1.0.1)

Expand All @@ -62,17 +62,17 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

> 7 January 2021
- :bug: Fixes a small bug that occured when -q flag was supplied [`bdac073`](https://github.com/rickstaa/action-black/commit/bdac07366af31352da423f14e895e0d7d07f2ab1)
- :memo: Updates changelog [`0d685a0`](https://github.com/rickstaa/action-black/commit/0d685a040a79a0973dc07031eebd012b73b6892b)
- :fire: Removes redundant file [`be796de`](https://github.com/rickstaa/action-black/commit/be796deafc8c447c397d850bca7e0bb51f54d6f3)
* :bug: Fixes a small bug that occured when -q flag was supplied [`bdac073`](https://github.com/rickstaa/action-black/commit/bdac07366af31352da423f14e895e0d7d07f2ab1)
* :memo: Updates changelog [`0d685a0`](https://github.com/rickstaa/action-black/commit/0d685a040a79a0973dc07031eebd012b73b6892b)
* :fire: Removes redundant file [`be796de`](https://github.com/rickstaa/action-black/commit/be796deafc8c447c397d850bca7e0bb51f54d6f3)

### [v1.0.0](https://github.com/rickstaa/action-black/compare/v0.1...v1.0.0)

> 6 January 2021
- :memo: Updates readme and fixes output argument bug [`9bf90a1`](https://github.com/rickstaa/action-black/commit/9bf90a117c9314f89b87f7119716dd2c3609259c)
- :white_check_mark: Updates tests [`2190e08`](https://github.com/rickstaa/action-black/commit/2190e083210d99c36c4978805856aecbdf922cec)
- :white_check_mark: Updates tests [`fdfe00f`](https://github.com/rickstaa/action-black/commit/fdfe00fcf7d61ff3d33fad27cb22ba65cc3126dd)
* :memo: Updates readme and fixes output argument bug [`9bf90a1`](https://github.com/rickstaa/action-black/commit/9bf90a117c9314f89b87f7119716dd2c3609259c)
* :white_check_mark: Updates tests [`2190e08`](https://github.com/rickstaa/action-black/commit/2190e083210d99c36c4978805856aecbdf922cec)
* :white_check_mark: Updates tests [`fdfe00f`](https://github.com/rickstaa/action-black/commit/fdfe00fcf7d61ff3d33fad27cb22ba65cc3126dd)

#### [v0.1](https://github.com/rickstaa/action-black/compare/v0.1.0...v0.1)

Expand All @@ -86,12 +86,12 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

> 6 January 2021
- :sparkles: Adds gh-action scripts/files [`730a1ff`](https://github.com/rickstaa/action-black/commit/730a1ffed1c9cefeb8bfd4083b0560aee62ed987)
- :memo: Updates documentation and fixes black_args input bug [`ba7f4d8`](https://github.com/rickstaa/action-black/commit/ba7f4d87f956d35379e84f4e76afd5574c1f6ecb)
- :bug: Fixes github action input argument bug [`a923042`](https://github.com/rickstaa/action-black/commit/a923042b1b777983cc377fadbd6728db100aa8ad)
* :sparkles: Adds gh-action scripts/files [`730a1ff`](https://github.com/rickstaa/action-black/commit/730a1ffed1c9cefeb8bfd4083b0560aee62ed987)
* :memo: Updates documentation and fixes black_args input bug [`ba7f4d8`](https://github.com/rickstaa/action-black/commit/ba7f4d87f956d35379e84f4e76afd5574c1f6ecb)
* :bug: Fixes github action input argument bug [`a923042`](https://github.com/rickstaa/action-black/commit/a923042b1b777983cc377fadbd6728db100aa8ad)

#### v0.0.0

> 6 January 2021
- :tada: First commit [`ffc38c6`](https://github.com/rickstaa/action-black/commit/ffc38c6a1913d6d521e60c93b52e82c4013b127a)
* :tada: First commit [`ffc38c6`](https://github.com/rickstaa/action-black/commit/ffc38c6a1913d6d521e60c93b52e82c4013b127a)
15 changes: 10 additions & 5 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,27 @@ else
fi

# Check if formatting was requested
if [[ "${black_args[*]}" == *" --diff "* || "${black_args[*]}" == *" --check "* ]]; then
regex='\S?(--diff|--check)\S?'
if [[ "${black_args[*]}" =~ $regex ]]; then
formatting="false"
black_print_str="Checking"
else
formatting="true"
black_print_str="Formatting"
fi

# Remove '-q' and '--quiet' from the black arguments if present
# NOTE: Having these flags in the action prevents the action from working.
# Check if '-q' or `--quiet` flags are present
quiet="false"
black_args_tmp=()
for item in "${black_args[@]}"; do
if [[ "${item}" != "-q" && "${item}" != "--quiet" ]]; then
black_args_tmp+=("${item}") #Quotes when working with strings
black_args_tmp+=("${item}")
else
# Remove `quiet` related flags
# NOTE: Prevents us from checking if files were formatted
if [[ "${formatting}" != 'true' ]]; then
black_args_tmp+=("${item}")
fi
quiet="true"
fi
done
Expand Down Expand Up @@ -61,7 +66,7 @@ if [[ "${formatting}" != "true" ]]; then
fi
else
# Check if black formatted files
regex='\s?[0-9]+\sfiles? reformatted(\.|,)\s?'
regex='\S?[0-9]+\sfiles?\sreformatted(\.|,)\S?'
if [[ "${black_output[*]}" =~ $regex ]]; then
echo "::set-output name=is_formatted::true"
else
Expand Down

0 comments on commit 62293f9

Please sign in to comment.