-
Notifications
You must be signed in to change notification settings - Fork 8
/
action.yaml
48 lines (41 loc) · 1.44 KB
/
action.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
name: Configure AWS Profile
description: Configures an OIDC AWS Role Session as an aws config profile.
branding:
icon: 'cloud'
color: 'orange'
inputs:
role-arn:
required: true
description: 'ARN of the role to assume.'
profile-name:
required: true
description: 'Name of profile to be created.'
region:
required: false
description: 'Name of AWS region to be used.'
default: 'us-west-2'
runs:
using: "composite"
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ inputs.role-arn }}
aws-region: ${{ inputs.region }}
mask-aws-account-id: 'no'
- name: Setup Profile
shell: bash
run: |
aws configure set region ${{ inputs.region }} --profile ${{ inputs.profile-name }}
aws configure set aws_access_key_id ${{ env.AWS_ACCESS_KEY_ID }} --profile ${{ inputs.profile-name }}
aws configure set aws_secret_access_key ${{ env.AWS_SECRET_ACCESS_KEY }} --profile ${{ inputs.profile-name }}
aws configure set aws_session_token ${{ env.AWS_SESSION_TOKEN }} --profile ${{ inputs.profile-name }}
- name: Reset AWS Environment Variables
shell: bash
run: |
echo "AWS_ACCESS_KEY_ID=" >> $GITHUB_ENV
echo "AWS_SECRET_ACCESS_KEY=" >> $GITHUB_ENV
echo "AWS_SESSION_TOKEN=" >> $GITHUB_ENV
- name: Check Profile
shell: bash
run: aws sts get-caller-identity --profile ${{ inputs.profile-name }}