forked from fwdcloudsec/known_aws_accounts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Github workflow to validate YAML schema
This will allow us to ensure the YAML is well formatted in PRs. Note, we would like to make `source` a required field, but the YAML file currently fails this requirement. NOTE: The github workflow currently warns about `Unexpected input(s) 'yaml-file-dir'. This is happening because of a bug that doesn't affect the output. See: lyubick/action-YAML-schema-validator#8
- Loading branch information
1 parent
dc9626a
commit 24f4e54
Showing
2 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
validate: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Check schema | ||
uses: lyubick/action-YAML-schema-validator@v2 | ||
with: | ||
json-schema-file: schema.json | ||
yaml-file-dir: accounts.yaml | ||
recursive: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"type": "array", | ||
"items": { | ||
"type": "object", | ||
"properties": { | ||
"name": { | ||
"type": "string" | ||
}, | ||
"source": { | ||
"anyOf": [ | ||
{ "type": "string" }, | ||
{ | ||
"type": "array", | ||
"items": { "type": "string" }, | ||
"uniqueItems": true | ||
} | ||
] | ||
}, | ||
"accounts": { | ||
"type": "array", | ||
"items": { "type": "string", "minLength": 12, "maxLength": 12 }, | ||
"uniqueItems": true | ||
}, | ||
"type": { | ||
"enum": ["aws"] | ||
} | ||
}, | ||
"required": ["name", "accounts"], | ||
"additionalProperties": false | ||
} | ||
} |