Skip to content

Commit

Permalink
feat: clean up user agent (#231)
Browse files Browse the repository at this point in the history
* feat: clean up user agent

* lint
  • Loading branch information
averikitsch committed Nov 16, 2020
1 parent 5ef9455 commit 478a42b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 4 additions & 0 deletions setup-gcloud/src/setup-gcloud.ts
Expand Up @@ -21,7 +21,11 @@ import { promises as fs } from 'fs';
import path from 'path';
import { v4 as uuidv4 } from 'uuid';

export const GCLOUD_METRICS_ENV_VAR = 'CLOUDSDK_METRICS_ENVIRONMENT';
export const GCLOUD_METRICS_LABEL = 'github-actions-setup-gcloud';

export async function run(): Promise<void> {
core.exportVariable(GCLOUD_METRICS_ENV_VAR, GCLOUD_METRICS_LABEL);
try {
let version = core.getInput('version');
if (!version || version == 'latest') {
Expand Down
3 changes: 1 addition & 2 deletions setupGcloudSDK/src/format-url.ts
Expand Up @@ -16,7 +16,6 @@

import * as httpm from 'typed-rest-client/HttpClient';
import { retry } from '@lifeomic/attempt';
import { GCLOUD_METRICS_LABEL } from './install-util';

/**
* Formats the gcloud SDK release URL according to the specified arguments.
Expand Down Expand Up @@ -68,7 +67,7 @@ export async function getReleaseURL(
): Promise<string> {
try {
const url = formatReleaseURL(os, arch, version);
const client = new httpm.HttpClient(GCLOUD_METRICS_LABEL);
const client = new httpm.HttpClient('github-actions-setup-gcloud-sdk');
return retry(
async () => {
const res = await client.head(url);
Expand Down
4 changes: 0 additions & 4 deletions setupGcloudSDK/src/install-util.ts
Expand Up @@ -21,9 +21,6 @@ import * as toolCache from '@actions/tool-cache';
import * as core from '@actions/core';
import path from 'path';

export const GCLOUD_METRICS_ENV_VAR = 'CLOUDSDK_METRICS_ENVIRONMENT';
export const GCLOUD_METRICS_LABEL = 'github-actions-setup-gcloud';

/**
* Installs the gcloud SDK into the actions environment.
*
Expand All @@ -39,6 +36,5 @@ export async function installGcloudSDK(
let toolPath = await toolCache.cacheDir(toolRoot, 'gcloud', version);
toolPath = path.join(toolPath, 'bin');
core.addPath(toolPath);
core.exportVariable(GCLOUD_METRICS_ENV_VAR, GCLOUD_METRICS_LABEL);
return toolPath;
}
5 changes: 3 additions & 2 deletions setupGcloudSDK/src/version-util.ts
Expand Up @@ -20,15 +20,16 @@

import * as httpm from 'typed-rest-client/HttpClient';
import { retry } from '@lifeomic/attempt';
import { GCLOUD_METRICS_LABEL } from './install-util';

/**
* @returns The latest stable version of the gcloud SDK.
*/
export async function getLatestGcloudSDKVersion(): Promise<string> {
const queryUrl =
'https://dl.google.com/dl/cloudsdk/channels/rapid/components-2.json';
const client: httpm.HttpClient = new httpm.HttpClient(GCLOUD_METRICS_LABEL);
const client: httpm.HttpClient = new httpm.HttpClient(
'github-actions-setup-gcloud-sdk',
);
return await retry(
async () => {
const res = await client.get(queryUrl);
Expand Down

0 comments on commit 478a42b

Please sign in to comment.