Fixes PR Cleanup
This commit is contained in:
10
.github/workflows/vercel-cleanup-pr.yml
vendored
10
.github/workflows/vercel-cleanup-pr.yml
vendored
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user