Fixes PR Cleanup

This commit is contained in:
2023-12-29 03:50:01 -03:00
parent e78328cdbf
commit 24947365a9
2 changed files with 6 additions and 6 deletions

View File

@@ -2,12 +2,11 @@ name: vercel-cleanup-pr
on:
pull_request:
types: [closed]
env:
VERCEL_CLI_TOKEN: ${{ secrets.VERCEL_CLI_TOKEN }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
GITHUB_PR_ID: ${{github.event.pull_request.number}}
GITHUB_PR_ID: ${{ github.event.number }}
jobs:
cleanup:
@@ -18,10 +17,11 @@ jobs:
closed_deployments=$(curl "https://api.vercel.com/v6/deployments?projectId=$VERCEL_PROJECT_ID" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${VERCEL_CLI_TOKEN}" | jq -r ".deployments[] | select(.meta.githubPrId == \"${GITHUB_PR_ID}\") | .uid")
echo "PR: $GITHUB_PR_ID"
for deployment in $closed_deployments; do
echo "Deleting Deployment: $deployment"
curl "https://api.vercel.com/v6/now/deployments/$deployment" \
-X DELETE \
-H "Authorization: Bearer ${VERCEL_CLI_TOKEN}"
# curl "https://api.vercel.com/v6/now/deployments/$deployment" \
# -X DELETE \
# -H "Authorization: Bearer ${VERCEL_CLI_TOKEN}"
done