mirror of
https://github.com/wagoid/commitlint-github-action.git
synced 2025-11-08 00:16:56 +00:00
chore: test raw commit error
This commit is contained in:
parent
4fbd5beb47
commit
f7d64b97e4
2 changed files with 7 additions and 1 deletions
4
.github/workflows/commitlint.yml
vendored
4
.github/workflows/commitlint.yml
vendored
|
|
@ -1,5 +1,7 @@
|
||||||
name: Commitlint
|
name: Commitlint
|
||||||
on: [push, pull_request]
|
on:
|
||||||
|
pull_request_target:
|
||||||
|
branches: main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
commitlint:
|
commitlint:
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
const { existsSync } = require('fs')
|
const { existsSync } = require('fs')
|
||||||
const { resolve } = require('path')
|
const { resolve } = require('path')
|
||||||
|
const { inspect } = require('util')
|
||||||
const core = require('@actions/core')
|
const core = require('@actions/core')
|
||||||
const github = require('@actions/github')
|
const github = require('@actions/github')
|
||||||
const lint = require('@commitlint/lint').default
|
const lint = require('@commitlint/lint').default
|
||||||
|
|
@ -25,6 +26,8 @@ const pushEventHasOnlyOneCommit = (from) => {
|
||||||
return from === gitEmptySha
|
return from === gitEmptySha
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(inspect(eventContext))
|
||||||
|
|
||||||
const getRangeForPushEvent = () => {
|
const getRangeForPushEvent = () => {
|
||||||
let from = eventContext.payload.before
|
let from = eventContext.payload.before
|
||||||
const to = GITHUB_SHA
|
const to = GITHUB_SHA
|
||||||
|
|
@ -125,6 +128,7 @@ const showLintResults = async ([from, to]) => {
|
||||||
? await load({}, { file: configPath })
|
? await load({}, { file: configPath })
|
||||||
: await load({ extends: ['@commitlint/config-conventional'] })
|
: await load({ extends: ['@commitlint/config-conventional'] })
|
||||||
const opts = getOptsFromConfig(config)
|
const opts = getOptsFromConfig(config)
|
||||||
|
console.log(inspect(commits))
|
||||||
const lintedCommits = await Promise.all(
|
const lintedCommits = await Promise.all(
|
||||||
commits.map(async (commit) => ({
|
commits.map(async (commit) => ({
|
||||||
lintResult: await lint(commit.message, config.rules, opts),
|
lintResult: await lint(commit.message, config.rules, opts),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue