Skip to content

Commit b0db961

Browse files
authored
start: add 'payload' parameter (#87)
1 parent 86fa294 commit b0db961

File tree

6 files changed

+21
-9
lines changed

6 files changed

+21
-9
lines changed

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ In addition to the [core configuration](#configuration), the following [`inputs`
8484
| --------------- | ------- | --------------------------------------------------------------------------------------------------- |
8585
| `deployment_id` | | Use an existing deployment instead of creating a new one (e.g. `${{ github.event.deployment.id }}`) |
8686
| `override` | `false` | whether to mark existing deployments of this environment as inactive |
87+
| `payload` | | JSON-formatted dictionary with extra information about the deployment |
8788

8889
The following [`outputs`](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/contexts-and-expression-syntax-for-github-actions#steps-context) are available:
8990

@@ -161,13 +162,13 @@ This is best used after `step: start` and should follow whatever deployment task
161162

162163
In addition to the [core configuration](#configuration), the following [`inputs`](https://help.github.com/en/articles/workflow-syntax-for-github-actions#jobsjob_idstepswith) are available:
163164

164-
| Variable | Default | Purpose |
165-
| --------------- | ------- | --------------------------------------------------------------------------------- |
166-
| `status` | | provide the current deployment job status `${{ job.status }}` |
167-
| `deployment_id` | | identifier for deployment to update (see outputs of [`step: start`](#step-start)) |
168-
| `env_url` | | URL to view deployed environment |
169-
| `override` | `true` | whether to manually mark existing deployments of this environment as inactive |
170-
| `auto_inactive` | `true` | whether to let GitHub handle marking existing deployments of this environment as inactive ([if and only if a new deployment succeeds](https://docs.github.com/en/rest/reference/deployments#inactive-deployments)). |
165+
| Variable | Default | Purpose |
166+
| --------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
167+
| `status` | | provide the current deployment job status `${{ job.status }}` |
168+
| `deployment_id` | | identifier for deployment to update (see outputs of [`step: start`](#step-start)) |
169+
| `env_url` | | URL to view deployed environment |
170+
| `override` | `true` | whether to manually mark existing deployments of this environment as inactive |
171+
| `auto_inactive` | `true` | whether to let GitHub handle marking existing deployments of this environment as inactive ([if and only if a new deployment succeeds](https://docs.github.com/en/rest/reference/deployments#inactive-deployments)). |
171172

172173
<details>
173174
<summary>Simple Example</summary>

action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,6 @@ inputs:
5252
required: false
5353
description: Whether to mark existing deployments as inactive if a deployment succeeds (for `finish` only)
5454
default: 'false'
55+
payload:
56+
required: false
57+
description: JSON-formatted dictionary with extra information about the deployment (for `start` only)

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/steps/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,15 @@ export async function run(
3030
switch (step) {
3131
case Step.Start:
3232
{
33+
const rawPayload = getOptionalInput("payload");
34+
let payload: { [key: string]: any } | undefined = undefined;
35+
if (rawPayload) {
36+
payload = JSON.parse(rawPayload);
37+
}
3338
const stepArgs: StartArgs = {
3439
deploymentID: getOptionalInput("deployment_id"),
3540
override: getBooleanInput("override", false), // default to false on start
41+
payload,
3642
};
3743
log.debug(`'${step}' arguments`, {
3844
stepArgs,

src/steps/start.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import deactivateEnvironment from "../lib/deactivate";
66
export type StartArgs = {
77
deploymentID?: string;
88
override: boolean;
9+
payload?: { [key: string]: any };
910
};
1011

1112
async function createStart(
@@ -37,6 +38,7 @@ async function createStart(
3738
description: description,
3839
auto_merge: false,
3940
transient_environment: true,
41+
payload: stepArgs.payload,
4042
});
4143
if (deployment.status == 201) {
4244
deploymentID = deployment.data.id;

0 commit comments

Comments
 (0)