bug: use actions-utils to emit HEAD warning (#102)

This commit is contained in:
Seth Vargo 2021-12-30 10:00:21 -05:00 committed by GitHub
parent 478002e00b
commit 9b6531516d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 99 additions and 106 deletions

8
dist/main/index.js vendored

File diff suppressed because one or more lines are too long

2
dist/post/index.js vendored

File diff suppressed because one or more lines are too long

174
package-lock.json generated
View File

@ -10,7 +10,7 @@
"license": "Apache-2.0",
"dependencies": {
"@actions/core": "^1.6.0",
"@google-github-actions/actions-utils": "^0.1.0"
"@google-github-actions/actions-utils": "^0.1.1"
},
"devDependencies": {
"@types/chai": "^4.3.0",
@ -96,9 +96,9 @@
}
},
"node_modules/@google-github-actions/actions-utils": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/@google-github-actions/actions-utils/-/actions-utils-0.1.0.tgz",
"integrity": "sha512-zGKODnHmCqLL6RQP6CFY+EtpS4J+VSX6RRUNdv1NGS3sSavKy+yD0O+7hzfEjqdZBPGK8lf1JhttYHYZ6KbMmA==",
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/@google-github-actions/actions-utils/-/actions-utils-0.1.1.tgz",
"integrity": "sha512-2jg+V7f5BuHxpIwdJUn52s8A/0AhY8GrfYVmrLMZbMr1Tiqu6YAQDGawGsdo1l7Qsqr/J1ftvaSmefQU4FLkVw==",
"dependencies": {
"yaml": "^1.10.2"
}
@ -201,19 +201,19 @@
"dev": true
},
"node_modules/@types/node": {
"version": "17.0.2",
"resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.2.tgz",
"integrity": "sha512-JepeIUPFDARgIs0zD/SKPgFsJEAF0X5/qO80llx59gOxFTboS9Amv3S+QfB7lqBId5sFXJ99BN0J6zFRvL9dDA==",
"version": "17.0.5",
"resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.5.tgz",
"integrity": "sha512-w3mrvNXLeDYV1GKTZorGJQivK6XLCoGwpnyJFbJVK/aTBQUxOCaa/GlFAAN3OTDFcb7h5tiFG+YXCO2By+riZw==",
"dev": true
},
"node_modules/@typescript-eslint/eslint-plugin": {
"version": "5.8.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.8.0.tgz",
"integrity": "sha512-spu1UW7QuBn0nJ6+psnfCc3iVoQAifjKORgBngKOmC8U/1tbe2YJMzYQqDGYB4JCss7L8+RM2kKLb1B1Aw9BNA==",
"version": "5.8.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.8.1.tgz",
"integrity": "sha512-wTZ5oEKrKj/8/366qTM366zqhIKAp6NCMweoRONtfuC07OAU9nVI2GZZdqQ1qD30WAAtcPdkH+npDwtRFdp4Rw==",
"dev": true,
"dependencies": {
"@typescript-eslint/experimental-utils": "5.8.0",
"@typescript-eslint/scope-manager": "5.8.0",
"@typescript-eslint/experimental-utils": "5.8.1",
"@typescript-eslint/scope-manager": "5.8.1",
"debug": "^4.3.2",
"functional-red-black-tree": "^1.0.1",
"ignore": "^5.1.8",
@ -239,15 +239,15 @@
}
},
"node_modules/@typescript-eslint/experimental-utils": {
"version": "5.8.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-5.8.0.tgz",
"integrity": "sha512-KN5FvNH71bhZ8fKtL+lhW7bjm7cxs1nt+hrDZWIqb6ViCffQcWyLunGrgvISgkRojIDcXIsH+xlFfI4RCDA0xA==",
"version": "5.8.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-5.8.1.tgz",
"integrity": "sha512-fbodVnjIDU4JpeXWRDsG5IfIjYBxEvs8EBO8W1+YVdtrc2B9ppfof5sZhVEDOtgTfFHnYQJDI8+qdqLYO4ceww==",
"dev": true,
"dependencies": {
"@types/json-schema": "^7.0.9",
"@typescript-eslint/scope-manager": "5.8.0",
"@typescript-eslint/types": "5.8.0",
"@typescript-eslint/typescript-estree": "5.8.0",
"@typescript-eslint/scope-manager": "5.8.1",
"@typescript-eslint/types": "5.8.1",
"@typescript-eslint/typescript-estree": "5.8.1",
"eslint-scope": "^5.1.1",
"eslint-utils": "^3.0.0"
},
@ -263,14 +263,14 @@
}
},
"node_modules/@typescript-eslint/parser": {
"version": "5.8.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.8.0.tgz",
"integrity": "sha512-Gleacp/ZhRtJRYs5/T8KQR3pAQjQI89Dn/k+OzyCKOsLiZH2/Vh60cFBTnFsHNI6WAD+lNUo/xGZ4NeA5u0Ipw==",
"version": "5.8.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.8.1.tgz",
"integrity": "sha512-K1giKHAjHuyB421SoXMXFHHVI4NdNY603uKw92++D3qyxSeYvC10CBJ/GE5Thpo4WTUvu1mmJI2/FFkz38F2Gw==",
"dev": true,
"dependencies": {
"@typescript-eslint/scope-manager": "5.8.0",
"@typescript-eslint/types": "5.8.0",
"@typescript-eslint/typescript-estree": "5.8.0",
"@typescript-eslint/scope-manager": "5.8.1",
"@typescript-eslint/types": "5.8.1",
"@typescript-eslint/typescript-estree": "5.8.1",
"debug": "^4.3.2"
},
"engines": {
@ -290,13 +290,13 @@
}
},
"node_modules/@typescript-eslint/scope-manager": {
"version": "5.8.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.8.0.tgz",
"integrity": "sha512-x82CYJsLOjPCDuFFEbS6e7K1QEWj7u5Wk1alw8A+gnJiYwNnDJk0ib6PCegbaPMjrfBvFKa7SxE3EOnnIQz2Gg==",
"version": "5.8.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.8.1.tgz",
"integrity": "sha512-DGxJkNyYruFH3NIZc3PwrzwOQAg7vvgsHsHCILOLvUpupgkwDZdNq/cXU3BjF4LNrCsVg0qxEyWasys5AiJ85Q==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "5.8.0",
"@typescript-eslint/visitor-keys": "5.8.0"
"@typescript-eslint/types": "5.8.1",
"@typescript-eslint/visitor-keys": "5.8.1"
},
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
@ -307,9 +307,9 @@
}
},
"node_modules/@typescript-eslint/types": {
"version": "5.8.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.8.0.tgz",
"integrity": "sha512-LdCYOqeqZWqCMOmwFnum6YfW9F3nKuxJiR84CdIRN5nfHJ7gyvGpXWqL/AaW0k3Po0+wm93ARAsOdzlZDPCcXg==",
"version": "5.8.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.8.1.tgz",
"integrity": "sha512-L/FlWCCgnjKOLefdok90/pqInkomLnAcF9UAzNr+DSqMC3IffzumHTQTrINXhP1gVp9zlHiYYjvozVZDPleLcA==",
"dev": true,
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
@ -320,13 +320,13 @@
}
},
"node_modules/@typescript-eslint/typescript-estree": {
"version": "5.8.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.8.0.tgz",
"integrity": "sha512-srfeZ3URdEcUsSLbkOFqS7WoxOqn8JNil2NSLO9O+I2/Uyc85+UlfpEvQHIpj5dVts7KKOZnftoJD/Fdv0L7nQ==",
"version": "5.8.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.8.1.tgz",
"integrity": "sha512-26lQ8l8tTbG7ri7xEcCFT9ijU5Fk+sx/KRRyyzCv7MQ+rZZlqiDPtMKWLC8P7o+dtCnby4c+OlxuX1tp8WfafQ==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "5.8.0",
"@typescript-eslint/visitor-keys": "5.8.0",
"@typescript-eslint/types": "5.8.1",
"@typescript-eslint/visitor-keys": "5.8.1",
"debug": "^4.3.2",
"globby": "^11.0.4",
"is-glob": "^4.0.3",
@ -347,12 +347,12 @@
}
},
"node_modules/@typescript-eslint/visitor-keys": {
"version": "5.8.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.8.0.tgz",
"integrity": "sha512-+HDIGOEMnqbxdAHegxvnOqESUH6RWFRR2b8qxP1W9CZnnYh4Usz6MBL+2KMAgPk/P0o9c1HqnYtwzVH6GTIqug==",
"version": "5.8.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.8.1.tgz",
"integrity": "sha512-SWgiWIwocK6NralrJarPZlWdr0hZnj5GXHIgfdm8hNkyKvpeQuFyLP6YjSIe9kf3YBIfU6OHSZLYkQ+smZwtNg==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "5.8.0",
"@typescript-eslint/types": "5.8.1",
"eslint-visitor-keys": "^3.0.0"
},
"engines": {
@ -379,9 +379,9 @@
}
},
"node_modules/acorn": {
"version": "8.6.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.6.0.tgz",
"integrity": "sha512-U1riIR+lBSNi3IbxtaHOIKdH8sLFv3NYfNv8sg7ZsNhcfl4HF2++BfqqrNAxoCLQW1iiylOj76ecnaUxz+z9yw==",
"version": "8.7.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz",
"integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==",
"dev": true,
"bin": {
"acorn": "bin/acorn"
@ -2471,9 +2471,9 @@
}
},
"@google-github-actions/actions-utils": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/@google-github-actions/actions-utils/-/actions-utils-0.1.0.tgz",
"integrity": "sha512-zGKODnHmCqLL6RQP6CFY+EtpS4J+VSX6RRUNdv1NGS3sSavKy+yD0O+7hzfEjqdZBPGK8lf1JhttYHYZ6KbMmA==",
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/@google-github-actions/actions-utils/-/actions-utils-0.1.1.tgz",
"integrity": "sha512-2jg+V7f5BuHxpIwdJUn52s8A/0AhY8GrfYVmrLMZbMr1Tiqu6YAQDGawGsdo1l7Qsqr/J1ftvaSmefQU4FLkVw==",
"requires": {
"yaml": "^1.10.2"
}
@ -2564,19 +2564,19 @@
"dev": true
},
"@types/node": {
"version": "17.0.2",
"resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.2.tgz",
"integrity": "sha512-JepeIUPFDARgIs0zD/SKPgFsJEAF0X5/qO80llx59gOxFTboS9Amv3S+QfB7lqBId5sFXJ99BN0J6zFRvL9dDA==",
"version": "17.0.5",
"resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.5.tgz",
"integrity": "sha512-w3mrvNXLeDYV1GKTZorGJQivK6XLCoGwpnyJFbJVK/aTBQUxOCaa/GlFAAN3OTDFcb7h5tiFG+YXCO2By+riZw==",
"dev": true
},
"@typescript-eslint/eslint-plugin": {
"version": "5.8.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.8.0.tgz",
"integrity": "sha512-spu1UW7QuBn0nJ6+psnfCc3iVoQAifjKORgBngKOmC8U/1tbe2YJMzYQqDGYB4JCss7L8+RM2kKLb1B1Aw9BNA==",
"version": "5.8.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.8.1.tgz",
"integrity": "sha512-wTZ5oEKrKj/8/366qTM366zqhIKAp6NCMweoRONtfuC07OAU9nVI2GZZdqQ1qD30WAAtcPdkH+npDwtRFdp4Rw==",
"dev": true,
"requires": {
"@typescript-eslint/experimental-utils": "5.8.0",
"@typescript-eslint/scope-manager": "5.8.0",
"@typescript-eslint/experimental-utils": "5.8.1",
"@typescript-eslint/scope-manager": "5.8.1",
"debug": "^4.3.2",
"functional-red-black-tree": "^1.0.1",
"ignore": "^5.1.8",
@ -2586,55 +2586,55 @@
}
},
"@typescript-eslint/experimental-utils": {
"version": "5.8.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-5.8.0.tgz",
"integrity": "sha512-KN5FvNH71bhZ8fKtL+lhW7bjm7cxs1nt+hrDZWIqb6ViCffQcWyLunGrgvISgkRojIDcXIsH+xlFfI4RCDA0xA==",
"version": "5.8.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-5.8.1.tgz",
"integrity": "sha512-fbodVnjIDU4JpeXWRDsG5IfIjYBxEvs8EBO8W1+YVdtrc2B9ppfof5sZhVEDOtgTfFHnYQJDI8+qdqLYO4ceww==",
"dev": true,
"requires": {
"@types/json-schema": "^7.0.9",
"@typescript-eslint/scope-manager": "5.8.0",
"@typescript-eslint/types": "5.8.0",
"@typescript-eslint/typescript-estree": "5.8.0",
"@typescript-eslint/scope-manager": "5.8.1",
"@typescript-eslint/types": "5.8.1",
"@typescript-eslint/typescript-estree": "5.8.1",
"eslint-scope": "^5.1.1",
"eslint-utils": "^3.0.0"
}
},
"@typescript-eslint/parser": {
"version": "5.8.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.8.0.tgz",
"integrity": "sha512-Gleacp/ZhRtJRYs5/T8KQR3pAQjQI89Dn/k+OzyCKOsLiZH2/Vh60cFBTnFsHNI6WAD+lNUo/xGZ4NeA5u0Ipw==",
"version": "5.8.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.8.1.tgz",
"integrity": "sha512-K1giKHAjHuyB421SoXMXFHHVI4NdNY603uKw92++D3qyxSeYvC10CBJ/GE5Thpo4WTUvu1mmJI2/FFkz38F2Gw==",
"dev": true,
"requires": {
"@typescript-eslint/scope-manager": "5.8.0",
"@typescript-eslint/types": "5.8.0",
"@typescript-eslint/typescript-estree": "5.8.0",
"@typescript-eslint/scope-manager": "5.8.1",
"@typescript-eslint/types": "5.8.1",
"@typescript-eslint/typescript-estree": "5.8.1",
"debug": "^4.3.2"
}
},
"@typescript-eslint/scope-manager": {
"version": "5.8.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.8.0.tgz",
"integrity": "sha512-x82CYJsLOjPCDuFFEbS6e7K1QEWj7u5Wk1alw8A+gnJiYwNnDJk0ib6PCegbaPMjrfBvFKa7SxE3EOnnIQz2Gg==",
"version": "5.8.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.8.1.tgz",
"integrity": "sha512-DGxJkNyYruFH3NIZc3PwrzwOQAg7vvgsHsHCILOLvUpupgkwDZdNq/cXU3BjF4LNrCsVg0qxEyWasys5AiJ85Q==",
"dev": true,
"requires": {
"@typescript-eslint/types": "5.8.0",
"@typescript-eslint/visitor-keys": "5.8.0"
"@typescript-eslint/types": "5.8.1",
"@typescript-eslint/visitor-keys": "5.8.1"
}
},
"@typescript-eslint/types": {
"version": "5.8.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.8.0.tgz",
"integrity": "sha512-LdCYOqeqZWqCMOmwFnum6YfW9F3nKuxJiR84CdIRN5nfHJ7gyvGpXWqL/AaW0k3Po0+wm93ARAsOdzlZDPCcXg==",
"version": "5.8.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.8.1.tgz",
"integrity": "sha512-L/FlWCCgnjKOLefdok90/pqInkomLnAcF9UAzNr+DSqMC3IffzumHTQTrINXhP1gVp9zlHiYYjvozVZDPleLcA==",
"dev": true
},
"@typescript-eslint/typescript-estree": {
"version": "5.8.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.8.0.tgz",
"integrity": "sha512-srfeZ3URdEcUsSLbkOFqS7WoxOqn8JNil2NSLO9O+I2/Uyc85+UlfpEvQHIpj5dVts7KKOZnftoJD/Fdv0L7nQ==",
"version": "5.8.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.8.1.tgz",
"integrity": "sha512-26lQ8l8tTbG7ri7xEcCFT9ijU5Fk+sx/KRRyyzCv7MQ+rZZlqiDPtMKWLC8P7o+dtCnby4c+OlxuX1tp8WfafQ==",
"dev": true,
"requires": {
"@typescript-eslint/types": "5.8.0",
"@typescript-eslint/visitor-keys": "5.8.0",
"@typescript-eslint/types": "5.8.1",
"@typescript-eslint/visitor-keys": "5.8.1",
"debug": "^4.3.2",
"globby": "^11.0.4",
"is-glob": "^4.0.3",
@ -2643,12 +2643,12 @@
}
},
"@typescript-eslint/visitor-keys": {
"version": "5.8.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.8.0.tgz",
"integrity": "sha512-+HDIGOEMnqbxdAHegxvnOqESUH6RWFRR2b8qxP1W9CZnnYh4Usz6MBL+2KMAgPk/P0o9c1HqnYtwzVH6GTIqug==",
"version": "5.8.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.8.1.tgz",
"integrity": "sha512-SWgiWIwocK6NralrJarPZlWdr0hZnj5GXHIgfdm8hNkyKvpeQuFyLP6YjSIe9kf3YBIfU6OHSZLYkQ+smZwtNg==",
"dev": true,
"requires": {
"@typescript-eslint/types": "5.8.0",
"@typescript-eslint/types": "5.8.1",
"eslint-visitor-keys": "^3.0.0"
}
},
@ -2665,9 +2665,9 @@
"dev": true
},
"acorn": {
"version": "8.6.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.6.0.tgz",
"integrity": "sha512-U1riIR+lBSNi3IbxtaHOIKdH8sLFv3NYfNv8sg7ZsNhcfl4HF2++BfqqrNAxoCLQW1iiylOj76ecnaUxz+z9yw==",
"version": "8.7.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz",
"integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==",
"dev": true
},
"acorn-jsx": {

View File

@ -24,7 +24,7 @@
"license": "Apache-2.0",
"dependencies": {
"@actions/core": "^1.6.0",
"@google-github-actions/actions-utils": "^0.1.0"
"@google-github-actions/actions-utils": "^0.1.1"
},
"devDependencies": {
"@types/chai": "^4.3.0",

View File

@ -15,8 +15,10 @@ import {
import {
errorMessage,
exactlyOneOf,
isPinnedToHead,
parseCSV,
parseDuration,
pinnedToHeadWarning,
} from '@google-github-actions/actions-utils';
import { WorkloadIdentityClient } from './client/workload_identity_client';
@ -36,26 +38,13 @@ const oidcWarning =
`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`;
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.
*/
async function run(): Promise<void> {
// Warn if pinned to HEAD
if (process.env.GITHUB_ACTION_REF == 'main') {
logWarning(headWarning);
if (isPinnedToHead()) {
logWarning(pinnedToHeadWarning('v0'));
}
try {