Skip to content

Commit b2d7f5e

Browse files
authored
feat: add correct user-agent (#6)
* feat: add user-agent * Remove wrong user agent * Remove user agent from download * Add user-agent back
1 parent bd64f2e commit b2d7f5e

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

setupGcloudSDK/src/format-url.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

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

2120
/**
2221
* Formats the gcloud SDK release URL according to the specified arguments.
@@ -68,7 +67,7 @@ export async function getReleaseURL(
6867
): Promise<string> {
6968
try {
7069
const url = formatReleaseURL(os, arch, version);
71-
const client = new httpm.HttpClient(GCLOUD_METRICS_LABEL);
70+
const client = new httpm.HttpClient('github-actions-setup-gcloud-sdk');
7271
return retry(
7372
async () => {
7473
const res = await client.head(url);

setupGcloudSDK/src/install-util.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ import * as toolCache from '@actions/tool-cache';
2121
import * as core from '@actions/core';
2222
import path from 'path';
2323

24-
export const GCLOUD_METRICS_ENV_VAR = 'CLOUDSDK_METRICS_ENVIRONMENT';
25-
export const GCLOUD_METRICS_LABEL = 'github-actions-setup-gcloud';
26-
2724
/**
2825
* Installs the gcloud SDK into the actions environment.
2926
*
@@ -39,6 +36,5 @@ export async function installGcloudSDK(
3936
let toolPath = await toolCache.cacheDir(toolRoot, 'gcloud', version);
4037
toolPath = path.join(toolPath, 'bin');
4138
core.addPath(toolPath);
42-
core.exportVariable(GCLOUD_METRICS_ENV_VAR, GCLOUD_METRICS_LABEL);
4339
return toolPath;
4440
}

setupGcloudSDK/src/version-util.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,16 @@
2020

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

2524
/**
2625
* @returns The latest stable version of the gcloud SDK.
2726
*/
2827
export async function getLatestGcloudSDKVersion(): Promise<string> {
2928
const queryUrl =
3029
'https://dl.google.com/dl/cloudsdk/channels/rapid/components-2.json';
31-
const client: httpm.HttpClient = new httpm.HttpClient(GCLOUD_METRICS_LABEL);
30+
const client: httpm.HttpClient = new httpm.HttpClient(
31+
'github-actions-setup-gcloud-sdk',
32+
);
3233
return await retry(
3334
async () => {
3435
const res = await client.get(queryUrl);

src/main.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ import * as core from '@actions/core';
1818
import * as exec from '@actions/exec';
1919
import * as setupGcloud from '../setupGcloudSDK/src/';
2020

21+
export const GCLOUD_METRICS_ENV_VAR = 'CLOUDSDK_METRICS_ENVIRONMENT';
22+
export const GCLOUD_METRICS_LABEL = 'github-actions-deploy-appengine';
23+
2124
async function run(): Promise<void> {
25+
core.exportVariable(GCLOUD_METRICS_ENV_VAR, GCLOUD_METRICS_LABEL);
2226
try {
2327
// Get action inputs.
2428
let projectId = core.getInput('project_id');

0 commit comments

Comments
 (0)