Skip to content

Commit

Permalink
add back auto_inactive as an alternative behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
bobheadxi committed Feb 22, 2022
1 parent cbac5c8 commit 1592370
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 9 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ In addition to the [core configuration](#configuration), the following [`inputs`
| `status` | | provide the current deployment job status `${{ job.status }}` |
| `deployment_id` | | identifier for deployment to update (see outputs of [`step: start`](#step-start)) |
| `env_url` | | URL to view deployed environment |
| `override` | `true` | whether to mark existing deployments of this environment as inactive |
| `override` | `true` | whether to manually mark existing deployments of this environment as inactive |
| `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)). |

<details>
<summary>Simple Example</summary>
Expand Down Expand Up @@ -265,7 +266,6 @@ If you run into an problems or have any questions, feel free to open an [issue](
- **CHANGED: `no_override` is now `override`**, and the default behaviour is `override: true` in `step: finish` (`step: start` behaviour remains unchanged, but you can now set `override: true` on it now as well).
- **CHANGED: `log_args` is now `debug`**, but does the same thing as before.
- **CHANGED: `env` is now always required**. You can use `env: ${{ steps.deployment.outputs.env }}` to avoid repeating your env configuration.
- **REMOVED: `auto_inactive`** - use `override` instead.
- **REMOVED: `transient`** - all deployments created by this action are `transient` by default, with removals handled by `override` or `step: deactivate`.
- **ADDED: `step: delete-env`** deletes an environment entirely.

Expand Down
6 changes: 5 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,8 @@ inputs:
description: The deployment status (for `finish` only)
override:
required: false
description: Whether to mark existing deployments of this environment as inactive (for `start` and `finish` only)
description: Whether to manually mark existing deployments of this environment as inactive (for `start` and `finish` only)
auto_inactive:
required: false
description: Whether to mark existing deployments as inactive if a deployment succeeds (for `finish` only)
default: 'false'
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions src/steps/finish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export type FinishArgs = {
override: boolean;
status: string;
envURL?: string;
autoInactive: boolean;
};

async function createFinish(
Expand All @@ -17,7 +18,7 @@ async function createFinish(
) {
const {
log,
coreArgs: { environment, description, logsURL },
coreArgs: { description, logsURL },
} = context;
if (stepArgs.override) {
await deactivateEnvironment(github, context);
Expand Down Expand Up @@ -59,8 +60,9 @@ async function createFinish(
// set log_url to action by default
log_url: logsURL,
// if we are overriding previous deployments, let GitHub deactivate past
// deployments for us as a fallback
auto_inactive: stepArgs.override,
// deployments for us as a fallback, or see if a user explicitly wants to
// use this feature.
auto_inactive: stepArgs.override || stepArgs.autoInactive,
});

log.info(`${stepArgs.deploymentID} status set to ${newStatus}`, {
Expand Down
3 changes: 2 additions & 1 deletion src/steps/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ export async function run(
status: getRequiredInput("status").toLowerCase(),
deploymentID: getRequiredInput("deployment_id"),
envURL: getOptionalInput("env_url"),
override: getBooleanInput("override", true), // default to false on finish
override: getBooleanInput("override", true), // default to true on finish
autoInactive: getBooleanInput("auto_inactive", false),
};
log.debug(`'${step}' arguments`, {
stepArgs,
Expand Down

0 comments on commit 1592370

Please sign in to comment.