Use the GITHUB_SECRET to authenticate with the API
Fix the environment variable Add extra logging when using the authentication Use the GITHUB_TOKEN on the frontend build step
This commit is contained in:
		
							parent
							
								
									61eeb82694
								
							
						
					
					
						commit
						ca69d19bf7
					
				
							
								
								
									
										5
									
								
								.github/workflows/ci.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										5
									
								
								.github/workflows/ci.yml
									
									
									
									
										vendored
									
									
								
							| @ -55,8 +55,6 @@ jobs: | |||||||
|       - name: Build |       - name: Build | ||||||
|         run: npm run build |         run: npm run build | ||||||
|         working-directory: ${{ matrix.node }}/${{ matrix.flavor }}/backend |         working-directory: ${{ matrix.node }}/${{ matrix.flavor }}/backend | ||||||
|         env:  |  | ||||||
|           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |  | ||||||
| 
 | 
 | ||||||
|   frontend: |   frontend: | ||||||
|     if: "!contains(github.event.pull_request.labels.*.name, 'ops') && !contains(github.head_ref, 'ops/')" |     if: "!contains(github.event.pull_request.labels.*.name, 'ops') && !contains(github.head_ref, 'ops/')" | ||||||
| @ -101,3 +99,6 @@ jobs: | |||||||
|       - name: Build |       - name: Build | ||||||
|         run: npm run build |         run: npm run build | ||||||
|         working-directory: ${{ matrix.node }}/${{ matrix.flavor }}/frontend |         working-directory: ${{ matrix.node }}/${{ matrix.flavor }}/frontend | ||||||
|  |         env:  | ||||||
|  |           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||||||
|  | 
 | ||||||
|  | |||||||
| @ -26,6 +26,8 @@ try { | |||||||
|   } |   } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | const githubSecret = process.env.GITHUB_TOKEN; | ||||||
|  | 
 | ||||||
| function download(filename, url) { | function download(filename, url) { | ||||||
|   https.get(url, (response) => { |   https.get(url, (response) => { | ||||||
|     if (response.statusCode < 200 || response.statusCode > 299) { |     if (response.statusCode < 200 || response.statusCode > 299) { | ||||||
| @ -55,6 +57,12 @@ function downloadMiningPoolLogos$() { | |||||||
|       headers: {'user-agent': 'node.js'} |       headers: {'user-agent': 'node.js'} | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|  |     if (githubSecret) { | ||||||
|  |       console.log('Downloading the mining pool logos with authentication'); | ||||||
|  |       options.headers['authorization'] = `Bearer ${githubSecret}`; | ||||||
|  |       options.headers['X-GitHub-Api-Version'] = '2022-11-28'; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     https.get(options, (response) => { |     https.get(options, (response) => { | ||||||
|       const chunks_of_data = []; |       const chunks_of_data = []; | ||||||
| 
 | 
 | ||||||
| @ -109,6 +117,13 @@ function downloadPromoVideoSubtiles$() { | |||||||
|       headers: {'user-agent': 'node.js'} |       headers: {'user-agent': 'node.js'} | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|  |     if (githubSecret) { | ||||||
|  |       console.log('Downloading the promo video subtitles with authentication'); | ||||||
|  |       options.headers['authorization'] = `Bearer ${githubSecret}`; | ||||||
|  |       options.headers['X-GitHub-Api-Version'] = '2022-11-28'; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|     https.get(options, (response) => { |     https.get(options, (response) => { | ||||||
|       const chunks_of_data = []; |       const chunks_of_data = []; | ||||||
| 
 | 
 | ||||||
| @ -163,6 +178,12 @@ function downloadPromoVideo$() { | |||||||
|       headers: {'user-agent': 'node.js'} |       headers: {'user-agent': 'node.js'} | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|  |     if (githubSecret) { | ||||||
|  |       console.log('Downloading the promo videos with authentication'); | ||||||
|  |       options.headers['authorization'] = `Bearer ${githubSecret}`; | ||||||
|  |       options.headers['X-GitHub-Api-Version'] = '2022-11-28'; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     https.get(options, (response) => { |     https.get(options, (response) => { | ||||||
|       const chunks_of_data = []; |       const chunks_of_data = []; | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user