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

Merge pull request #58 from ylemkimon/workflow-command

fix: do not run workflow commands in commit messages
This commit is contained in:
Wagner Santos 2020-11-11 14:29:42 -03:00 committed by GitHub
commit 7ca5f3fc26
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 4 deletions

19
package-lock.json generated
View file

@ -12417,6 +12417,11 @@
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/temp-dir/-/temp-dir-1.0.0.tgz", "resolved": "https://registry.npmjs.org/temp-dir/-/temp-dir-1.0.0.tgz",
"integrity": "sha1-CnwOom06Oa+n4OvqnB/AvE2qAR0=" "integrity": "sha1-CnwOom06Oa+n4OvqnB/AvE2qAR0="
},
"uuid": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A=="
} }
} }
}, },
@ -12428,6 +12433,14 @@
"requires": { "requires": {
"temp-dir": "^2.0.0", "temp-dir": "^2.0.0",
"uuid": "^3.3.2" "uuid": "^3.3.2"
},
"dependencies": {
"uuid": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
"dev": true
}
} }
}, },
"test-exclude": { "test-exclude": {
@ -12840,9 +12853,9 @@
} }
}, },
"uuid": { "uuid": {
"version": "3.4.0", "version": "8.3.1",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.1.tgz",
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" "integrity": "sha512-FOmRr+FmWEIG8uhZv6C2bTgEVXsHk08kE7mPlrBbEe+c3r9pjceVPgupIfNIhc4yx55H69OXANrUaSuu9eInKg=="
}, },
"validate-npm-package-license": { "validate-npm-package-license": {
"version": "3.0.4", "version": "3.0.4",

View file

@ -30,7 +30,8 @@
"conventional-changelog-lint-config-canonical": "^1.0.0", "conventional-changelog-lint-config-canonical": "^1.0.0",
"dargs": "^7.0.0", "dargs": "^7.0.0",
"execa": "^4.0.3", "execa": "^4.0.3",
"lerna": "^3.22.1" "lerna": "^3.22.1",
"uuid": "^8.3.1"
}, },
"devDependencies": { "devDependencies": {
"@commitlint/test": "^9.0.1", "@commitlint/test": "^9.0.1",

View file

@ -1,5 +1,6 @@
const { existsSync } = require('fs') const { existsSync } = require('fs')
const { resolve } = require('path') const { resolve } = require('path')
const { v4: uuidv4 } = require('uuid')
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
@ -135,6 +136,10 @@ const showLintResults = async ([from, to]) => {
generateOutputs(lintedCommits) generateOutputs(lintedCommits)
// disable workflow commands
const token = uuidv4()
console.log(`::stop-commands::${token}`)
if (hasOnlyWarnings(lintedCommits)) { if (hasOnlyWarnings(lintedCommits)) {
handleOnlyWarnings(formattedResults) handleOnlyWarnings(formattedResults)
} else if (formattedResults) { } else if (formattedResults) {
@ -142,6 +147,9 @@ const showLintResults = async ([from, to]) => {
} else { } else {
console.log('Lint free! 🎉') console.log('Lint free! 🎉')
} }
// enable workflow commands
console.log(`::${token}::`)
} }
const exitWithMessage = message => error => { const exitWithMessage = message => error => {