chore: update deps and use new cloud sdk (#495)

This should resolve issues where output is swallowed
This commit is contained in:
Seth Vargo 2022-02-03 21:35:49 -05:00 committed by GitHub
parent f9167b9b27
commit 5cb418735f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 367 additions and 636 deletions

957
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -26,23 +26,24 @@
"dependencies": {
"@actions/core": "^1.6.0",
"@actions/tool-cache": "^1.7.1",
"@google-github-actions/setup-cloud-sdk": "^0.3.1"
"@google-github-actions/actions-utils": "^0.1.2",
"@google-github-actions/setup-cloud-sdk": "^0.4.0"
},
"devDependencies": {
"@types/chai": "^4.3.0",
"@types/mocha": "^9.1.0",
"@types/node": "^17.0.9",
"@types/sinon": "^10.0.8",
"@typescript-eslint/eslint-plugin": "^5.8.0",
"@typescript-eslint/parser": "^5.9.1",
"@types/node": "^17.0.14",
"@types/sinon": "^10.0.10",
"@typescript-eslint/eslint-plugin": "^5.10.2",
"@typescript-eslint/parser": "^5.10.2",
"@vercel/ncc": "^0.33.1",
"chai": "^4.3.4",
"eslint": "^8.7.0",
"chai": "^4.3.6",
"eslint": "^8.8.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^4.0.0",
"mocha": "^9.1.4",
"mocha": "^9.2.0",
"prettier": "^2.5.1",
"sinon": "^12.0.1",
"sinon": "^13.0.1",
"ts-node": "^10.4.0",
"typescript": "^4.5.5"
}

View file

@ -25,6 +25,11 @@ import {
parseServiceAccountKey,
setProject,
} from '@google-github-actions/setup-cloud-sdk';
import {
errorMessage,
isPinnedToHead,
pinnedToHeadWarning,
} from '@google-github-actions/actions-utils';
import { writeSecureFile } from './utils';
import path from 'path';
import crypto from 'crypto';
@ -32,20 +37,10 @@ import crypto from 'crypto';
export const GCLOUD_METRICS_ENV_VAR = 'CLOUDSDK_METRICS_ENVIRONMENT';
export const GCLOUD_METRICS_LABEL = 'github-actions-setup-gcloud';
const actionRef = process.env.GITHUB_ACTION_REF;
export async function run(): Promise<void> {
if (actionRef == 'main' || actionRef == 'master') {
core.warning(
`google-github-actions/setup-gcloud is pinned at HEAD. We strongly ` +
`advise against pinning to "@master" as it may be unstable. Please ` +
`update your GitHub Action YAML from:\n\n` +
` uses: 'google-github-actions/setup-gcloud@master'\n\n` +
`to:\n\n` +
` uses: 'google-github-actions/setup-gcloud@v0'\n\n` +
`Alternatively, you can pin to any git tag or git SHA in the ` +
`repository.`,
);
// Warn if pinned to HEAD
if (isPinnedToHead()) {
core.warning(pinnedToHeadWarning('v0'));
}
core.exportVariable(GCLOUD_METRICS_ENV_VAR, GCLOUD_METRICS_LABEL);
@ -166,8 +161,8 @@ export async function run(): Promise<void> {
core.exportVariable('GOOGLE_GHA_CREDS_PATH', credsPath);
core.info('Successfully exported Default Application Credentials');
}
} catch (error) {
const msg = error instanceof Error ? error.message : error;
} catch (err) {
const msg = errorMessage(err);
core.setFailed(`google-github-actions/setup-gcloud failed with: ${msg}`);
}
}

View file

@ -214,7 +214,7 @@ describe('#run', function () {
expect(this.stubs.setFailed.callCount).to.eq(1);
expect(this.stubs.setFailed.args[0][0]).to.eq(
'google-github-actions/setup-gcloud failed with: No credentials provided to export',
'google-github-actions/setup-gcloud failed with: no credentials provided to export',
);
});