diff --git a/.dockerignore b/.dockerignore index 023ebc0..aa41a89 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,6 +1,7 @@ # ignore all files by default * # include required files with an exception +!cfn-lint.json !entrypoint.sh !LICENSE !README.md diff --git a/Dockerfile b/Dockerfile index c94e3be..d3aa86b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,6 +15,7 @@ LABEL "maintainer"="Scott Brenner " RUN apk --no-cache add python3 RUN pip3 install cfn-lint +COPY cfn-lint.json /cfn-lint.json COPY entrypoint.sh /entrypoint.sh RUN ["chmod", "+x", "/entrypoint.sh"] ENTRYPOINT ["/entrypoint.sh"] diff --git a/README.md b/README.md index 3ed096c..003c065 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ This Action for [CloudFormation Linter](https://github.com/aws-cloudformation/cfn-python-lint/) enables arbitrary actions for interacting with CloudFormation Linter to validate CloudFormation yaml/json templates against the CloudFormation spec and additional checks. Includes checking valid values for resource properties and best practices. +![screenshot](screenshot.png) + ## Usage An example workflow for testing CloudFormation templates for correct properties and their values - run the `cfn-lint` command with the path to the files you want to test as `args`. diff --git a/cfn-lint.json b/cfn-lint.json new file mode 100644 index 0000000..83c87e6 --- /dev/null +++ b/cfn-lint.json @@ -0,0 +1,20 @@ +{ + "problemMatcher": [ + { + "owner": "cfn-lint", + "pattern": [ + { + "regexp": "^([EWI](\\d{4}))\\s(.+)$", + "code": 1, + "message": 3 + }, + { + "regexp": "^(\\S+):(\\d+):(\\d+)$", + "file": 1, + "line": 2, + "column": 3 + } + ] + } + ] +} \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh index 4a014f8..2a5d0df 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -2,4 +2,8 @@ set -e +# Copy the matcher to the host system; otherwise "add-matcher" can't find it. +cp /cfn-lint.json /github/workflow/cfn-lint.json +echo "::add-matcher::${RUNNER_TEMP}/_github_workflow/cfn-lint.json" + sh -c "cfn-lint $*" diff --git a/screenshot.png b/screenshot.png new file mode 100644 index 0000000..e7f727a Binary files /dev/null and b/screenshot.png differ