Skip to content

feat: v2 - consolidated esc behavior in editor #808

feat: v2 - consolidated esc behavior in editor

feat: v2 - consolidated esc behavior in editor #808

---
name: Preview Build
# Triggers a preview build for each PR
# This allows PRs to be tested on the preview environment
on:
pull_request:
types: [opened, synchronize]
paths:
- '**'
concurrency:
group: preview-build-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
notify:
name: 'Trigger Preview Build'
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Get PR Info
id: pr_info
run: |
echo "branch=${{ github.head_ref }}" >> $GITHUB_OUTPUT
echo "pr_number=${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT
echo "sha=$(echo '${{ github.event.pull_request.head.sha }}' | cut -c1-7)" >> $GITHUB_OUTPUT
- name: Trigger Preview Build
env:
BUILDKITE_BEARER: ${{ secrets.BUILDKITE_BEARER }}
BUILDKITE_PIPELINE: ${{ secrets.BUILDKITE_PIPELINE }}
run: |
echo "🚀 Triggering preview build for branch: ${{ steps.pr_info.outputs.branch }}"
echo "PR: #${{ steps.pr_info.outputs.pr_number }}"
curl -s -o /dev/null -w "%{http_code}" \
-H "Authorization: Bearer $BUILDKITE_BEARER" \
-X POST "https://api.buildkite.com/v2/organizations/$BUILDKITE_PIPELINE/builds" \
-H "Content-Type: application/json" \
-d '{
"commit": "HEAD",
"code": "curl",
"branch": "main",
"message": "Preview build for PR #${{ steps.pr_info.outputs.pr_number }}",
"author": {
"name": "Tangle-UI Workflow",
"email": "ci@tangleml.com"
},
"env": {
"TOPHAT_BRANCH": "${{ steps.pr_info.outputs.branch }}"
}
}' || echo "Note: Buildkite trigger may need configuration"
echo "✅ Preview build triggered"
- name: Comment on PR
uses: mshick/add-pr-comment@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
message: |
### :tophat: Preview
A preview build has been created at: `${{ steps.pr_info.outputs.branch }}/${{ steps.pr_info.outputs.sha }}`