diff --git a/README.md b/README.md
index d7a96e6..a2d2b19 100644
--- a/README.md
+++ b/README.md
@@ -34,19 +34,20 @@ You can access VSCode Conventional Commits in two ways:
### Extension Configuration
-| name | description | default |
-| :----------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :-----: |
-| `conventionalCommits.autoCommit` | Control whether the extension should commit files after: forming the message or closing the editor tab.
When `#git.enableSmartCommit#` enabled and `#git.smartCommitChanges#` was set to `all`, It allows to commit all changes when there are no staged changes.
And set `#git.postCommitCommand#` to `sync` to run `git.sync` after commit. | true |
-| `conventionalCommits.emojiFormat` | Specify which format will be shown in the `gitmoji`. | code |
-| `conventionalCommits.gitmoji` | Control whether the extension should prompt for a `gitmoji`. | true |
-| `conventionalCommits.lineBreak` | Specify which word will be treated as line breaks in the `body`.
Blank means no line breaks. | "" |
-| `conventionalCommits.promptBody` | Control whether the extension should prompt for the `body` section. | true |
-| `conventionalCommits.promptFooter` | Control whether the extension should prompt for the `footer` section. | true |
-| `conventionalCommits.promptScopes` | Control whether the extension should prompt for the `scope` section. | true |
-| `conventionalCommits.scopes` | Specify available selections in the `scope` section. | [] |
-| `conventionalCommits.showEditor` | Control whether the extension should show the commit message as a text document in a separate tab. | false |
-| `conventionalCommits.showNewVersionNotes` | Control whether the extension should show the new version notes. | true |
-| `conventionalCommits.editor.keepAfterSave` | Control whether the extension should keep the editor tab open after saving the commit message. | false |
+| name | description | default |
+| :----------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :------ |
+| `conventionalCommits.autoCommit` | Control whether the extension should commit files after: forming the message or closing the editor tab.
When `#git.enableSmartCommit#` enabled and `#git.smartCommitChanges#` was set to `all`, It allows to commit all changes when there are no staged changes.
And set `#git.postCommitCommand#` to `sync` to run `git.sync` after commit. | true |
+| `conventionalCommits.emojiFormat` | Specify which format will be shown in the `gitmoji`. | code |
+| `conventionalCommits.gitmoji` | Control whether the extension should prompt for a `gitmoji`. | true |
+| `conventionalCommits.lineBreak` | Specify which word will be treated as line breaks in the `body`.
Blank means no line breaks. | "" |
+| `conventionalCommits.promptBody` | Control whether the extension should prompt for the `body` section. | true |
+| `conventionalCommits.promptFooter` | Control whether the extension should prompt for the `footer` section. | true |
+| `conventionalCommits.promptCI` | Control whether the extension should prompt for skipping CI run. | false |
+| `conventionalCommits.promptScopes` | Control whether the extension should prompt for the `scope` section. | true |
+| `conventionalCommits.scopes` | Specify available selections in the `scope` section. | [] |
+| `conventionalCommits.showEditor` | Control whether the extension should show the commit message as a text document in a separate tab. | false |
+| `conventionalCommits.showNewVersionNotes` | Control whether the extension should show the new version notes. | true |
+| `conventionalCommits.editor.keepAfterSave` | Control whether the extension should keep the editor tab open after saving the commit message. | false |
## Commit Workflow
@@ -156,7 +157,8 @@ Or `\\n` in JSON format.
## Financial Contributors
-Become a financial contributor and help us sustain our community. [[Contribute](https://opencollective.com/vscode-conventional-commits/contribute)]
+Become a financial contributor and help us sustain our community.
+[[Contribute](https://opencollective.com/vscode-conventional-commits/contribute)]
### Individuals
@@ -164,7 +166,9 @@ Become a financial contributor and help us sustain our community. [[Contribute](
### Organizations
-Support this project with your organization. Your logo will show up here with a link to your website. [[Contribute](https://opencollective.com/vscode-conventional-commits/contribute)]
+Support this project with your organization. Your logo will show up here with a
+link to your website.
+[[Contribute](https://opencollective.com/vscode-conventional-commits/contribute)]
diff --git a/package.json b/package.json
index f687dbc..c8391fe 100644
--- a/package.json
+++ b/package.json
@@ -101,6 +101,11 @@
"default": true,
"markdownDescription": "%extension.configuration.promptBody.markdownDescription%"
},
+ "conventionalCommits.promptCI": {
+ "type": "boolean",
+ "default": false,
+ "markdownDescription": "%extension.configuration.promptCI.markdownDescription%"
+ },
"conventionalCommits.promptFooter": {
"type": "boolean",
"default": true,
diff --git a/package.nls.json b/package.nls.json
index 12d1e90..53da7f1 100644
--- a/package.nls.json
+++ b/package.nls.json
@@ -11,6 +11,7 @@
"extension.configuration.promptBody.markdownDescription": "Control whether the extension should prompt for the `body` section.",
"extension.configuration.promptFooter.markdownDescription": "Control whether the extension should prompt for the `footer` section.",
"extension.configuration.promptScopes.markdownDescription": "Control whether the extension should prompt for the `scope` section.",
+ "extension.configuration.promptCI.markdownDescription": "Control whether the extension should prompt for skipping CI run.",
"extension.configuration.scopes.markdownDescription": "Specify available selections in the `scope` section.",
"extension.configuration.showEditor.markdownDescription": "Control whether the extension should show the commit message as a text document in a separate tab.",
"extension.configuration.showNewVersionNotes.markdownDescription": "Control whether the extension should show the new version notes.",
@@ -34,6 +35,11 @@
"extension.sources.prompt.gitmoji.noneItem.label": "None",
"extension.sources.prompt.gitmoji.noneItem.detail": "No gitmoji.",
"extension.sources.prompt.subject.placeholder": "Write a short, imperative tense description of the change.",
+ "extension.sources.prompt.ci.accept.label": "Yes",
+ "extension.sources.prompt.ci.decline.label": "No",
+ "extension.sources.prompt.ci.accept.detail": "Avoid running CI worflow.",
+ "extension.sources.prompt.ci.decline.detail": "Run CI workflow if available.",
+ "extension.sources.prompt.ci.placeholder": "Choose do you want to skip CI run.",
"extension.sources.prompt.subject.error.including": "including ",
"extension.sources.prompt.subject.error.type": "type: ",
"extension.sources.prompt.subject.error.scope": "scope: ",
diff --git a/package.nls.zh-cn.json b/package.nls.zh-cn.json
index 6818a66..0f7d3cb 100644
--- a/package.nls.zh-cn.json
+++ b/package.nls.zh-cn.json
@@ -11,6 +11,7 @@
"extension.configuration.promptBody.markdownDescription": "是否需要填写 `body`。",
"extension.configuration.promptFooter.markdownDescription": "是否需要填写 `footer`。",
"extension.configuration.promptScopes.markdownDescription": "是否需要填写 `scope`。",
+ "extension.configuration.promptCI.markdownDescription": "是否需要提示“跳过 CI 工作流”。",
"extension.configuration.scopes.markdownDescription": "指定 `scope` 中的可选项。",
"extension.configuration.showEditor.markdownDescription": "是否需要在新标签页用文本编辑器展示提交信息",
"extension.configuration.showNewVersionNotes.markdownDescription": "是否需要显示新版本说明。",
@@ -34,6 +35,11 @@
"extension.sources.prompt.gitmoji.noneItem.label": "无",
"extension.sources.prompt.gitmoji.noneItem.detail": "无 gitmoji。",
"extension.sources.prompt.subject.placeholder": "请填写描述。",
+ "extension.sources.prompt.ci.accept.label": "是",
+ "extension.sources.prompt.ci.decline.label": "否",
+ "extension.sources.prompt.ci.accept.detail": "跳过 CI 工作流。",
+ "extension.sources.prompt.ci.decline.detail": "如果可用,则执行 CI 工作流。",
+ "extension.sources.prompt.ci.placeholder": "选择是否要跳过 CI 工作流。",
"extension.sources.prompt.subject.error.including": "包括",
"extension.sources.prompt.subject.error.type": "类型:",
"extension.sources.prompt.subject.error.scope": "作用域:",
diff --git a/src/lib/commit-message.ts b/src/lib/commit-message.ts
index ce7f80d..ee0d656 100644
--- a/src/lib/commit-message.ts
+++ b/src/lib/commit-message.ts
@@ -9,6 +9,7 @@ export class CommitMessage {
private _subject: string = '';
private _body: string = '';
private _footer: string = '';
+ private _ci: string = '';
get type() {
return this._type;
@@ -57,6 +58,14 @@ export class CommitMessage {
set footer(input: string) {
this._footer = input.trim();
}
+
+ get ci() {
+ return this._ci;
+ }
+
+ set ci(input: string) {
+ this._ci = input.trim();
+ }
}
export function serializeSubject(partialCommitMessage: {
@@ -78,6 +87,7 @@ export function serializeSubject(partialCommitMessage: {
}
export function serializeHeader(partialCommitMessage: {
+ ci: string;
type: string;
scope: string;
gitmoji: string;
@@ -85,7 +95,7 @@ export function serializeHeader(partialCommitMessage: {
}) {
let result = '';
result += partialCommitMessage.type;
- const { scope } = partialCommitMessage;
+ const { scope, ci } = partialCommitMessage;
if (scope) {
result += `(${scope})`;
}
@@ -94,6 +104,9 @@ export function serializeHeader(partialCommitMessage: {
if (subject) {
result += subject;
}
+ if (ci === 'Yes') {
+ result += ' [skip ci]';
+ }
return result;
}
diff --git a/src/lib/configuration.ts b/src/lib/configuration.ts
index 48cd90f..a4ef81b 100644
--- a/src/lib/configuration.ts
+++ b/src/lib/configuration.ts
@@ -20,6 +20,7 @@ export type Configuration = {
promptScopes: boolean;
promptBody: boolean;
promptFooter: boolean;
+ promptCI: boolean;
showNewVersionNotes: boolean;
'editor.keepAfterSave': boolean;
};
diff --git a/src/lib/conventional-commits.ts b/src/lib/conventional-commits.ts
index 7ec318a..8604dc7 100644
--- a/src/lib/conventional-commits.ts
+++ b/src/lib/conventional-commits.ts
@@ -153,6 +153,7 @@ export default function createConventionalCommits() {
promptScopes: configuration.get('promptScopes'),
promptBody: configuration.get('promptBody'),
promptFooter: configuration.get('promptFooter'),
+ promptCI: configuration.get('promptCI'),
});
output.info(`messageJSON:\n${JSON.stringify(commitMessage, null, 2)}`);
const message = serialize(commitMessage);
diff --git a/src/lib/prompts.ts b/src/lib/prompts.ts
index e11bc60..bde9fae 100644
--- a/src/lib/prompts.ts
+++ b/src/lib/prompts.ts
@@ -38,6 +38,7 @@ export default async function prompts({
promptScopes,
promptBody,
promptFooter,
+ promptCI,
}: {
gitmoji: boolean;
showEditor: boolean;
@@ -46,6 +47,7 @@ export default async function prompts({
promptScopes: boolean;
promptBody: boolean;
promptFooter: boolean;
+ promptCI: boolean;
}): Promise {
const commitMessage = new CommitMessage();
const conventionalCommitsTypes = getTypesByLocale(locale).types;
@@ -170,12 +172,30 @@ export default async function prompts({
alwaysShow: true,
},
},
+ {
+ type: PROMPT_TYPES.QUICK_PICK,
+ name: 'ci',
+ placeholder: getPromptLocalize('ci.placeholder'),
+ items: [
+ {
+ label: getPromptLocalize('ci.accept.label'),
+ description: '',
+ detail: getPromptLocalize('ci.accept.detail'),
+ },
+ ],
+ noneItem: {
+ label: getPromptLocalize('ci.decline.label'),
+ description: '',
+ detail: getPromptLocalize('ci.decline.detail'),
+ alwaysShow: true,
+ },
+ },
{
type: PROMPT_TYPES.INPUT_BOX,
name: 'subject',
placeholder: getPromptLocalize('subject.placeholder'),
validate(input: string) {
- const { type, scope, gitmoji } = commitMessage;
+ const { type, scope, gitmoji, ci } = commitMessage;
const serializedSubject = serializeSubject({
gitmoji,
subject: input,
@@ -198,6 +218,7 @@ export default async function prompts({
scope,
gitmoji,
subject: input,
+ ci,
}),
);
if (headerError) {
@@ -247,6 +268,8 @@ export default async function prompts({
if (question.name === 'gitmoji' && !gitmoji) return false;
+ if (question.name === 'ci' && !promptCI) return false;
+
if (question.name === 'body') {
if (showEditor || !promptBody) return false;
}
@@ -254,6 +277,7 @@ export default async function prompts({
if (question.name === 'footer') {
if (showEditor || !promptFooter) return false;
}
+
return true;
})
.map(function (question, index, array) {