File tree Expand file tree Collapse file tree 2 files changed +8
-7
lines changed
Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -26,14 +26,15 @@ jobs:
2626 - name : Install dependencies
2727 run : npm install
2828
29- # JWTトークンを取得
3029 - name : Generate OIDC Token
3130 id : get-jwt
3231 run : |
33- echo "JWT_TOKEN=$(curl -s -H 'Authorization: Bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN' \
34- -H 'Accept: application/json' \
35- https://vstoken.actions.githubusercontent.com/v1/token?audience=https://firestore-fzxwlwc6iq-an.a.run.app/forecast)" \
36- >> $GITHUB_ENV
32+ TOKEN=$(curl -s -H "Authorization: Bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \
33+ -H "Accept: application/json" \
34+ https://vstoken.actions.githubusercontent.com/v1/token?audience=https://firestore-fzxwlwc6iq-an.a.run.app/forecast)
35+ echo "JWT_TOKEN=$(echo $TOKEN | jq -r '.value')" >> $GITHUB_ENV
36+ env :
37+ ACTIONS_ID_TOKEN_REQUEST_TOKEN : ${{ secrets.GITHUB_TOKEN }}
3738
3839 # TypeScript ファイルを実行して外部APIを叩き、Firestore APIに送信
3940 - name : Run TypeScript File
Original file line number Diff line number Diff line change @@ -43,14 +43,14 @@ async function fetchData() {
4343 method : "POST" ,
4444 headers : {
4545 "Content-Type" : "application/json" ,
46- Auhtorization : `Bearer ${ jwtToken } ` ,
46+ Authorization : `Bearer ${ jwtToken } ` ,
4747 } ,
4848 body : JSON . stringify ( dataToSend ) ,
4949 } ) ;
5050 if ( ! res . ok ) {
5151 throw new Error ( `Failed to save data: ${ res . statusText } ` ) ;
5252 }
53- console . log ( "successfully saved to Firestore:" , res ) ;
53+ console . log ( "successfully saved to Firestore:" , await res . json ( ) ) ;
5454 } catch ( error ) {
5555 console . error ( "Error saving data:" , error ) ;
5656 process . exit ( 1 ) ;
You can’t perform that action at this time.
0 commit comments