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

feat: update dependencies of the project #248

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open
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
5 changes: 3 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
dist/
lib/
node_modules/
dist/
node_modules/
coverage/
61 changes: 42 additions & 19 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,54 @@
{
"plugins": ["jest", "@typescript-eslint"],
"extends": ["plugin:github/recommended"],
"env": {
"node": true,
"es6": true,
"jest": true
},
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"ignorePatterns": [
"!.*",
"**/node_modules/.*",
"**/dist/.*",
"**/coverage/.*",
"*.json"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 9,
"ecmaVersion": 2023,
"sourceType": "module",
"project": "./tsconfig.json"
"project": ["./tsconfig.linter.json", "./tsconfig.json"]
},
"plugins": ["jest", "@typescript-eslint"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:jest/recommended"
],
"rules": {
"camelcase": "off",
"eslint-comments/no-use": "off",
"eslint-comments/no-unused-disable": "off",
"i18n-text/no-en": "off",
"import/no-namespace": "off",
"no-console": "off",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/explicit-member-accessibility": ["error", {"accessibility": "no-public"}],
"@typescript-eslint/no-require-imports": "error",
"semi": "off",
"@typescript-eslint/array-type": "error",
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/ban-ts-comment": "error",
"camelcase": "off",
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/explicit-function-return-type": ["error", {"allowExpressions": true}],
"@typescript-eslint/func-call-spacing": ["error", "never"],
"@typescript-eslint/explicit-member-accessibility": [
"error",
{ "accessibility": "no-public" }
],
"@typescript-eslint/explicit-function-return-type": [
"error",
{ "allowExpressions": true }
],
"@typescript-eslint/no-array-constructor": "error",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-explicit-any": "error",
Expand All @@ -30,8 +58,10 @@
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-namespace": "error",
"@typescript-eslint/no-non-null-assertion": "warn",
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/no-unnecessary-qualifier": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/no-useless-constructor": "error",
"@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/prefer-for-of": "warn",
Expand All @@ -41,14 +71,7 @@
"@typescript-eslint/promise-function-async": "error",
"@typescript-eslint/require-array-sort-compare": "error",
"@typescript-eslint/restrict-plus-operands": "error",
"semi": "off",
"@typescript-eslint/semi": ["error", "never"],
"@typescript-eslint/type-annotation-spacing": "error",
"@typescript-eslint/space-before-function-paren": "off",
"@typescript-eslint/unbound-method": "error"
},
"env": {
"node": true,
"es6": true,
"jest/globals": true
}
}
}
16 changes: 11 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
name: "build"
name: 'build'
on:
push:

jobs:
build: # make sure build/ci work properly
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- run: |
yarn
yarn all
- uses: actions/checkout@v4
- name: Setup Node.js
id: setup-node
uses: actions/setup-node@v4
with:
node-version-file: .node-version
cache: npm
- run: |
yarn
yarn all
18 changes: 12 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "test"
name: 'test'
on:
pull_request:
types: ['opened', 'edited', 'reopened', 'synchronize']
Expand All @@ -7,8 +7,14 @@ jobs:
test: # make sure the action works on a clean machine without building
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- run: |
yarn
yarn build:pack
- uses: ./
- uses: actions/checkout@v4
- name: Setup Node.js
id: setup-node
uses: actions/setup-node@v4
with:
node-version-file: .node-version
cache: npm
- run: |
yarn
yarn bundle
- uses: ./
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
21.6.2
25 changes: 15 additions & 10 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
{
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"semi": false,
"singleQuote": true,
"trailingComma": "none",
"bracketSpacing": false,
"arrowParens": "avoid",
"parser": "typescript"
}
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"semi": false,
"singleQuote": true,
"quoteProps": "as-needed",
"jsxSingleQuote": false,
"trailingComma": "none",
"bracketSpacing": true,
"bracketSameLine": true,
"arrowParens": "avoid",
"proseWrap": "always",
"htmlWhitespaceSensitivity": "css",
"endOfLine": "lf"
}
31 changes: 19 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
# ⚡️ Pull request name linter with commitlint ⚡️

---

[![build](https://github.com/JulienKode/pull-request-name-linter-action/workflows/build/badge.svg)](https://github.com/JulienKode/pull-request-name-linter-action/actions)
[![GitHub issues](https://img.shields.io/github/issues/JulienKode/pull-request-name-linter-action?style=flat-square)](https://github.com/JulienKode/pull-request-name-linter-action/issues)
[![GitHub forks](https://img.shields.io/github/forks/JulienKode/pull-request-name-linter-action?style=flat-square)](https://github.com/JulienKode/pull-request-name-linter-action/network)
[![GitHub stars](https://img.shields.io/github/stars/JulienKode/pull-request-name-linter-action?style=flat-square)](https://github.com/JulienKode/pull-request-name-linter-action/stargazers)
[![GitHub license](https://img.shields.io/github/license/JulienKode/pull-request-name-linter-action?style=flat-square)](https://github.com/JulienKode/pull-request-name-linter-action/blob/master/LICENSE)
[![Watch on GitHub](https://img.shields.io/github/watchers/JulienKode/pull-request-name-linter-action.svg?style=social)](https://github.com/JulienKode/pull-request-name-linter-action/watchers)
[![Tweet](https://img.shields.io/twitter/url/https/github.com/JulienKode/pull-request-name-linter-action.svg?style=social)](https://twitter.com/intent/tweet?text=Checkout%20this%20library%20https%3A%2F%2Fgithub.com%2FJulienKode%2Fpull-request-name-linter-action)

---

**GitHub action** to automatically **lint pull request name** with [**commitlint**](https://commitlint.js.org).
This is useful if squash merge your pull request for example.
**GitHub action** to automatically **lint pull request name** with
[**commitlint**](https://commitlint.js.org). This is useful if squash merge your
pull request for example.

**Note**: If you are looking to lint the commits of your pull request with commitlint you can use [commitlint-github-action](https://github.com/wagoid/commitlint-github-action)
**Note**: If you are looking to lint the commits of your pull request with
commitlint you can use
[commitlint-github-action](https://github.com/wagoid/commitlint-github-action)

This package are using the commitlint 11 version

Expand All @@ -22,7 +28,8 @@ This package are using the commitlint 11 version

### Create `.github/workflows/pr-name.yml`

Create a workflow (eg: `.github/workflows/pr-name.yml` see [Creating a Workflow file](https://help.github.com/en/articles/configuring-a-workflow#creating-a-workflow-file)).
Create a workflow (eg: `.github/workflows/pr-name.yml` see
[Creating a Workflow file](https://help.github.com/en/articles/configuring-a-workflow#creating-a-workflow-file)).
Here is an example of configuration

```yaml
Expand All @@ -35,17 +42,17 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Install Dependencies
run: npm install @commitlint/config-conventional
- uses: JulienKode/[email protected]
- uses: actions/checkout@v1
- name: Install Dependencies
run: npm install @commitlint/config-conventional
- uses: JulienKode/[email protected]
```

**Note**: make sure you install your dependencies that commitlint use
**Note**: make sure you install your dependencies that commitlint use

## Example
## Example

If you want to see an example of usage you can checkout this repository: https://github.com/JulienKode/pull-request-name-linter-action-example
If you want to see an example of usage you can checkout this repository:
https://github.com/JulienKode/pull-request-name-linter-action-example

![image](https://user-images.githubusercontent.com/7658664/80835181-8a7cc280-8bf2-11ea-932b-7a954db6bf60.png)

2 changes: 1 addition & 1 deletion test/linter.test.ts → __tests__/linter.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {lintPullRequest} from '../src/linter'
import { lintPullRequest } from '../src/linter.mts'

test('should lint the title correctly', async () => {
// Given
Expand Down
4 changes: 2 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: 'Pull request linter action'
description: "Lint your pull request name based on commitlint configuration"
description: 'Lint your pull request name based on commitlint configuration'
author: 'Julien Karst'
inputs:
configuration-path:
description: 'The path for the commitlint configurations'
required: false
default: './commitlint.config.js'
runs:
using: 'node12'
using: 'node20'
main: 'dist/index.js'
branding:
icon: 'users'
Expand Down
2 changes: 1 addition & 1 deletion commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = { rules: { "scope-case": [2, "always", "lower-case"] } };
module.exports = { rules: { 'scope-case': [2, 'always', 'lower-case'] } }
4 changes: 2 additions & 2 deletions dist/commit.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{{~/if}}

{{~!-- commit link --}} {{#if @root.linkReferences~}}
([{{hash}}](
([{{shortHash}}](
{{~#if @root.repository}}
{{~#if @root.host}}
{{[email protected]}}/
Expand All @@ -20,7 +20,7 @@
{{~/if}}/
{{[email protected]}}/{{hash}}))
{{~else}}
{{~hash}}
{{~shortHash}}
{{~/if}}

{{~!-- commit references --}}
Expand Down
Loading
Loading