5
0
Fork 0
mirror of https://github.com/wagoid/commitlint-github-action.git synced 2025-11-07 08:06:54 +00:00

Merge pull request #16 from wagoid/fix/add-plugin-with-jira-rules

fix: errors not showing when PR has only one commit
This commit is contained in:
Wagner Santos 2019-11-24 09:24:54 -03:00 committed by GitHub
commit 6546e18362
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View file

@ -9,7 +9,7 @@ jobs:
steps:
- uses: actions/checkout@v1
- run: sed -i -E "s/([']docker:.+)/Dockerfile/" ./action.yml
- run: echo -n "" > .dockerignore
- run: echo -n '' > .dockerignore
- uses: ./
commitlint-with-yml-file:
runs-on: ubuntu-latest

10
run.js
View file

@ -18,7 +18,11 @@ const configPath = resolve(
const { context: eventContext } = github
const gitEmptySha = '0000000000000000000000000000000000000000'
const pushEventHasOnlyOneCommit = from => {
const gitEmptySha = '0000000000000000000000000000000000000000'
return from === gitEmptySha
}
const getRangeForPushEvent = () => {
let from = eventContext.payload.before
@ -32,7 +36,7 @@ const getRangeForPushEvent = () => {
from = null
}
if (from === gitEmptySha) {
if (pushEventHasOnlyOneCommit(from)) {
from = null
}
@ -58,7 +62,7 @@ const getRangeForEvent = async () => {
function getHistoryCommits(from, to) {
const options = {
from,
from: from && `${from}^1`,
to,
}