chore(deps-dev): bump happy-dom from 15.11.6 to 18.0.1 #124
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Delete Cloudflare Pages Preview Deployment | |
| on: | |
| pull_request: | |
| types: [closed] | |
| jobs: | |
| delete-preview-deployment: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Generate bot token | |
| uses: actions/create-github-app-token@v1 | |
| id: app_token | |
| with: | |
| app-id: ${{ secrets.BOT_ID }} | |
| private-key: ${{ secrets.BOT_SK }} | |
| - name: Get branch name | |
| id: get-branch | |
| run: echo "branch=$(gh pr view $PR_NO --repo $REPO --json headRefName --jq '.headRefName')" >> $GITHUB_OUTPUT | |
| env: | |
| REPO: ${{ github.repository }} | |
| PR_NO: ${{ github.event.pull_request.number }} | |
| GITHUB_TOKEN: ${{ steps.app_token.outputs.token }} | |
| - name: Delete Cloudflare Pages preview deployments | |
| run: | | |
| deployment_ids=$( | |
| ACCOUNT_ID=${{ secrets.CF_ACCOUNT_ID }} \ | |
| AUTH_TOKEN=${{ secrets.CLOUDFLARE_API_TOKEN }} \ | |
| PROJECT=${{ github.event.repository.name }} \ | |
| DEPLOY_BRANCH="${{ steps.get-branch.outputs.branch }}" \ | |
| bash -c ' | |
| PAGE=1 | |
| DEPLOYMENT_IDS="" | |
| while true; do | |
| response=$(curl -s -X GET "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/pages/projects/$PROJECT/deployments?page=$PAGE" \ | |
| -H "Authorization: Bearer $AUTH_TOKEN" \ | |
| -H "Content-Type: application/json") | |
| page_ids=$(echo "$response" | jq -r --arg DEPLOY_BRANCH "$DEPLOY_BRANCH" '"'"'.result[] | select(.deployment_trigger.metadata.branch == $DEPLOY_BRANCH) | .id'"'"') | |
| DEPLOYMENT_IDS+=" $page_ids" | |
| count=$(echo "$response" | jq -r .result_info.count) | |
| if [ "$count" -eq "0" ]; then | |
| break | |
| fi | |
| PAGE=$((PAGE + 1)) | |
| done | |
| echo "$DEPLOYMENT_IDS" | xargs | |
| ' | |
| ) | |
| for deployment_id in $deployment_ids; do | |
| echo "Deleting deployment $deployment_id" | |
| curl -s -X DELETE "https://api.cloudflare.com/client/v4/accounts/${{ secrets.CF_ACCOUNT_ID }}/pages/projects/${{ github.event.repository.name }}/deployments/$deployment_id?force=true" \ | |
| -H "Authorization: Bearer ${{ secrets.CLOUDFLARE_API_TOKEN }}" \ | |
| -H "Content-Type: application/json" | |
| done |