Skip to content

fix: moved query only client side, removed error for unauthorized page; #954

fix: moved query only client side, removed error for unauthorized page;

fix: moved query only client side, removed error for unauthorized page; #954

name: Unassign preview-domain
on:
# Trigger when a pull request is closed
pull_request:
types: [closed]
permissions:
contents: read
jobs:
unassign-preview-domain:
runs-on: ubuntu-latest
steps:
- name: Prepare domain
id: prepare
uses: actions/[email protected]
with:
script: |
const subdomain = `${{ github.head_ref }}`
.slice(0, 32)
// Remove any trailing non-alphanumeric characters
.replace(/[^a-zA-Z0-9](?=[^a-zA-Z0-9]*$)/, '')
const domain = `${subdomain}.${{ vars.PREVIEW_DOMAIN }}`
.toLowerCase()
.replaceAll("_","-")
core.setOutput('domain', domain)
- name: Unssign preview-domain
run: |
curl -sX DELETE "https://vercel.com/api/v10/projects/${{ secrets.VERCEL_PROJECT_ID }}/domains/${{ steps.prepare.outputs.domain }}?teamId=${{ secrets.VERCEL_TEAM_ID }}" \
-H "Authorization: Bearer ${{ secrets.VERCEL_BEARER_TOKEN }}" \
-H "Content-Type: application/json"