Skip to content

Commit

Permalink
Fix docs about component installation for system-provided (#615)
Browse files Browse the repository at this point in the history
Closes #610
  • Loading branch information
sethvargo authored Feb 7, 2023
1 parent 62d4898 commit 5f47137
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ jobs:
- `skip_install`: (Optional) Skip the `gcloud` installation and use the
[system-installed gcloud][github-runners] instead. This can dramatically
improve workflow speeds at the expense of a slightly older gcloud version.
Setting this to `true` ignores any value for the `version` input. Even if
installation is skipped, this GitHub Action will still configure any
components or project metadata. The default value is `false`.
Setting this to `true` ignores any value for the `version` input. If you
skip installation, you will be unable to install components because the
system-install gcloud is locked. The default value is `false`.

- `version`: (Optional) A string representing the version or version
constraint of the Cloud SDK (`gcloud`) to install (e.g. `"290.0.1"` or `">=
Expand Down
17 changes: 14 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,27 @@ export async function run(): Promise<void> {

try {
const skipInstall = parseBoolean(core.getInput('skip_install'));
let version = presence(core.getInput('version'));
const components = core.getInput('install_components');
const projectId = core.getInput('project_id');

if (skipInstall) {
core.info(`Skipping installation ("skip_install" was true)`);
if (version) {
core.warning(`Ignoring "version" because "skip_install" was true!`);
}

if (components) {
core.warning(
`Installing custom components with the system-provided gcloud may fail. ` +
`Set "skip_install" to false to install a managed version.`,
);
}
} else {
// Compute the version information. If the version was not specified,
// accept any installed version. If the version was specified as "latest",
// compute the latest version. Otherwise, accept the version/version
// constraint as-is.
let version = presence(core.getInput('version'));
if (!version) {
core.debug(`version was unset, defaulting to any version`);
version = '> 0.0.0';
Expand All @@ -80,7 +93,6 @@ export async function run(): Promise<void> {
}

// Install additional components
const components = core.getInput('install_components');
if (components) {
await installComponent(components.split(',').map((comp) => comp.trim()));
}
Expand All @@ -97,7 +109,6 @@ export async function run(): Promise<void> {
}

// Set the project ID, if given.
const projectId = core.getInput('project_id');
if (projectId) {
await setProject(projectId);
core.info('Successfully set default project');
Expand Down

0 comments on commit 5f47137

Please sign in to comment.