Skip to content

Commit 90a784e

Browse files
author
James Brundage
committed
feat: ugit action -NoCommit ( Fixes #318 )
1 parent 13326c9 commit 90a784e

File tree

2 files changed

+25
-7
lines changed

2 files changed

+25
-7
lines changed

Build/GitHub/Actions/UGitAction.ps1

+8-3
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,14 @@ $UserEmail,
5656
$UserName,
5757

5858
# If set, will not push any changes made to the repository.
59-
# (they will still be committed unless -NoCommit is passed)
59+
# (they will still be committed unless `-NoCommit` is passed)
6060
[switch]
61-
$NoPush
61+
$NoPush,
62+
63+
# If set, will not commit any changes made to the repository.
64+
# (this also implies `-NoPush`)
65+
[switch]
66+
$NoCommit
6267
)
6368

6469
$ErrorActionPreference = 'continue'
@@ -309,7 +314,7 @@ filter ProcessOutput {
309314
} elseif ($outItem) {
310315
$outItem.FullName, (git status $outItem.Fullname -s)
311316
}
312-
if ($shouldCommit) {
317+
if ($shouldCommit -and -not $NoCommit) {
313318
"$fullName has changed, and should be committed" | Out-Host
314319
git add $fullName
315320
if ($out.Message) {

action.yml

+17-4
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,12 @@ inputs:
4040
required: false
4141
description: |
4242
If set, will not push any changes made to the repository.
43-
(they will still be committed unless -NoCommit is passed)
43+
(they will still be committed unless `-NoCommit` is passed)
44+
NoCommit:
45+
required: false
46+
description: |
47+
If set, will not commit any changes made to the repository.
48+
(this also implies `-NoPush`)
4449
branding:
4550
icon: git-merge
4651
color: blue
@@ -60,6 +65,7 @@ runs:
6065
ActionScript: ${{inputs.ActionScript}}
6166
TargetBranch: ${{inputs.TargetBranch}}
6267
UserEmail: ${{inputs.UserEmail}}
68+
NoCommit: ${{inputs.NoCommit}}
6369
UserName: ${{inputs.UserName}}
6470
run: |
6571
$Parameters = @{}
@@ -77,6 +83,8 @@ runs:
7783
$Parameters.UserName = ${env:UserName}
7884
$Parameters.NoPush = ${env:NoPush}
7985
$Parameters.NoPush = $parameters.NoPush -match 'true';
86+
$Parameters.NoCommit = ${env:NoCommit}
87+
$Parameters.NoCommit = $parameters.NoCommit -match 'true';
8088
foreach ($k in @($parameters.Keys)) {
8189
if ([String]::IsNullOrEmpty($parameters[$k])) {
8290
$parameters.Remove($k)
@@ -141,9 +149,14 @@ runs:
141149
$UserName,
142150
143151
# If set, will not push any changes made to the repository.
144-
# (they will still be committed unless -NoCommit is passed)
152+
# (they will still be committed unless `-NoCommit` is passed)
153+
[switch]
154+
$NoPush,
155+
156+
# If set, will not commit any changes made to the repository.
157+
# (this also implies `-NoPush`)
145158
[switch]
146-
$NoPush
159+
$NoCommit
147160
)
148161
149162
$ErrorActionPreference = 'continue'
@@ -394,7 +407,7 @@ runs:
394407
} elseif ($outItem) {
395408
$outItem.FullName, (git status $outItem.Fullname -s)
396409
}
397-
if ($shouldCommit) {
410+
if ($shouldCommit -and -not $NoCommit) {
398411
"$fullName has changed, and should be committed" | Out-Host
399412
git add $fullName
400413
if ($out.Message) {

0 commit comments

Comments
 (0)