Skip to content

Commit d4a7e2e

Browse files
authored
Add --run-program to automation api (#580)
Similar change as for pulumi/pulumi#19218 but for dotnet. Also fix the github workflows, because of course can't make a CI change right in one go.
1 parent d1a4743 commit d4a7e2e

File tree

6 files changed

+62
-5
lines changed

6 files changed

+62
-5
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
component: sdk/auto
2+
kind: Improvements
3+
body: Add --run-program to destory and refresh operations
4+
time: 2025-04-24T21:30:35.404733406+01:00
5+
custom:
6+
PR: "580"

.github/workflows/pr.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,20 @@ jobs:
7272
runs-on: ubuntu-22.04
7373
steps:
7474
- uses: actions/checkout@v4
75-
- name: Lint changelog
75+
- name: Check if folder is empty
76+
id: folder_check
7677
run: |
77-
# Check the changelog is batchable
78-
if [ ! -z $(ls .changes/unreleased) ]; then
79-
# There are changes so check changie will batch them
80-
changie batch auto --dry-run
78+
if [ -z "$(ls .changes/unreleased)" ]; then
79+
echo "empty=true" >> $GITHUB_OUTPUT
80+
else
81+
echo "empty=false" >> $GITHUB_OUTPUT
8182
fi
83+
- name: Check the changelog is batchable
84+
# There are changes so check changie will batch them
85+
if: steps.folder_check.outputs.empty == 'false'
86+
uses: miniscruff/changie-action@v2
87+
with:
88+
args: batch auto --dry-run
8289

8390
build:
8491
needs: setup_matrix

sdk/Pulumi.Automation/DestroyOptions.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,10 @@ public sealed class DestroyOptions : UpdateOptions
2828
/// Refresh the state of the stack's resources before this destroy.
2929
/// </summary>
3030
public bool? Refresh { get; set; }
31+
32+
/// <summary>
33+
/// Runs the program in the workspace to perform the destroy.
34+
/// </summary>
35+
public bool? RunProgram { get; set; }
3136
}
3237
}

sdk/Pulumi.Automation/Pulumi.Automation.xml

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/Pulumi.Automation/RefreshOptions.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,10 @@ public sealed class RefreshOptions : UpdateOptions
3636
/// <see cref="PendingCreateValue"/> values to import into the stack
3737
/// </summary>
3838
public List<PendingCreateValue>? ImportPendingCreates { get; set; }
39+
40+
/// <summary>
41+
/// Runs the program in the workspace to perform the refresh.
42+
/// </summary>
43+
public bool? RunProgram { get; set; }
3944
}
4045
}

sdk/Pulumi.Automation/WorkspaceStack.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,18 @@ public async Task<UpdateResult> RefreshAsync(
603603
}
604604
}
605605

606+
if (options.RunProgram is not null)
607+
{
608+
if (options.RunProgram is true)
609+
{
610+
args.Add("--run-program=true");
611+
}
612+
else
613+
{
614+
args.Add("--run-program=false");
615+
}
616+
}
617+
606618
ApplyUpdateOptions(options, args);
607619
}
608620

@@ -655,6 +667,18 @@ public async Task<UpdateResult> DestroyAsync(
655667
if (options.Refresh is true)
656668
args.Add("--refresh");
657669

670+
if (options.RunProgram is not null)
671+
{
672+
if (options.RunProgram is true)
673+
{
674+
args.Add("--run-program=true");
675+
}
676+
else
677+
{
678+
args.Add("--run-program=false");
679+
}
680+
}
681+
658682
ApplyUpdateOptions(options, args);
659683
}
660684

0 commit comments

Comments
 (0)