File tree Expand file tree Collapse file tree 2 files changed +17
-13
lines changed
tools/spectral/ipa/metrics/utils Expand file tree Collapse file tree 2 files changed +17
-13
lines changed Original file line number Diff line number Diff line change 8
8
permissions :
9
9
issues : write
10
10
contents : write
11
+ id-token : write
11
12
12
13
jobs :
13
14
# Generates and uploads the IPA validation metrics to S3
@@ -40,10 +41,15 @@ jobs:
40
41
working-directory : tools/spectral/ipa/metrics/scripts
41
42
run : node runMetricCollection.js "${{ github.workspace }}/v2.json"
42
43
44
+ - name : aws configure
45
+ uses : aws-actions/configure-aws-credentials@v4
46
+ with :
47
+ role-to-assume : ${{ vars.IPA_METRIC_COLLECTION_AWS_S3_ROLE_TO_ASSUME_PROD }}
48
+ aws-region : ${{ vars.AWS_DEFAULT_REGION }}
49
+
43
50
- name : Dump Metric Collection Job Data to S3
44
51
env :
45
- AWS_ACCESS_KEY_ID : ${{ secrets.IPA_S3_BUCKET_DW_PROD_USERNAME }}
46
- AWS_SECRET_ACCESS_KEY : ${{ secrets.IPA_S3_BUCKET_DW_PROD_PASSWORD }}
52
+ AWS_REGION : ${{ vars.AWS_DEFAULT_REGION }}
47
53
S3_BUCKET_PREFIX : ${{ secrets.IPA_S3_BUCKET_DW_PROD_PREFIX }}
48
54
working-directory : tools/spectral/ipa/metrics/scripts
49
55
run : node dataDump.js
Original file line number Diff line number Diff line change @@ -10,9 +10,7 @@ function loadS3Config() {
10
10
}
11
11
return {
12
12
aws : {
13
- accessKeyId : process . env . AWS_ACCESS_KEY_ID ,
14
- secretAccessKey : process . env . AWS_SECRET_ACCESS_KEY ,
15
- region : 'us-east-1' ,
13
+ region : process . env . AWS_REGION ,
16
14
} ,
17
15
s3 : {
18
16
prefix : process . env . S3_BUCKET_PREFIX ,
@@ -29,14 +27,14 @@ export function getS3FilePath() {
29
27
return { bucketName, key } ;
30
28
}
31
29
30
+ /**
31
+ * Gets an S3 client configured to use AssumeRole credentials
32
+ * @returns {S3Client } Configured S3 client
33
+ */
32
34
export function getS3Client ( ) {
33
- const AWSConfig = loadS3Config ( ) ;
35
+ const S3Config = loadS3Config ( ) ;
34
36
35
- return new S3Client ( {
36
- credentials : {
37
- accessKeyId : AWSConfig . aws . accessKeyId ,
38
- secretAccessKey : AWSConfig . aws . secretAccessKey ,
39
- } ,
40
- region : AWSConfig . aws . region ,
41
- } ) ;
37
+ // When running in GitHub Actions with aws-actions/configure-aws-credentials,
38
+ // the SDK will automatically use the credentials from the environment
39
+ return new S3Client ( { region : S3Config . aws . region } ) ;
42
40
}
You can’t perform that action at this time.
0 commit comments