fix gh-actions
This commit is contained in:
92
.github/workflows/cloudflare-pages.yml
vendored
92
.github/workflows/cloudflare-pages.yml
vendored
@ -110,49 +110,49 @@ jobs:
|
|||||||
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
|
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
|
||||||
wranglerVersion: '3'
|
wranglerVersion: '3'
|
||||||
|
|
||||||
# cleanup:
|
cleanup:
|
||||||
# needs: deploy
|
needs: deploy
|
||||||
# runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
# if: success()
|
if: success()
|
||||||
# steps:
|
steps:
|
||||||
# - name: Cleanup old deployments
|
- name: Cleanup old deployments
|
||||||
# run: |
|
run: |
|
||||||
# curl -X PATCH \
|
curl -X PATCH \
|
||||||
# "https://api.cloudflare.com/client/v4/accounts/${{ secrets.CLOUDFLARE_ACCOUNT_ID }}/pages/projects/${{ secrets.CLOUDFLARE_PROJECT_NAME }} \
|
"https://api.cloudflare.com/client/v4/accounts/${{ secrets.CLOUDFLARE_ACCOUNT_ID }}/pages/projects/${{ secrets.CLOUDFLARE_PROJECT_NAME }}" \
|
||||||
# -H "Authorization: Bearer ${{ secrets.CLOUDFLARE_API_TOKEN }}" \
|
-H "Authorization: Bearer ${{ secrets.CLOUDFLARE_API_TOKEN }}" \
|
||||||
# -H "Content-Type: application/json")
|
-H "Content-Type: application/json" \
|
||||||
# -d "{ \"deployment_configs\": { \"production\": { \"deployment_retention\": ${{ env.KEEP_DEPLOYMENTS }} } } }"
|
-d "{ \"deployment_configs\": { \"production\": { \"deployment_retention\": ${{ env.KEEP_DEPLOYMENTS }} } } }"
|
||||||
# # Get all deployments
|
# Get all deployments
|
||||||
# DEPLOYMENTS=$(curl -s -X GET \
|
DEPLOYMENTS=$(curl -s -X GET \
|
||||||
# "https://api.cloudflare.com/client/v4/accounts/${{ secrets.CLOUDFLARE_ACCOUNT_ID }}/pages/projects/${{ secrets.CLOUDFLARE_PROJECT_NAME }}/deployments" \
|
"https://api.cloudflare.com/client/v4/accounts/${{ secrets.CLOUDFLARE_ACCOUNT_ID }}/pages/projects/${{ secrets.CLOUDFLARE_PROJECT_NAME }}/deployments" \
|
||||||
# -H "Authorization: Bearer ${{ secrets.CLOUDFLARE_API_TOKEN }}" \
|
-H "Authorization: Bearer ${{ secrets.CLOUDFLARE_API_TOKEN }}" \
|
||||||
# -H "Content-Type: application/json")
|
-H "Content-Type: application/json")
|
||||||
#
|
|
||||||
# # Extract deployment IDs (skip the latest N deployments)
|
# Extract deployment IDs (skip the latest N deployments)
|
||||||
# DEPLOYMENT_IDS=$(echo "$DEPLOYMENTS" | jq -r ".result | sort_by(.created_on) | reverse | .[${{ env.KEEP_DEPLOYMENTS }}:] | .[].id // empty")
|
DEPLOYMENT_IDS=$(echo "$DEPLOYMENTS" | jq -r ".result | sort_by(.created_on) | reverse | .[${{ env.KEEP_DEPLOYMENTS }}:] | .[].id // empty")
|
||||||
#
|
|
||||||
# if [ -z "$DEPLOYMENT_IDS" ]; then
|
if [ -z "$DEPLOYMENT_IDS" ]; then
|
||||||
# echo "No old deployments to delete"
|
echo "No old deployments to delete"
|
||||||
# exit 0
|
exit 0
|
||||||
# fi
|
fi
|
||||||
#
|
|
||||||
# # Delete old deployments
|
# Delete old deployments
|
||||||
# for ID in $DEPLOYMENT_IDS; do
|
for ID in $DEPLOYMENT_IDS; do
|
||||||
# echo "Deleting deployment: $ID"
|
echo "Deleting deployment: $ID"
|
||||||
# RESPONSE=$(curl -s -X DELETE \
|
RESPONSE=$(curl -s -X DELETE \
|
||||||
# "https://api.cloudflare.com/client/v4/accounts/${{ secrets.CLOUDFLARE_ACCOUNT_ID }}/pages/projects/${{ secrets.CLOUDFLARE_PROJECT_NAME }}/deployments/$ID" \
|
"https://api.cloudflare.com/client/v4/accounts/${{ secrets.CLOUDFLARE_ACCOUNT_ID }}/pages/projects/${{ secrets.CLOUDFLARE_PROJECT_NAME }}/deployments/$ID" \
|
||||||
# -H "Authorization: Bearer ${{ secrets.CLOUDFLARE_API_TOKEN }}" \
|
-H "Authorization: Bearer ${{ secrets.CLOUDFLARE_API_TOKEN }}" \
|
||||||
# -H "Content-Type: application/json")
|
-H "Content-Type: application/json")
|
||||||
#
|
|
||||||
# SUCCESS=$(echo "$RESPONSE" | jq -r '.success')
|
SUCCESS=$(echo "$RESPONSE" | jq -r '.success')
|
||||||
# if [ "$SUCCESS" = "true" ]; then
|
if [ "$SUCCESS" = "true" ]; then
|
||||||
# echo "Successfully deleted deployment: $ID"
|
echo "Successfully deleted deployment: $ID"
|
||||||
# else
|
else
|
||||||
# echo "Failed to delete deployment: $ID"
|
echo "Failed to delete deployment: $ID"
|
||||||
# echo "$RESPONSE" | jq .
|
echo "$RESPONSE" | jq .
|
||||||
# fi
|
fi
|
||||||
#
|
|
||||||
# sleep 1 # Rate limiting
|
sleep 1 # Rate limiting
|
||||||
# done
|
done
|
||||||
#
|
|
||||||
# echo "Cleanup completed!"
|
echo "Cleanup completed!"
|
||||||
|
Reference in New Issue
Block a user