Skip to content

Commit

Permalink
feat: emit a warning when action is pinned to head (#460)
Browse files Browse the repository at this point in the history
  • Loading branch information
sethvargo authored Dec 29, 2021
1 parent f80ec2b commit 1a48ffa
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion dist/main/index.js

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions src/setup-gcloud.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,22 @@ 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.`,
);
}

core.exportVariable(GCLOUD_METRICS_ENV_VAR, GCLOUD_METRICS_LABEL);
try {
let version = core.getInput('version');
Expand Down

0 comments on commit 1a48ffa

Please sign in to comment.