-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
30 lines (27 loc) · 1.21 KB
/
action.yml
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
name: Generate GitHub Access Tokens
description: Generates a GitHub access token using a custom API endpoint (with SigV4 authentication) and assigns the GitHub access token to an environment variable.
inputs:
invoke-url:
description: URL of the custom API endpoint (with SigV4 authentication)
required: true
region:
description: AWS region of the custom API endpoint
required: true
configuration-name:
description: Name of the configuration passed to custom API endpoint as well as the name of the environment variable to which the access token will be assigned
required: true
runs:
using: composite
steps:
- name: Generate GitHub access token and assign it to environment variable
shell: bash
run: |
curl \
--fail \
--user "${{ env.AWS_ACCESS_KEY_ID }}":"${{ env.AWS_SECRET_ACCESS_KEY }}" \
--aws-sigv4 "aws:amz:${{ inputs.region }}:execute-api" \
-X POST \
-H "x-amz-security-token: ${{ env.AWS_SESSION_TOKEN }}" \
${{ inputs.invoke-url }}/configurations/${{ inputs.configuration-name }}/github-access-tokens \
| jq -r '"echo \"${{ inputs.configuration-name }}=\(.token)\" >> $GITHUB_ENV"' \
| bash