Skip to content

Commit

Permalink
Merge pull request #6 from kehoecj/support_v1_6_0
Browse files Browse the repository at this point in the history
Add support for CFV 1.6.0
  • Loading branch information
kehoecj authored Jul 22, 2024
2 parents 390ba12 + 8502687 commit 765e568
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Test Defaults
uses: kehoecj/validate-configs-action@v1
uses: kehoecj/validate-configs-action@support_v1_6_0
with:
exclude-dirs: failing
search-paths: test/good.ini test/good.json test/good.toml test/good.xml test/good.yaml
Expand Down
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
FROM alpine:3.18
FROM alpine:3.20
COPY entrypoint.sh /entrypoint.sh
RUN apk --no-cache add curl tar && \
curl https://github.com/Boeing/config-file-validator/releases/download/v1.5.0/validator-v1.5.0-linux-386.tar.gz \
-o /tmp/validator-v1.5.0-linux-386.tar.gz -s -L && \
tar -xvf /tmp/validator-v1.5.0-linux-386.tar.gz -C /tmp && \
curl https://github.com/Boeing/config-file-validator/releases/download/v1.6.0/validator-v1.6.0-linux-386.tar.gz \
-o /tmp/validator-v1.6.0-linux-386.tar.gz -s -L && \
tar -xvf /tmp/validator-v1.6.0-linux-386.tar.gz -C /tmp && \
mv /tmp/validator /usr/local/bin && \
rm -rf /tmp/* && \
chmod 0755 /usr/local/bin/validator && \
chmod 0755 /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
ENTRYPOINT ["/entrypoint.sh"]
35 changes: 26 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

* Apple PList XML
* CSV
* ENV
* HCL
* HOCON
* INI
* JSON
* Properties
Expand All @@ -13,6 +15,7 @@
* YAML



Each file will get validated for the correct syntax and the results collected into a report showing the path of the file and if it is invalid or valid. If the file is invalid an error will be displayed along with the line number and column where the error ocurred. By default the `$GITHUB_WORKDIR` is scanned.

![Standard Run](./img/standard_run.png)
Expand All @@ -21,11 +24,12 @@ Each file will get validated for the correct syntax and the results collected in

| Input | Required | Default Value | Description |
| ------------------ | -------- | ------------- | ----------- |
| search-paths | false | `"."` | The path that will be recursively searched for configuration files |
| search-paths | false | `"."` | The path that will be recursively searched for configuration files |
| exclude-dirs | false | `""` | A comma-separated list of subdirectories to exclude from validation |
| exclude-file-types | false | `""` | A comma-separated list of file extensions to exclude. Possible values are `xml`, `ini`, `yaml`, `yml`, `toml`, and `json` |
| depth | false | `""` | An integer value limiting the depth of recursion for the search paths. For example, setting depth to 0 would disable recursion |
| reporter | false | `"standard"` | Format of the report printed to stdout. Options are `standard` and `json` |
| reporter | false | `"standard"` | Format of the report printed to stdout. Options are `standard` and `json` |
| group-by | false | `""` | Group output by filetype, directory, pass-fail |


## Outputs
Expand All @@ -41,7 +45,7 @@ jobs:
validate-config-files:
runs-on: ubuntu-latest
steps:
- uses: kehoe/validate-configs-action@v1
- uses: kehoe/validate-configs-action@v3
```
### Custom search path
Expand All @@ -51,7 +55,7 @@ jobs:
validate-config-files:
runs-on: ubuntu-latest
steps:
- uses: kehoe/validate-configs-action@v1
- uses: kehoe/validate-configs-action@v3
with:
search-path: ./project/configs
```
Expand All @@ -63,7 +67,7 @@ jobs:
validate-config-files:
runs-on: ubuntu-latest
steps:
- uses: kehoe/validate-configs-action@v1
- uses: kehoe/validate-configs-action@v3
with:
search-path: ./project/configs ./project/devops
```
Expand All @@ -75,7 +79,7 @@ jobs:
validate-config-files:
runs-on: ubuntu-latest
steps:
- uses: kehoe/validate-configs-action@v1
- uses: kehoe/validate-configs-action@v3
with:
exclude-dirs: "tests,vendor"
```
Expand All @@ -87,7 +91,7 @@ jobs:
validate-config-files:
runs-on: ubuntu-latest
steps:
- uses: kehoe/validate-configs-action@v1
- uses: kehoe/validate-configs-action@v3
with:
exclude-file-types: "json,xml"
```
Expand All @@ -99,7 +103,7 @@ jobs:
validate-config-files:
runs-on: ubuntu-latest
steps:
- uses: kehoe/validate-configs-action@v1
- uses: kehoe/validate-configs-action@v3
with:
depth: 0
```
Expand All @@ -111,7 +115,20 @@ jobs:
validate-config-files:
runs-on: ubuntu-latest
steps:
- uses: kehoe/validate-configs-action@v1
- uses: kehoe/validate-configs-action@v3
with:
reporter: "json"
```
### Group By Pass/Fail
```yml
jobs:
validate-config-files:
runs-on: ubuntu-latest
steps:
- uses: kehoe/validate-configs-action@v3
with:
reporter: "json"
```
5 changes: 5 additions & 0 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ inputs:
description: 'Format of the printed report. Options are standard and json (default "standard")'
required: false
default: "standard"
group-by:
description: A comman separated list of how to group the output. Options are file type, directory, or pass-fail.
required: false
default: ""

runs:
using: 'docker'
Expand All @@ -34,6 +38,7 @@ runs:
- ${{ inputs.exclude-file-types }}
- ${{ inputs.depth }}
- ${{ inputs.reporter }}
- ${{ inputs.group-by }}

branding:
color: 'blue'
Expand Down
33 changes: 32 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,35 @@
set -e

SEARCH_PATHS=$1
validator --exclude-dirs=$2 --exclude-file-types=$3 --depth=$4 --reporter=$5 ${SEARCH_PATHS}
EXCLUDE_DIRS=$2
EXCLUDE_FILE_TYPES=$3
DEPTH=$4
REPORTER=$5
GROUP_BY=$6

CMD=validator

if [ -n "$EXCLUDE_DIRS" ]; then
CMD="$CMD --exclude-dirs=$EXCLUDE_DIRS"
fi

if [ -n "$EXCLUDE_FILE_TYPES" ]; then
CMD="$CMD --exclude-file-types=$EXCLUDE_FILE_TYPES"
fi

if [ -n "$DEPTH" ]; then
CMD="$CMD --depth=$DEPTH"
fi

if [ -n "$REPORTER" ]; then
CMD="$CMD --reporter=$REPORTER"
fi

if [ -n "$GROUP_BY" ]; then
CMD="$CMD --group-by=$GROUP_BY"
fi

# add search paths
CMD="$CMD $SEARCH_PATHS"

( ${CMD} )

0 comments on commit 765e568

Please sign in to comment.