Skip to content

Revert "Bump the npm_and_yarn group across 1 directory with 4 updates" #3

Revert "Bump the npm_and_yarn group across 1 directory with 4 updates"

Revert "Bump the npm_and_yarn group across 1 directory with 4 updates" #3

name: Supabase Preview Branch
on:
pull_request:
types:
- opened
- reopened
- synchronize
- closed
jobs:
create-preview-branch:
name: Create Supabase Preview Branch
runs-on: ubuntu-latest
if: github.event.action != 'closed'
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- uses: supabase/setup-cli@v1
with:
version: latest
- name: Create Supabase Preview Branch
run: |
if [ -z "$SUPABASE_ACCESS_TOKEN" ]; then
echo "SUPABASE_ACCESS_TOKEN is not set, skipping branch creation."
exit 0
fi
supabase --experimental branches create \
--project-ref vhgwvfedgfmcixhdyttt \
--name "${{ github.head_ref }}" || \
echo "Branch creation failed or branch already exists, continuing..."
env:
SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}
delete-preview-branch:
name: Delete Supabase Preview Branch
runs-on: ubuntu-latest
if: github.event.action == 'closed'
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- uses: supabase/setup-cli@v1
with:
version: latest
- name: Delete Supabase Preview Branch
run: |
if [ -z "$SUPABASE_ACCESS_TOKEN" ]; then
echo "SUPABASE_ACCESS_TOKEN is not set, skipping branch deletion."
exit 0
fi
BRANCH_NAME="${{ github.head_ref }}"
BRANCH_ID=$(supabase --experimental branches list \
--project-ref vhgwvfedgfmcixhdyttt \
--output json 2>/dev/null | \
jq -r --arg name "$BRANCH_NAME" '.[] | select(.name == $name) | .id' 2>/dev/null || true)
if [ -n "$BRANCH_ID" ]; then
supabase --experimental branches delete "$BRANCH_ID" \
--project-ref vhgwvfedgfmcixhdyttt || true
else
echo "No Supabase branch found for git branch: $BRANCH_NAME"
fi
env:
SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}