Skip to content

Commit

Permalink
Add pre-commit support (#84)
Browse files Browse the repository at this point in the history
* Remove husky

* Fix markdownlint errors

* Bump zricethezav/gitleaks from 8.8.9 to 8.8.11

* Add CodeQL GHA

* Bump version to 1.1.0
  • Loading branch information
fabasoad authored Jul 1, 2022
1 parent 7757ef4 commit c3a27ed
Show file tree
Hide file tree
Showing 15 changed files with 102 additions and 70 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@
"require-jsdoc": "off",
"semi": "off"
}
}
}
27 changes: 17 additions & 10 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,32 @@ assignees: fabasoad

---

**Describe the bug**
#### Describe the bug

A clear and concise description of what the bug is.

**Steps to Reproduce**
#### Steps to Reproduce

1. Run '...'
2. See error
1. See error

#### Expected behavior

**Expected behavior**
A clear and concise description of what you expected to happen.

**Actual behavior**
#### Actual behavior

A clear and concise description of what is happening now.

**Screenshots**
#### Screenshots

If applicable, add screenshots to help explain your problem.

**Technical information (please complete the following information):**
- OS: [e.g. Windows 10 Enterprise v.1909 (OS Build 18363.720)]
- `setup-mint-action` version [e.g. 1.0.1]
#### Technical information (please complete the following information)

- OS: [e.g. Windows 10 Enterprise v.1909 (OS Build 18363.720)]
- `setup-mint-action` version [e.g. 1.0.1]

#### Additional context

**Additional context**
Add any other context about the problem here.
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ Please check the type of change your PR introduces:
## Other information

<!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. -->
<!-- This document was adapted from the open-source [appium/appium](https://github.com/appium/appium/blob/master/.github/PULL_REQUEST_TEMPLATE.md) repository. -->
<!-- This document was adapted from the open-source [appium/appium](https://github.com/appium/appium/blob/master/.github/PULL_REQUEST_TEMPLATE.md) repository. -->
10 changes: 0 additions & 10 deletions .github/workflows/security-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,6 @@ on:
- 'feature-*'

jobs:
snyk_tests:
name: Snyk
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
- uses: snyk/actions/node@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_API_TOKEN }}
codeql_tests:
name: CodeQL
runs-on: ubuntu-latest
Expand Down
20 changes: 0 additions & 20 deletions .github/workflows/yaml-lint.yml

This file was deleted.

1 change: 0 additions & 1 deletion .husky/.gitignore

This file was deleted.

4 changes: 0 additions & 4 deletions .husky/commit-msg

This file was deleted.

8 changes: 0 additions & 8 deletions .husky/pre-commit

This file was deleted.

5 changes: 0 additions & 5 deletions .husky/pre-push

This file was deleted.

4 changes: 0 additions & 4 deletions .husky/prepare-commit-msg

This file was deleted.

2 changes: 1 addition & 1 deletion .nycrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
"statements": 100,
"extension": ["js"],
"reporter": ["lcov","text","text-summary"]
}
}
78 changes: 78 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
---
default_stages: ["commit"]
exclude: ^(.gitleaks\.toml|dist/.*\.js|coverage/.*)$
repos:
- repo: local
hooks:
- id: pre-commit-autoupdate
name: pre-commit-autoupdate
entry: pre-commit autoupdate
language: system
pass_filenames: false
verbose: true
stages: ["push"]
- id: build
name: Build
entry: yarn run build
language: system
pass_filenames: false
verbose: true
- id: test
name: Unit tests
entry: yarn test
language: system
pass_filenames: false
verbose: true
stages: ["push"]
# Security
- repo: https://github.com/Yelp/detect-secrets
rev: v1.2.0
hooks:
- id: detect-secrets
stages: ["commit", "push"]
- repo: https://github.com/zricethezav/gitleaks
rev: v8.8.11
hooks:
- id: gitleaks
stages: ["commit", "push"]
- repo: https://github.com/fabasoad/pre-commit-snyk
rev: v0.0.12
hooks:
- id: snyk-test
stages: ["push"]
# TypeScript
- repo: https://github.com/pre-commit/mirrors-eslint
rev: v8.18.0
hooks:
- id: eslint
args: ['--fix']
files: \.[jt]sx?$
types: [file]
exclude: ^dist/.*\.js$
# Markdown
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.31.1
hooks:
- id: markdownlint
# Yaml
- repo: https://github.com/adrienverge/yamllint
rev: v1.26.3
hooks:
- id: yamllint
args: ["-c", ".yamllint.yml"]
# Other
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: check-merge-conflict
- id: check-json
- id: detect-private-key
stages: ["commit", "push"]
- id: end-of-file-fixer
- id: mixed-line-ending
args: ["--fix=lf"]
- id: no-commit-to-branch
- id: trailing-whitespace
ci:
autofix_prs: false
skip: [build, eslint, test]
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@
"yamllint"
],
"editor.rulers": [ 80 ]
}
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Setup Mint

![GitHub release](https://img.shields.io/github/v/release/fabasoad/setup-mint-action?include_prereleases) ![Unit Tests](https://github.com/fabasoad/setup-mint-action/workflows/Unit%20Tests/badge.svg) ![Functional Tests](https://github.com/fabasoad/setup-mint-action/workflows/Functional%20Tests/badge.svg) ![YAML Lint](https://github.com/fabasoad/setup-mint-action/workflows/YAML%20Lint/badge.svg) ![Security Tests](https://github.com/fabasoad/setup-mint-action/workflows/Security%20Tests/badge.svg) [![Total alerts](https://img.shields.io/lgtm/alerts/g/fabasoad/setup-mint-action.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/fabasoad/setup-mint-action/alerts/) [![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/fabasoad/setup-mint-action.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/fabasoad/setup-mint-action/context:javascript) [![Maintainability](https://api.codeclimate.com/v1/badges/e259e98506d3691ab916/maintainability)](https://codeclimate.com/github/fabasoad/setup-mint-action/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/e259e98506d3691ab916/test_coverage)](https://codeclimate.com/github/fabasoad/setup-mint-action/test_coverage) [![Known Vulnerabilities](https://snyk.io/test/github/fabasoad/setup-mint-action/badge.svg?targetFile=package.json)](https://snyk.io/test/github/fabasoad/setup-mint-action?targetFile=package.json)
![GitHub release](https://img.shields.io/github/v/release/fabasoad/setup-mint-action?include_prereleases) ![Unit Tests](https://github.com/fabasoad/setup-mint-action/workflows/Unit%20Tests/badge.svg) ![Functional Tests](https://github.com/fabasoad/setup-mint-action/workflows/Functional%20Tests/badge.svg) ![Security Tests](https://github.com/fabasoad/setup-mint-action/workflows/Security%20Tests/badge.svg) [![pre-commit.ci status](https://results.pre-commit.ci/badge/github/fabasoad/setup-mint-action/main.svg)](https://results.pre-commit.ci/latest/github/fabasoad/setup-mint-action/main) [![Total alerts](https://img.shields.io/lgtm/alerts/g/fabasoad/setup-mint-action.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/fabasoad/setup-mint-action/alerts/) [![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/fabasoad/setup-mint-action.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/fabasoad/setup-mint-action/context:javascript) [![Maintainability](https://api.codeclimate.com/v1/badges/e259e98506d3691ab916/maintainability)](https://codeclimate.com/github/fabasoad/setup-mint-action/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/e259e98506d3691ab916/test_coverage)](https://codeclimate.com/github/fabasoad/setup-mint-action/test_coverage) [![Known Vulnerabilities](https://snyk.io/test/github/fabasoad/setup-mint-action/badge.svg)](https://snyk.io/test/github/fabasoad/setup-mint-action)

This action sets up a [Mint](https://www.mint-lang.com/) programming language.

Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "setup-mint-action",
"version": "1.0.18",
"version": "1.1.0",
"description": "This action sets up a Mint programming language.",
"main": "dist/index.js",
"scripts": {
"build": "ncc build -m src/index.js",
"lint:md": "markdownlint --config .markdownlint.yml '**/*.md'",
"lint:es": "eslint src __tests__",
"lint": "yarn run lint:md && yarn run lint:es",
"postinstall": "yarn husky install",
"postinstall": "pre-commit install --hook-type pre-commit && pre-commit install --hook-type pre-push",
"test": "nyc mocha __tests__"
},
"repository": {
Expand Down Expand Up @@ -39,7 +39,6 @@
"eslint": "8.18.0",
"eslint-config-google": "0.14.0",
"git-branch-is": "4.0.0",
"husky": "8.0.1",
"markdownlint-cli": "0.31.1",
"mocha": "10.0.0",
"mocha-param": "2.0.1",
Expand Down

0 comments on commit c3a27ed

Please sign in to comment.