Skip to content

Commit a8518e1

Browse files
author
James Brundage
committed
feat: git commit -SkipCI ( Fixes #320 )
1 parent 90a784e commit a8518e1

File tree

1 file changed

+25
-4
lines changed

1 file changed

+25
-4
lines changed

Extensions/Git.Commit.Input.UGit.Extension.ps1

+25-4
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,14 @@ $CoAuthoredBy,
124124
return $true
125125
})]
126126
[string[]]
127-
$OnBehalfOf
127+
$OnBehalfOf,
128+
129+
# If set, will add `[skip ci]` to the commit message.
130+
# This will usually prevent a CI/CD system from running a build.
131+
# This is supported by GitHub Workflows, Azure DevOps Pipelines, and GitLab (to name a few).
132+
[Alias('CISkip','NoCI','SkipActions','ActionSkip')]
133+
[switch]
134+
$SkipCI
128135
)
129136

130137

@@ -194,15 +201,29 @@ if ($type) # (if -Type was provided)
194201
}
195202
"-m"
196203
# construct a conventional commit message.
197-
"${type}$(if ($scope) { "($scope)" }): $Description$(if ($Fixes) { " ( $fixes )"})"
204+
"${type}$(if ($scope) { "($scope)" }): $Description$(
205+
if ($Fixes) { " ( $fixes )"}
206+
)$(
207+
if ($SkipCI) {
208+
" [skip ci]"
209+
}
210+
)"
198211
}
199212

200213
# If title was provided, pass it as a message
201214
elseif ($Title) {
202215
if ($Fix) {
203-
if ($Title) {"-m";"$title$(if ($Fixes) { " ( $fixes )"})"}
216+
if ($Title) {"-m";"$title$(if ($Fixes) { " ( $fixes )"})$(
217+
if ($SkipCI) {
218+
" [skip ci] "
219+
}
220+
)"}
204221
} else {
205-
if ($Title) {"-m";$title}
222+
if ($Title) {"-m";"$title$(
223+
if ($SkipCI) {
224+
" [skip ci] "
225+
}
226+
)"}
206227
}
207228
}
208229

0 commit comments

Comments
 (0)