-
Notifications
You must be signed in to change notification settings - Fork 0
38 lines (31 loc) · 1.04 KB
/
main.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
31
32
33
34
35
36
37
38
name: Fetch Secrets from AWS Secrets Manager
on:
workflow_dispatch:
permissions:
id-token: write
contents: read
jobs:
fetch-secrets:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Configure AWS credentials from OIDC
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.ROLE_ARN }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Fetch secret from AWS Secrets Manager
id: fetch-secret
run: |
secret_value=$(aws secretsmanager get-secret-value --secret-id ${{ secrets.SECRET_NAME }} --query SecretString --output text)
echo "::add-mask::$secret_value"
echo "SECRET_VALUE=$secret_value" >> $GITHUB_ENV
- name: Set up Python environment
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Run Python script with API secret
run: python3 github-api.py
env:
API_SECRET: ${{ env.SECRET_VALUE }}