Skip to content

Commit

Permalink
feat: Problem Matchers (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
NickLiffen authored Apr 20, 2021
1 parent feed1a9 commit 3e2d72a
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 6 deletions.
Binary file added .github/cfn-lint-pull-request.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions .github/cfn-lint.json
Original file line number Diff line number Diff line change
@@ -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
}
]
}
]
}
3 changes: 2 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ on:
push:
branches:
- main
- ft/2.0.0
- feature/**
- bug/**
pull_request:
jobs:
unit:
Expand Down
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
npm run all
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.1.0](https://github.com/ScottBrenner/cfn-lint-action/releases/tag/v2.1.0)

### Added

- Cloud FormationLinter [Problem Matchers](https://github.com/actions/toolkit/blob/main/docs/problem-matchers.md).
- Pre-Commit Hook for running `npm run all` to ensure the software is automatically re-built on changes.

### Changed

- Metadata cleanup within `package.json` to better align with software.

## [2.0.1](https://github.com/ScottBrenner/cfn-lint-action/releases/tag/v2.0.1)

### Changed
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ This Action for [CloudFormation Linter](https://github.com/aws-cloudformation/cf

The Action's primary purpose is to set the [CloudFormation Linter](https://github.com/aws-cloudformation/cfn-python-lint/) to the runner's $PATH so you can access the linter throughout the workflow, and use in a way that suits your application. There is a way to run a [CloudFormation Linter](https://github.com/aws-cloudformation/cfn-python-lint/) command in this workflow though if you like.

On a pull request, once this GitHub Action is set-up, it may look something like this:

![Output of Cloud Formation Linter](.github/cfn-lint-pull-request.png?raw=true "Output of Cloud Formation Linter")

## Usage

There are multiple ways to consume this GitHub Action.
Expand Down
4 changes: 2 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: "Setup AWS CFN LINT"
description: "Setup AWS CFN LINT and add it to the PATH"
name: "cfn-lint-action"
description: "Setup Amazon CloudFormation Linter (cfn-lint)"
branding:
icon: "terminal"
color: "orange"
Expand Down
3 changes: 3 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@ module.exports =
/***/ ((__unused_webpack_module, __unused_webpack_exports, __nccwpck_require__) => {

const core = __nccwpck_require__(186);
const path = __nccwpck_require__(622);

const setup = __nccwpck_require__(391);

(async () => {
try {
await setup();
const matchersPath = path.join(__dirname, "..", ".github");
core.info(`##[add-matcher]${path.join(matchersPath, "cfn-lint.json")}`);
} catch (error) {
core.setFailed(error.message);
}
Expand Down
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
const core = require("@actions/core");
const path = require("path");

const setup = require("./lib/setup");

(async () => {
try {
await setup();
const matchersPath = path.join(__dirname, "..", ".github");
core.info(`##[add-matcher]${path.join(matchersPath, "cfn-lint.json")}`);
} catch (error) {
core.setFailed(error.message);
}
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "setup-cfn-lint",
"version": "0.1.0",
"name": "cfn-lint-action",
"version": "2.1.0",
"private": true,
"description": "Action to setup CloudFormation to the the PATH",
"main": "index.js",
Expand All @@ -11,7 +11,7 @@
"all": "npm run format && npm test && npm run build",
"prepare": "husky install"
},
"license": "Apache-2.0",
"license": "MIT License",
"dependencies": {
"@actions/core": "^1.2.6",
"@actions/exec": "^1.0.4",
Expand Down

0 comments on commit 3e2d72a

Please sign in to comment.