Skip to content

Commit

Permalink
Adds ignore option (#15)
Browse files Browse the repository at this point in the history
* Starting ignore option

* Update documentation
  • Loading branch information
Cyb3r-Jak3 authored Mar 28, 2021
1 parent cc0b004 commit c8012a8
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 2 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/action-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,17 @@ jobs:
id: config
uses: ./
with:
root: empty
config: tests/example_config.yaml
action_debug: true

- name: Check Ignore
id: ignore
uses: ./
with:
root: tests/
ignore: invalid
action_debug: true

- name: Check Failure
id: invalid
uses: ./
Expand Down Expand Up @@ -67,4 +74,5 @@ jobs:
VALID_OUT: ${{ steps.valid.outputs.result }}
INVALID_OUT: ${{ steps.invalid.outputs.result }}
CONFIG_OUT: ${{ steps.config.outputs.result }}
IGNORE_OUT: ${{ steps.ignore.outputs.result }}
EMPTY_OUT: ${{ steps.empty.outputs.result }}
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<!-- markdownlint-disable MD024 -->
# Changelog

## [v0.5] - 2021-03-27

- Adds ignore option to ignore files and directories

## [v0.4.4] - 2020-12-05

### Changed
Expand Down
28 changes: 27 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,32 @@ Log level to use. Supported values: `DEBUG, INFO, WARNING`. Default: `Warning`.

If to check css. Supported values: `true, false`. Default: `false`.

### `Ignore`

Names of files or directories to ignore.
**This is not full paths**

Example:
This will work

```yaml
- name: HTML5Validator
uses: Cyb3r-Jak3/html5validator-action
with:
root: tests/
ignore: invalid
```
This will not
```yaml
- name: HTML5Validator
uses: Cyb3r-Jak3/html5validator-action
with:
root: tests/
ignore: tests/invalid
```
## Outputs
### `result`
Expand All @@ -42,7 +68,7 @@ The exit code of the validation.
## Example usage

```yaml
uses: Cyb3r-Jak3/html5validator-action@v0.4.4
uses: Cyb3r-Jak3/html5validator-action@v0.5
with:
root: tests/valid/
```
Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ inputs:
css:
description: "Checks css as well"
required: false
ignore:
description: "Files or directories to ignore in checking"
required: false
action_debug:
description: "Flag that increase verbose output only used for troubleshooting the action."
required: false
Expand Down
7 changes: 7 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ set -e
function main() {
if usesBoolean "${INPUT_ACTION_DEBUG}"; then
set -x
INPUT_LOG_LEVEL=DEBUG
html5validator --version
fi

if ! uses "${INPUT_ROOT}" && ! uses "${INPUT_CONFIG}"; then
echo "Need either root or config file"
echo ::set-output name=result::"no config file or root path given"
Expand All @@ -18,6 +21,10 @@ function main() {
BuildARGS+="--format ${INPUT_FORMAT}"
fi

if uses "${INPUT_IGNORE}"; then
BuildARGS+=" --blacklist ${INPUT_IGNORE}"
fi

if usesBoolean "${INPUT_CSS}"; then
BuildARGS+=" --also-check-css"
fi
Expand Down
4 changes: 4 additions & 0 deletions output_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ if [[ "$CONFIG_OUT" -ne 0 ]]; then
echo "Config step failed"
exit 1
fi
if [[ "$IGNORE_OUT" -ne 0 ]]; then
echo "Ignore step failed"
exit 1
fi
if [[ "$EMPTY_OUT" != "no config file or root path given" ]]; then
echo "Empty check failed"
exit 1;
Expand Down

0 comments on commit c8012a8

Please sign in to comment.