From 8d3a5741ec0c4f109441e151901c9af6e791b680 Mon Sep 17 00:00:00 2001 From: Francesco Calcavecchia Date: Thu, 2 Jun 2022 10:51:08 +0200 Subject: [PATCH] [ci skip] in all pr commit message and title (#1035) * [ci skip] in all pr commit message and title * replace const commitMessage with let commitMessage Co-authored-by: DavidGOrtega * remove ci skip from pr title * add skipCI option in bon/cml/pr.js * cml/src/cml.js prCreate now is able to handle the skipCI option * skip ci also when automerge (or rebase or squash) is false Co-authored-by: DavidGOrtega * fix typo on "boolean" Co-authored-by: Casper da Costa-Luis * Amend skipCI description Co-authored-by: Casper da Costa-Luis * remove redundant spaces Co-authored-by: Casper da Costa-Luis * Add space to make linter happy * update cml pr help snapshot in test Co-authored-by: DavidGOrtega Co-authored-by: Casper da Costa-Luis --- bin/cml/pr.js | 4 ++++ bin/cml/pr.test.js | 1 + src/cml.js | 3 ++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/bin/cml/pr.js b/bin/cml/pr.js index 814841e80..6e71c44e2 100755 --- a/bin/cml/pr.js +++ b/bin/cml/pr.js @@ -19,6 +19,10 @@ exports.builder = (yargs) => type: 'boolean', description: 'Output in markdown format [](url).' }, + skipCI: { + type: 'boolean', + description: 'Force skip CI for the created commit (if any)' + }, merge: { type: 'boolean', alias: 'auto-merge', diff --git a/bin/cml/pr.test.js b/bin/cml/pr.test.js index f185ff2d3..402d3a809 100644 --- a/bin/cml/pr.test.js +++ b/bin/cml/pr.test.js @@ -15,6 +15,7 @@ describe('CML e2e', () => { --log Maximum log level [string] [choices: \\"error\\", \\"warn\\", \\"info\\", \\"debug\\"] [default: \\"info\\"] --md Output in markdown format [](url). [boolean] + --skip-ci Force skip CI for the created commit (if any) [boolean] --merge, --auto-merge Try to merge the pull request upon creation. [boolean] --rebase Try to rebase-merge the pull request upon creation. [boolean] diff --git a/src/cml.js b/src/cml.js index 76f6698f9..f54f222ed 100755 --- a/src/cml.js +++ b/src/cml.js @@ -409,6 +409,7 @@ class CML { remote = GIT_REMOTE, globs = ['dvc.lock', '.gitignore'], md, + skipCI, merge, rebase, squash @@ -464,7 +465,7 @@ class CML { await exec(`git checkout -b ${source}`); await exec(`git add ${paths.join(' ')}`); let commitMessage = `CML PR for ${shaShort}`; - if (!(merge || rebase || squash)) { + if (skipCI || !(merge || rebase || squash)) { commitMessage += ' [skip ci]'; } await exec(`git commit -m "${commitMessage}"`);