Skip to content

Commit 1a48ffa

Browse files
authored
feat: emit a warning when action is pinned to head (#460)
1 parent f80ec2b commit 1a48ffa

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

dist/main/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/setup-gcloud.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,22 @@ import crypto from 'crypto';
3131
export const GCLOUD_METRICS_ENV_VAR = 'CLOUDSDK_METRICS_ENVIRONMENT';
3232
export const GCLOUD_METRICS_LABEL = 'github-actions-setup-gcloud';
3333

34+
const actionRef = process.env.GITHUB_ACTION_REF;
35+
3436
export async function run(): Promise<void> {
37+
if (actionRef == 'main' || actionRef == 'master') {
38+
core.warning(
39+
`google-github-actions/setup-gcloud is pinned at HEAD. We strongly ` +
40+
`advise against pinning to "@master" as it may be unstable. Please ` +
41+
`update your GitHub Action YAML from:\n\n` +
42+
` uses: 'google-github-actions/setup-gcloud@master'\n\n` +
43+
`to:\n\n` +
44+
` uses: 'google-github-actions/setup-gcloud@v0'\n\n` +
45+
`Alternatively, you can pin to any git tag or git SHA in the ` +
46+
`repository.`,
47+
);
48+
}
49+
3550
core.exportVariable(GCLOUD_METRICS_ENV_VAR, GCLOUD_METRICS_LABEL);
3651
try {
3752
let version = core.getInput('version');

0 commit comments

Comments
 (0)