Skip to content

Commit

Permalink
Allow git check skipping (#26)
Browse files Browse the repository at this point in the history
* Allow skipping of git checking

* Make note of branch changes

* Use &&

* Clean up ENV

* Capitalize T in test

* Rename skip_git to skip_git_check. Replace inputs with a table

* Update Change log
  • Loading branch information
Cyb3r-Jak3 authored Feb 19, 2022
1 parent 6383a87 commit acd3f27
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 48 deletions.
31 changes: 14 additions & 17 deletions .github/workflows/action-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,33 @@ on:


jobs:
test:
Test:
runs-on: ubuntu-latest
env:
HTML5_ACTION_DEBUG: true
steps:

- name: No checkout test
uses: Cyb3r-Jak3/html5validator-action@master
# Need to manually change branch when making changes
- name: No checkout test. Fail at Git Check
uses: Cyb3r-Jak3/html5validator-action@allow_git_check_skipping
with:
root: tests/valid/
continue-on-error: true
env:
HTML5_ACTION_DEBUG: true

# Need to manually change branch when making changes
- name: No checkout test. Passes at Git Check
uses: Cyb3r-Jak3/html5validator-action@allow_git_check_skipping
with:
root: tests/valid/
skip_git_check: true
continue-on-error: true

- uses: actions/checkout@v2

- name: Plain Test
uses: ./
with:
root: tests/valid/
env:
HTML5_ACTION_DEBUG: true

- name: Testing Options
id: valid
Expand All @@ -42,25 +49,19 @@ jobs:
log_level: INFO
extra: -lll
css: true
env:
HTML5_ACTION_DEBUG: true

- name: Test config
id: config
uses: ./
with:
config: tests/example_config.yaml
env:
HTML5_ACTION_DEBUG: true

- name: Check Blacklist
id: blacklist
uses: ./
with:
root: tests/
blacklist: invalid
env:
HTML5_ACTION_DEBUG: true

- name: Check Failure
id: invalid
Expand All @@ -69,8 +70,6 @@ jobs:
root: tests/invalid/
log_level: INFO
css: true
env:
HTML5_ACTION_DEBUG: true
continue-on-error: true

- name: Check Empty
Expand All @@ -79,8 +78,6 @@ jobs:
with:
log_level: INFO
css: true
env:
HTML5_ACTION_DEBUG: true
continue-on-error: true

- uses: actions/upload-artifact@v2
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
<!-- markdownlint-disable MD024 -->
# Changelog

## [Not Released]

### Adds

* Ability to skip the git checkout check

## [v0.7.0] - 2021-11-03

### Adds
Expand Down
40 changes: 11 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,17 @@ For help getting started, check out the [wiki](https://github.com/Cyb3r-Jak3/htm

## Inputs

### `root`

The root path of the files you want to check.

### `config`

The path to the config file.

### `extra`

Additional arguments to pass to html5validator.

### `format`

The format for logging. Supported values: `json, xml, gnu, text`.

### `log_level`

The log level to use. Supported values: `DEBUG, INFO, WARNING`. Default: `WARNING`.

### `css`

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

### `blacklist`

The names of files or directories to blacklist.

**These are not full paths.**
| Flag | Description | Default |
|------------------|-------------------------------------------------------------------------------|-----------|
| `root` | The root path of the files you want to check | |
| `config` | Path to config file to use. | |
| `format` | The format for logging. Supported values: `json, xml, gnu, text`. | |
| `log_level` | The log level to use. Supported values: `DEBUG, INFO, WARNING`. | `WARNING` |
| `css` | Enable to check css. Supported values: `true, false` | `false` |
| `blacklist`* | The names of files or directories to blacklist. **These are not full paths.** | |
| `skip_git_check` | Skip checking that the repo has been checked out | |

* Examples of `blacklist`

Correct Example:

Expand Down
6 changes: 5 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ inputs:
description: "Extra arguments to test with"
required: false
format:
description: "Format for logging output. Valid values: gnu,xml,json,text"
description: "Format for logging output. Valid values: gnu, xml, json, text"
required: false
log_level:
description: "Logging Level. Valid values: DEBUG, INFO, WARNING. Default: WARNING"
Expand All @@ -27,6 +27,10 @@ inputs:
blacklist:
description: "Files or directories to ignore in checking"
required: false
skip_git_check:
description: "Skip checking that code has been checked out"
required: false
default: false
outputs:
result:
description: 'The exit code'
Expand Down
2 changes: 1 addition & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function main() {
fi
echo "Running Validator"

if ! git -C . rev-parse 2>/dev/null; then
if ! git -C . rev-parse 2>/dev/null && ! usesBoolean "${INPUT_SKIP_GIT_CHECK}"; then
echo ::set-output name=result::"There is no git respository detected"
echo ::error::"There is no git respository detected"
exit 1
Expand Down

0 comments on commit acd3f27

Please sign in to comment.