Skip to content

Commit

Permalink
Merge pull request #393 from stepchowfun/remove-repo
Browse files Browse the repository at this point in the history
Drop support for `--repo` in favor of `--docker-repo`
  • Loading branch information
stepchowfun authored Sep 23, 2021
2 parents f29e054 + 47ded4b commit 1c47501
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 14 deletions.
3 changes: 2 additions & 1 deletion .github/actions/toast/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ inputs:
default: 'false'
repo:
description: 'Deprecated. Use `docker_repo` instead.'
required: false
required: true
default: ''
runs:
using: node12
main: index.js
15 changes: 12 additions & 3 deletions .github/actions/toast/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,25 @@ const { v4: uuidv4 } = require('uuid');
// Read the action inputs.
const tasksInput = core.getInput('tasks').trim();
const fileInput = core.getInput('file').trim();
const dockerRepoInput = (core.getInput('repo') || core.getInput('docker_repo')).trim();
const dockerRepoInput = core.getInput('docker_repo').trim();
const writeRemoteCacheInput = core.getInput('write_remote_cache').trim();

// Fail if the workflow is still using `repo` instead of `docker_repo`.
if (core.getInput('repo').trim() !== '') {
console.error(
'Your GitHub workflow is using the legacy `repo` option in the Toast action. Please change ' +
'it to `docker_repo` instead. The Toast maintainers apologize for the inconvenience.'
);
process.exit(1);
}

// Parse the action inputs.
const tasks = tasksInput === '' ? null : tasksInput.split(/\s+/);
const file = fileInput === '' ? null : fileInput;
const dockerRepo = dockerRepoInput === '' ? null : dockerRepoInput;
const writeRemoteCache = writeRemoteCacheInput == 'true';

// Where to install Toast.
// Where to install Toast
const toastPrefix = process.env.HOME;

// Before doing anything, disable command workflow processing. This is to prevent an injection
Expand All @@ -36,7 +45,7 @@ childProcess.execSync(
// Construct the command-line arguments for Toast.
const taskArgs = tasks === null ? [] : tasks;
const fileArgs = file === null ? [] : ['--file', file];
const dockerRepoArgs = dockerRepo === null ? [] : ['--repo', dockerRepo];
const dockerRepoArgs = dockerRepo === null ? [] : ['--docker-repo', dockerRepo];
const readRemoteCacheArgs = dockerRepo === null ? [] : ['--read-remote-cache', 'true'];
const writeRemoteCacheArgs = writeRemoteCache ? ['--write-remote-cache', 'true'] : [];

Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.44.0] - 2021-09-23

### Removed
- Removed the deprecated `--repo` flag. Please use `--docker-repo` instead.

## [0.43.0] - 2021-09-23

### Added
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "toast"
version = "0.43.0"
version = "0.44.0"
authors = ["Stephan Boyer <stephan@stephanboyer.com>"]
edition = "2018"
description = "Containerize your development and continuous integration environments."
Expand Down
8 changes: 0 additions & 8 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ const READ_REMOTE_CACHE_OPTION: &str = "read-remote-cache";
const WRITE_REMOTE_CACHE_OPTION: &str = "write-remote-cache";
const DOCKER_CLI_OPTION: &str = "docker-cli";
const DOCKER_REPO_OPTION: &str = "docker-repo";
const DEPRECATED_REPO_OPTION: &str = "repo";
const LIST_OPTION: &str = "list";
const SHELL_OPTION: &str = "shell";
const TASKS_OPTION: &str = "tasks";
Expand Down Expand Up @@ -220,12 +219,6 @@ fn settings() -> Result<Settings, Failure> {
.long(DOCKER_REPO_OPTION)
.help("Sets the Docker repository"),
)
.arg(
Arg::with_name(DEPRECATED_REPO_OPTION)
.value_name("REPO")
.long(DEPRECATED_REPO_OPTION)
.help("Deprecated, use --docker-repo instead"),
)
.arg(
Arg::with_name(DOCKER_CLI_OPTION)
.value_name("CLI")
Expand Down Expand Up @@ -340,7 +333,6 @@ fn settings() -> Result<Settings, Failure> {
// Read the Docker repo.
let docker_repo = matches
.value_of(DOCKER_REPO_OPTION)
.or_else(|| matches.value_of(DEPRECATED_REPO_OPTION))
.unwrap_or(&config.docker_repo)
.to_owned();

Expand Down

0 comments on commit 1c47501

Please sign in to comment.