chore: warn if the action is pinned to HEAD (#99)
This commit is contained in:
parent
443ae925ab
commit
419a2c3bfe
19
src/main.ts
19
src/main.ts
@ -10,6 +10,7 @@ import {
|
|||||||
setFailed,
|
setFailed,
|
||||||
setOutput,
|
setOutput,
|
||||||
setSecret,
|
setSecret,
|
||||||
|
warning as logWarning,
|
||||||
} from '@actions/core';
|
} from '@actions/core';
|
||||||
import {
|
import {
|
||||||
errorMessage,
|
errorMessage,
|
||||||
@ -35,10 +36,28 @@ const oidcWarning =
|
|||||||
`GitHub Actions workflow permissions are incorrect, or this job is being ` +
|
`GitHub Actions workflow permissions are incorrect, or this job is being ` +
|
||||||
`run from a fork. For more information, please see https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token`;
|
`run from a fork. For more information, please see https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token`;
|
||||||
|
|
||||||
|
const headWarning =
|
||||||
|
`google-github-actions/auth is pinned at HEAD. We strongly advise against ` +
|
||||||
|
`pinning to "@main" as it may be unstable. Please update your GitHub ` +
|
||||||
|
`Action YAML from:\n` +
|
||||||
|
`\n` +
|
||||||
|
` uses: 'google-github-actions/auth@main'\n` +
|
||||||
|
`\n` +
|
||||||
|
`to:\n` +
|
||||||
|
`\n` +
|
||||||
|
` uses: 'google-github-actions/auth@v0'\n` +
|
||||||
|
`\n` +
|
||||||
|
`Alternatively, you can pin to any git tag or git SHA in the repository.`;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes the main action, documented inline.
|
* Executes the main action, documented inline.
|
||||||
*/
|
*/
|
||||||
async function run(): Promise<void> {
|
async function run(): Promise<void> {
|
||||||
|
// Warn if pinned to HEAD
|
||||||
|
if (process.env.GITHUB_ACTION_REF == 'main') {
|
||||||
|
logWarning(headWarning);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Load configuration.
|
// Load configuration.
|
||||||
const projectID = getInput('project_id');
|
const projectID = getInput('project_id');
|
||||||
|
Loading…
Reference in New Issue
Block a user