Skip to content

Commit 45aec03

Browse files
Merge branch 'main' into twitnithegirl/TFDN-1107-add-sort-params-for-agent-and-agent-pool
2 parents cd7ff63 + 05fd1dc commit 45aec03

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## Enhancements
44
* Add `Sort` option to `Agents` and `AgentPools`, by @twitnithegirl [#1229](https://github.com/hashicorp/go-tfe/pull/1229)
5+
* Add BETA support for Action invocations via `CreateRunOptions` by @mutahhir [#1206](https://github.com/hashicorp/go-tfe/pull/1206)
56

67
# v1.93.0
78

run.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ type Run struct {
140140
ForceCancelAvailableAt time.Time `jsonapi:"attr,force-cancel-available-at,iso8601"`
141141
HasChanges bool `jsonapi:"attr,has-changes"`
142142
IsDestroy bool `jsonapi:"attr,is-destroy"`
143+
InvokeActionAddrs []string `jsonapi:"attr,invoke-action-addrs,omitempty"`
143144
Message string `jsonapi:"attr,message"`
144145
Permissions *RunPermissions `jsonapi:"attr,permissions"`
145146
PolicyPaths []string `jsonapi:"attr,policy-paths,omitempty"`
@@ -403,6 +404,9 @@ type RunCreateOptions struct {
403404
// Variables allows you to specify terraform input variables for
404405
// a particular run, prioritized over variables defined on the workspace.
405406
Variables []*RunVariable `jsonapi:"attr,variables,omitempty"`
407+
408+
// Action Addresses to invoke.
409+
InvokeActionAddrs []string `jsonapi:"attr,invoke-action-addrs,omitempty"`
406410
}
407411

408412
// RunApplyOptions represents the options for applying a run.

run_integration_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,23 @@ func TestRunsCreate(t *testing.T) {
371371
assert.Contains(t, r.PolicyPaths, "./path/to/dir1")
372372
assert.Contains(t, r.PolicyPaths, "./path/to/dir2")
373373
})
374+
375+
t.Run("with action invocations", func(t *testing.T) {
376+
skipUnlessBeta(t)
377+
378+
opts := RunCreateOptions{
379+
Message: String("creating with policy paths"),
380+
Workspace: wTest,
381+
InvokeActionAddrs: []string{"actions.foo.bar"},
382+
}
383+
384+
r, err := client.Runs.Create(ctx, opts)
385+
require.NoError(t, err)
386+
require.NotEmpty(t, r.InvokeActionAddrs)
387+
388+
assert.Len(t, r.InvokeActionAddrs, 1)
389+
assert.Contains(t, r.InvokeActionAddrs, "actions.foo.bar")
390+
})
374391
}
375392

376393
func TestRunsRead_CostEstimate(t *testing.T) {

0 commit comments

Comments
 (0)