Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement gherkin linter in GH action #754

Merged
merged 5 commits into from
Oct 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .distignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ tests
.distignore
.editorconfig
.eslintrc.js
.gherkin-lintignore
.gherkin-lintrc
.gitattributes
.gitignore
.nvmrc
Expand Down
2 changes: 2 additions & 0 deletions .gherkin-lintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/**
vendor/**
32 changes: 32 additions & 0 deletions .gherkin-lintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"file-name": [
"on",
{
"style": "kebab-case"
}
],
"indentation": [
"on",
{
"Feature": 0,
"Background": 2,
"Scenario": 2,
"Examples": 4,
"Step": 4,
"given": 4,
"example": 6,
"and": 4
}
],
"no-dupe-feature-names": "on",
"no-dupe-scenario-names": "off",
"no-empty-file": "on",
"no-files-without-scenarios": "on",
"no-multiple-empty-lines": "on",
"no-partially-commented-tag-lines": "on",
"no-trailing-spaces": "on",
"no-unnamed-features": "on",
"no-unnamed-scenarios": "on",
"no-scenario-outlines-without-examples": "on",
"use-and": "on"
}
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

/.editorconfig export-ignore
/.eslintrc.js export-ignore
/.gherkin-lintignore export-ignore
/.gherkin-lintrc export-ignore
/.nvmrc export-ignore
/.wp-env.json export-ignore
/composer.lock export-ignore
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/gherkin-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Gherkin Linting

on:
push:
branches:
- trunk
- 'release/**'
# Only run if feature files are changed.
paths:
- '.github/workflows/gherkin-lint.yml'
ernilambar marked this conversation as resolved.
Show resolved Hide resolved
- 'package-lock.json'
- '**.feature'
pull_request:
branches:
- trunk
- 'release/**'
- 'feature/**'
# Only run if feature files are changed.
paths:
- '.github/workflows/gherkin-lint.yml'
- 'package-lock.json'
- '**.feature'
types:
- opened
- reopened
- synchronize

jobs:
gherkin-lint:
name: Lint Gherkin Feature files
runs-on: ubuntu-latest
steps:
- name: Check out source code
uses: actions/checkout@v4

- name: Setup node
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: npm

- name: Install dependencies
run: npm ci

- name: Gherkin lint
run: npm run lint-gherkin
Loading