Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix docs about component installation for system-provided #615

Merged
merged 1 commit into from
Feb 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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