mirror of
https://github.com/aws-actions/configure-aws-credentials.git
synced 2026-06-05 21:17:05 +00:00
Use json for input to custom-tags, add documentation for custom-tags
This commit is contained in:
parent
560bddf06c
commit
ba1ab7fb3b
3 changed files with 8 additions and 6 deletions
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
name: '"Configure AWS Credentials" Action for GitHub Actions'
|
||||
description: Configures AWS credentials for use in subsequent steps in a GitHub Action workflow
|
||||
runs:
|
||||
|
|
@ -101,6 +100,12 @@ inputs:
|
|||
action-timeout-s:
|
||||
required: false
|
||||
description: A global timeout in seconds for the action. When the timeout is reached, the action immediately exits. The default is to run without a timeout.
|
||||
custom-tags:
|
||||
description: >-
|
||||
Additional tags to apply to the assumed role session. Must be a JSON object provided using toJSON.
|
||||
Example: custom-tags: ${{ toJSON({ Environment: 'Production', Team: 'DevOps' }) }}
|
||||
You can include secrets: custom-tags: ${{ toJSON({ Team: secrets.TEAM_NAME }) }}
|
||||
required: false
|
||||
|
||||
outputs:
|
||||
aws-account-id:
|
||||
|
|
|
|||
|
|
@ -45,10 +45,7 @@ export async function run() {
|
|||
const proxyServer = core.getInput('http-proxy', { required: false }) || process.env.HTTP_PROXY;
|
||||
const customTagsInput = core.getInput('custom-tags', { required: false });
|
||||
const customTags = customTagsInput
|
||||
? (typeof customTagsInput === 'string' && customTagsInput.trim().startsWith('{')
|
||||
? Object.entries(JSON.parse(customTagsInput))
|
||||
: Object.entries(customTagsInput)
|
||||
).map(([Key, Value]) => ({ Key, Value: String(Value) }))
|
||||
? Object.entries(JSON.parse(customTagsInput)).map(([Key, Value]) => ({ Key, Value: String(Value) }))
|
||||
: [];
|
||||
const inlineSessionPolicy = core.getInput('inline-session-policy', { required: false });
|
||||
const managedSessionPolicies = core.getMultilineInput('managed-session-policies', { required: false }).map((p) => {
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ const inputs = {
|
|||
'aws-secret-access-key': 'MYAWSSECRETACCESSKEY',
|
||||
'role-to-assume': 'arn:aws:iam::111111111111:role/MY-ROLE',
|
||||
'aws-region': 'fake-region-1',
|
||||
'custom-tags': { Environment: 'Production', Team: 'DevOps' },
|
||||
'custom-tags': JSON.stringify({ Environment: 'Production', Team: 'DevOps' }),
|
||||
},
|
||||
IAM_USER_INPUTS: {
|
||||
'aws-access-key-id': 'MYAWSACCESSKEYID',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue