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:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
types: [closed]
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
VERCEL_CLI_TOKEN: ${{ secrets.VERCEL_CLI_TOKEN }}
|
VERCEL_CLI_TOKEN: ${{ secrets.VERCEL_CLI_TOKEN }}
|
||||||
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
|
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
|
||||||
GITHUB_PR_ID: ${{github.event.pull_request.number}}
|
GITHUB_PR_ID: ${{ github.event.number }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
cleanup:
|
cleanup:
|
||||||
@@ -18,10 +17,11 @@ jobs:
|
|||||||
closed_deployments=$(curl "https://api.vercel.com/v6/deployments?projectId=$VERCEL_PROJECT_ID" \
|
closed_deployments=$(curl "https://api.vercel.com/v6/deployments?projectId=$VERCEL_PROJECT_ID" \
|
||||||
-H "Accept: application/json" \
|
-H "Accept: application/json" \
|
||||||
-H "Authorization: Bearer ${VERCEL_CLI_TOKEN}" | jq -r ".deployments[] | select(.meta.githubPrId == \"${GITHUB_PR_ID}\") | .uid")
|
-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
|
for deployment in $closed_deployments; do
|
||||||
echo "Deleting Deployment: $deployment"
|
echo "Deleting Deployment: $deployment"
|
||||||
curl "https://api.vercel.com/v6/now/deployments/$deployment" \
|
# curl "https://api.vercel.com/v6/now/deployments/$deployment" \
|
||||||
-X DELETE \
|
# -X DELETE \
|
||||||
-H "Authorization: Bearer ${VERCEL_CLI_TOKEN}"
|
# -H "Authorization: Bearer ${VERCEL_CLI_TOKEN}"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ on:
|
|||||||
env:
|
env:
|
||||||
VERCEL_CLI_TOKEN: ${{ secrets.VERCEL_CLI_TOKEN }}
|
VERCEL_CLI_TOKEN: ${{ secrets.VERCEL_CLI_TOKEN }}
|
||||||
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
|
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
|
||||||
GIT_PREVIOS_COMMIT: ${{github.event.before}}
|
GIT_PREVIOS_COMMIT: ${{ github.event.before }}
|
||||||
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|||||||
Reference in New Issue
Block a user