Support newline-separated inputs for delegates and access_token_scopes (#381)

Fixes #380
This commit is contained in:
Seth Vargo 2024-01-08 17:24:50 -05:00 committed by GitHub
parent fb74905737
commit a57dd04655
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 235 additions and 573 deletions

View File

@ -165,6 +165,8 @@ default, this action does not generate any tokens.
https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/cloud-platform
``` ```
This can be specified as a comma-separated or newline-separated list.
- `access_token_subject`: (Optional) Email address of a user to impersonate - `access_token_subject`: (Optional) Email address of a user to impersonate
for [Domain-Wide Delegation][dwd]. Access tokens created for Domain-Wide for [Domain-Wide Delegation][dwd]. Access tokens created for Domain-Wide
Delegation cannot have a lifetime beyond 1 hour, even if the Delegation cannot have a lifetime beyond 1 hour, even if the
@ -277,7 +279,8 @@ regardless of the authentication mechanism.
- `delegates`: (Optional) List of additional service account emails or unique - `delegates`: (Optional) List of additional service account emails or unique
identities to use for impersonation in the chain. By default there are no identities to use for impersonation in the chain. By default there are no
delegates. delegates. This can be specified as a comma-separated or newline-separated
list.
- `universe`: (Optional) The Google Cloud universe to use for constructing API - `universe`: (Optional) The Google Cloud universe to use for constructing API
endpoints. The default universe is "googleapis.com", which corresponds to endpoints. The default universe is "googleapis.com", which corresponds to

6
dist/main/index.js vendored

File diff suppressed because one or more lines are too long

6
dist/post/index.js vendored

File diff suppressed because one or more lines are too long

765
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -25,18 +25,18 @@
"dependencies": { "dependencies": {
"@actions/core": "^1.10.1", "@actions/core": "^1.10.1",
"@actions/http-client": "^2.2.0", "@actions/http-client": "^2.2.0",
"@google-github-actions/actions-utils": "^0.4.10" "@google-github-actions/actions-utils": "^0.5.2"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^20.10.0", "@types/node": "^20.10.7",
"@typescript-eslint/eslint-plugin": "^6.12.0", "@typescript-eslint/eslint-plugin": "^6.18.0",
"@typescript-eslint/parser": "^6.12.0", "@typescript-eslint/parser": "^6.18.0",
"@vercel/ncc": "^0.38.1", "@vercel/ncc": "^0.38.1",
"eslint": "^8.54.0", "eslint": "^8.56.0",
"eslint-config-prettier": "^9.0.0", "eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.0.1", "eslint-plugin-prettier": "^5.1.2",
"prettier": "^3.1.0", "prettier": "^3.1.1",
"ts-node": "^10.9.1", "ts-node": "^10.9.2",
"typescript": "^5.3.2" "typescript": "^5.3.3"
} }
} }

View File

@ -28,7 +28,7 @@ import {
exactlyOneOf, exactlyOneOf,
isEmptyDir, isEmptyDir,
isPinnedToHead, isPinnedToHead,
parseCSV, parseMultilineCSV,
parseDuration, parseDuration,
pinnedToHeadWarning, pinnedToHeadWarning,
withRetries, withRetries,
@ -111,7 +111,7 @@ async function main(logger: Logger) {
const createCredentialsFile = getBooleanInput(`create_credentials_file`); const createCredentialsFile = getBooleanInput(`create_credentials_file`);
const exportEnvironmentVariables = getBooleanInput(`export_environment_variables`); const exportEnvironmentVariables = getBooleanInput(`export_environment_variables`);
const tokenFormat = getInput(`token_format`); const tokenFormat = getInput(`token_format`);
const delegates = parseCSV(getInput(`delegates`)); const delegates = parseMultilineCSV(getInput(`delegates`));
const universe = getInput(`universe`); const universe = getInput(`universe`);
// Ensure exactly one of workload_identity_provider and credentials_json was // Ensure exactly one of workload_identity_provider and credentials_json was
@ -270,7 +270,7 @@ async function main(logger: Logger) {
logger.debug(`Creating access token`); logger.debug(`Creating access token`);
const accessTokenLifetime = parseDuration(getInput('access_token_lifetime')); const accessTokenLifetime = parseDuration(getInput('access_token_lifetime'));
const accessTokenScopes = parseCSV(getInput('access_token_scopes')); const accessTokenScopes = parseMultilineCSV(getInput('access_token_scopes'));
const accessTokenSubject = getInput('access_token_subject'); const accessTokenSubject = getInput('access_token_subject');
// Ensure a service_account was provided if using WIF. // Ensure a service_account was provided if using WIF.