@@ -14,11 +14,32 @@ jobs:
1414 - name : Install dependencies
1515 run : npm ci && npx playwright install --with-deps
1616
17+ - name : Fetch Required Secrets from Vercel API
18+ id : fetch-secrets
19+ run : |
20+ # Fetch Vercel Project ID
21+ VERCEL_PROJECT_ID=$(curl -s -X GET "https://api.vercel.com/v9/projects" \
22+ -H "Authorization: Bearer $(curl -s "https://api.vercel.com/v9/projects/drpcrd-staging/env" | jq -r '.envs[] | select(.key=="VERCEL_API_KEY") | .value')" \
23+ | jq -r '.projects[] | select(.name=="drpcrd-staging") | .id')
24+
25+ # Fetch Vercel API Key
26+ VERCEL_API_KEY=$(curl -s "https://api.vercel.com/v9/projects/$VERCEL_PROJECT_ID/env" \
27+ | jq -r '.envs[] | select(.key=="VERCEL_API_KEY") | .value')
28+
29+ # Fetch PandaDoc API Key
30+ PANDADOC_API_KEY=$(curl -s "https://api.vercel.com/v9/projects/$VERCEL_PROJECT_ID/env" \
31+ | jq -r '.envs[] | select(.key=="PANDADOC_API_KEY") | .value')
32+
33+ # Export to GitHub Actions env
34+ echo "VERCEL_PROJECT_ID=$VERCEL_PROJECT_ID" >> $GITHUB_ENV
35+ echo "VERCEL_API_KEY=$VERCEL_API_KEY" >> $GITHUB_ENV
36+ echo "PANDADOC_API_KEY=$PANDADOC_API_KEY" >> $GITHUB_ENV
37+
1738 - name : Create PandaDoc Webhook (drpcrd-staging)
1839 id : pandadoc-webhook
1940 run : |
2041 RESPONSE=$(curl -X POST "https://api.pandadoc.com/public/v1/webhooks" \
21- -H "Authorization: Bearer ${{ secrets. PANDADOC_API_KEY }} " \
42+ -H "Authorization: Bearer $PANDADOC_API_KEY" \
2243 -H "Content-Type: application/json" \
2344 -d '{
2445 "name": "drpcrd-staging",
4061
4162 - name : Store PandaDoc Webhook Key in Vercel
4263 run : |
43- curl -X PATCH "https://api.vercel.com/v9/projects/${{ secrets. VERCEL_PROJECT_ID }} /env/PANDADOC_WEBHOOK_SHARED_KEY" \
44- -H "Authorization: Bearer ${{ secrets. VERCEL_API_KEY }} " \
64+ curl -X PATCH "https://api.vercel.com/v9/projects/$VERCEL_PROJECT_ID/env/PANDADOC_WEBHOOK_SHARED_KEY" \
65+ -H "Authorization: Bearer $VERCEL_API_KEY" \
4566 -H "Content-Type: application/json" \
4667 -d '{
4768 "value": "'${{ env.PANDADOC_WEBHOOK_SHARED_KEY }}'",
@@ -51,10 +72,10 @@ jobs:
5172 - name : Restart Vercel Deployment to Load Env Variables
5273 run : |
5374 curl -X POST "https://api.vercel.com/v13/deployments" \
54- -H "Authorization: Bearer ${{ secrets. VERCEL_API_KEY }} " \
75+ -H "Authorization: Bearer $VERCEL_API_KEY" \
5576 -H "Content-Type: application/json" \
5677 -d '{
57- "name": "${{ secrets.VERCEL_PROJECT_ID }} ",
78+ "name": "drpcrd-staging ",
5879 "target": "staging"
5980 }'
6081
0 commit comments