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 88permissions :
99  issues : write 
1010  contents : write 
11+   id-token : write 
1112
1213jobs :
1314  #  Generates and uploads the IPA validation metrics to S3
@@ -40,10 +41,15 @@ jobs:
4041        working-directory : tools/spectral/ipa/metrics/scripts 
4142        run : node runMetricCollection.js "${{ github.workspace }}/v2.json" 
4243
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+ 
4350      - name : Dump Metric Collection Job Data to S3 
4451        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 }} 
4753          S3_BUCKET_PREFIX : ${{ secrets.IPA_S3_BUCKET_DW_PROD_PREFIX }} 
4854        working-directory : tools/spectral/ipa/metrics/scripts 
4955        run : node dataDump.js 
Original file line number Diff line number Diff line change @@ -10,9 +10,7 @@ function loadS3Config() {
1010  } 
1111  return  { 
1212    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 , 
1614    } , 
1715    s3 : { 
1816      prefix : process . env . S3_BUCKET_PREFIX , 
@@ -29,14 +27,14 @@ export function getS3FilePath() {
2927  return  {  bucketName,  key } ; 
3028} 
3129
30+ /** 
31+  * Gets an S3 client configured to use AssumeRole credentials 
32+  * @returns  {S3Client } Configured S3 client 
33+  */ 
3234export  function  getS3Client ( )  { 
33-   const  AWSConfig  =  loadS3Config ( ) ; 
35+   const  S3Config  =  loadS3Config ( ) ; 
3436
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  } ) ; 
4240} 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments