Skip to content

Commit

Permalink
add pulumi cancel action
Browse files Browse the repository at this point in the history
  • Loading branch information
hd-deman committed Nov 2, 2022
1 parent 84a0790 commit 9688d4c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
name: Dotnet ${{ matrix.command }} on ${{ matrix.os }}
strategy:
matrix:
command: [up, refresh, destroy, preview]
command: [up, refresh, destroy, preview, cancel]
os: [ubuntu-latest, macos-latest, windows-latest]
fail-fast: false
steps:
Expand Down Expand Up @@ -86,7 +86,7 @@ jobs:
name: Golang ${{ matrix.command }} on ${{ matrix.os }}
strategy:
matrix:
command: [up, refresh, destroy, preview]
command: [up, refresh, destroy, preview, cancel]
os: [ubuntu-latest, macos-latest, windows-latest]
fail-fast: false
steps:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ This will check out the existing directory and run `pulumi preview`.
The action can be configured with the following arguments:

- `command` (required) - The command to run as part of the action. Accepted
values are `up` (update), `refresh`, `destroy` and `preview`.
values are `up` (update), `refresh`, `destroy` `preview` and `cancel`.

- `stack-name` (required) - The name of the stack that Pulumi will be operating
on
Expand Down
1 change: 1 addition & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export const command = rt.Union(
rt.Literal('refresh'),
rt.Literal('destroy'),
rt.Literal('preview'),
rt.Literal('cancel'),
);

export type Commands = rt.Static<typeof command>;
Expand Down
3 changes: 2 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ const main = async () => {
stack.refresh({ onOutput, ...config.options }).then((r) => r.stdout),
destroy: () =>
stack.destroy({ onOutput, ...config.options }).then((r) => r.stdout),
preview: async () => {
cancel: async () => { await stack.cancel(); return "" },
preview: async () => {
const { stdout, stderr } = await stack.preview(config.options);
onOutput(stdout);
onOutput(stderr);
Expand Down

0 comments on commit 9688d4c

Please sign in to comment.