JulienKode / pull-request-name-linter-action

⚡️ Lint pull request name with commit lint. This is useful if you squash merge your pull requests ⚡️

Home Page:https://github.com/marketplace/actions/pull-request-linter-action

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Default commitlint.config.js

Decat-SimonA opened this issue · comments

Hello,

I just tried using this github action. I copy pasted this block from the README.md:

name: pr-name-linter
on:
  pull_request:
    types: ['opened', 'edited', 'reopened', 'synchronize']

jobs:
  lint:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1
    - uses: JulienKode/pull-request-name-linter-action@v0.1.0

but it throws:

Run JulienKode/pull-request-name-linter-action@v0.1.0
  with:
    configuration-path: ./commitlint.config.js
##[error]Error: ENOENT: no such file or directory, open '/home/runner/work/masterprice/masterprice/commitlint.config.js'
##[error]ENOENT: no such file or directory, open '/home/runner/work/masterprice/masterprice/commitlint.config.js'

Is it possible to provide a default configuration ?
Otherwise, what's the recommended way to configure it ?

Hi @Decat-SimonA,

We can make an update to provide a default commit lint configuration but the goal is to use one dedicated to your project.
You can create a commitlint.config.js at the root of your project and put your linting commit configuration that will be applied to your pull request name

module.exports = { extends: ["@commitlint/config-conventional"]  };

Let me know if it's solve your issue

I’ve made an example here https://github.com/JulienKode/pull-request-name-linter-action-example

You are free to implement any module that you want as long as you install it in the workflow then you have can access to it:

https://github.com/JulienKode/pull-request-name-linter-action-example/blob/master/.github/workflows/test.yml

name: "test-pull-request-name"
on:
  pull_request:
    types: ['opened', 'edited', 'reopened', 'synchronize']

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - name: Install Dependencies
        run: npm install @commitlint/config-conventional
      - uses: JulienKode/pull-request-name-linter-action@v0.1.2

Would be good to have the install dependencies step as part of the main README, because I missed that and ran into error. Having to do a full install of all the project dependencies for this purpose is wasteful and takes longer that it should.

  • name: Install Dependencies
    run: npm install @commitlint/config-conventional

Would be good to have the install dependencies step as part of the main README, because I missed that and ran into error. Having to do a full install of all the project dependencies for this purpose is wasteful and takes longer that it should.

  • name: Install Dependencies
    run: npm install @commitlint/config-conventional

You're right, but some people will include it in a step where they do the build and install of their project and some people don't

Personally I'm the same as you @mohanraj-r I've use it separately so I only install deps for commitlint

I've made a PR to add this to the readme #37
Thank you @mohanraj-r

if you want to make any other proposal or improvement you can create issues and pull request

That is great! Thanks @JulienKode

@Decat-SimonA

Should we consider this issue solve and create another one for the feature that take the commitlint config as a string ?

@Decat-SimonA does this issue is resolved for you ?

We can close this issue, if you want to take the config as a string, feel free to re-open it