mirror of
https://github.com/wagoid/commitlint-github-action.git
synced 2025-11-07 16:06:56 +00:00
fix: errors not showing when PR has only one commit
This commit is contained in:
parent
526db9a478
commit
8dd0fbf821
2 changed files with 8 additions and 4 deletions
2
.github/workflows/commitlint.yml
vendored
2
.github/workflows/commitlint.yml
vendored
|
|
@ -9,7 +9,7 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
- run: sed -i -E "s/([']docker:.+)/Dockerfile/" ./action.yml
|
- run: sed -i -E "s/([']docker:.+)/Dockerfile/" ./action.yml
|
||||||
- run: echo -n "" > .dockerignore
|
- run: echo -n '' > .dockerignore
|
||||||
- uses: ./
|
- uses: ./
|
||||||
commitlint-with-yml-file:
|
commitlint-with-yml-file:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
|
||||||
8
run.js
8
run.js
|
|
@ -18,8 +18,12 @@ const configPath = resolve(
|
||||||
|
|
||||||
const { context: eventContext } = github
|
const { context: eventContext } = github
|
||||||
|
|
||||||
|
const pushEventHasOnlyOneCommit = from => {
|
||||||
const gitEmptySha = '0000000000000000000000000000000000000000'
|
const gitEmptySha = '0000000000000000000000000000000000000000'
|
||||||
|
|
||||||
|
return from === gitEmptySha
|
||||||
|
}
|
||||||
|
|
||||||
const getRangeForPushEvent = () => {
|
const getRangeForPushEvent = () => {
|
||||||
let from = eventContext.payload.before
|
let from = eventContext.payload.before
|
||||||
const to = GITHUB_SHA
|
const to = GITHUB_SHA
|
||||||
|
|
@ -32,7 +36,7 @@ const getRangeForPushEvent = () => {
|
||||||
from = null
|
from = null
|
||||||
}
|
}
|
||||||
|
|
||||||
if (from === gitEmptySha) {
|
if (pushEventHasOnlyOneCommit(from)) {
|
||||||
from = null
|
from = null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -58,7 +62,7 @@ const getRangeForEvent = async () => {
|
||||||
|
|
||||||
function getHistoryCommits(from, to) {
|
function getHistoryCommits(from, to) {
|
||||||
const options = {
|
const options = {
|
||||||
from,
|
from: from && `${from}^1`,
|
||||||
to,
|
to,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue