Skip to content

Commit

Permalink
Merge pull request #21 from gruntwork-io/change-default-strategy
Browse files Browse the repository at this point in the history
Change default `update_strategy` to `next-breaking`
  • Loading branch information
marinalimeira authored Aug 24, 2023
2 parents fccda1b + d791001 commit ec78155
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ steps:
| `github_token` | GitHub's Personal Access Token (PAT). | `GITHUB_TOKEN` |
| `patcher_command` | Patcher command to run. Valid options: `update` or `report`. | `update` |
| `working_dir` | Directory where Patcher should run. If empty, it will run in the whole repo. | |
| `update_strategy` | Update strategy. Only used when running `update`. Valid options: `next-safe` or `next-breaking`. | `next-safe` |
| `update_strategy` | Update strategy. Only used when running `update`. Valid options: `next-safe` or `next-breaking`. Refer to the ["Update Strategies" documentation](https://docs.gruntwork.io/patcher/update-strategies). | `next-breaking` |
| `dependency` | Target the update to a single dependency. Only used when running `update`. Format: `<org>/<repo>/<name>`. Example: `gruntwork-io/terraform-aws-service-catalog/services/ecs-module`. | |
| `commit_author` | Author of the Pull Request's commits in the format `Name <name@email.com>`. Only used when running `update`. The permissions to push the changes and to create the Pull Request are from 'github_token'. | `gruntwork-patcher-bot <patcher@gruntwork.io>` |

Expand Down
3 changes: 2 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ inputs:
description: "Patcher command to run. Valid options: 'update' or 'report'."
default: "update"
update_strategy:
description: "Update strategy. Only used when running 'update'. Defaults to 'next-safe'."
description: "Update strategy. Only used when running 'update'. Defaults to 'next-breaking'."
default: "next-breaking"
dependency:
description: >
"Target the update to a single dependency. Format: <org>/<repo>/<name>."
Expand Down
8 changes: 5 additions & 3 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13542,6 +13542,8 @@ const VALID_COMMANDS = [REPORT_COMMAND, UPDATE_COMMAND];
const NON_INTERACTIVE_FLAG = "--non-interactive";
const NO_COLOR_FLAG = "--no-color";
const SKIP_CONTAINER_FLAG = "--skip-container-runtime";
const UPDATE_STRATEGY_FLAG = "--update-strategy";
const TARGET_FLAG = "--target";
function osPlatform() {
const platform = os.platform();
switch (platform) {
Expand Down Expand Up @@ -13649,14 +13651,14 @@ function isPatcherCommandValid(command) {
}
function updateArgs(updateStrategy, dependency, workingDir) {
let args = ["update", NO_COLOR_FLAG, NON_INTERACTIVE_FLAG, SKIP_CONTAINER_FLAG];
// If updateStrategy or dependency are not empty, are not empty, assign them with the appropriate flag.
// If updateStrategy or dependency are not empty, assign them with the appropriate flag.
// If they are invalid, Patcher will return an error, which will cause the Action to fail.
if (updateStrategy !== "") {
args = args.concat(`--update-strategy=${updateStrategy}`);
args = args.concat(`${UPDATE_STRATEGY_FLAG}=${updateStrategy}`);
}
// If a dependency is provided, set the `target` flag so Patcher can limit the update to a single dependency.
if (dependency !== "") {
args = args.concat(`--target=${dependency}`);
args = args.concat(`${TARGET_FLAG}=${dependency}`);
}
return args.concat([workingDir]);
}
Expand Down
8 changes: 5 additions & 3 deletions src/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ const VALID_COMMANDS = [REPORT_COMMAND, UPDATE_COMMAND];
const NON_INTERACTIVE_FLAG = "--non-interactive"
const NO_COLOR_FLAG = "--no-color"
const SKIP_CONTAINER_FLAG = "--skip-container-runtime"
const UPDATE_STRATEGY_FLAG = "--update-strategy"
const TARGET_FLAG = "--target"

// Define types

Expand Down Expand Up @@ -172,15 +174,15 @@ function isPatcherCommandValid(command: string): boolean {
function updateArgs(updateStrategy: string, dependency: string, workingDir: string): string[] {
let args = ["update", NO_COLOR_FLAG, NON_INTERACTIVE_FLAG, SKIP_CONTAINER_FLAG];

// If updateStrategy or dependency are not empty, are not empty, assign them with the appropriate flag.
// If updateStrategy or dependency are not empty, assign them with the appropriate flag.
// If they are invalid, Patcher will return an error, which will cause the Action to fail.
if (updateStrategy !== "") {
args = args.concat(`--update-strategy=${updateStrategy}`)
args = args.concat(`${UPDATE_STRATEGY_FLAG}=${updateStrategy}`)
}

// If a dependency is provided, set the `target` flag so Patcher can limit the update to a single dependency.
if (dependency !== "") {
args = args.concat(`--target=${dependency}`)
args = args.concat(`${TARGET_FLAG}=${dependency}`)
}

return args.concat([workingDir]);
Expand Down

0 comments on commit ec78155

Please sign in to comment.