Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .github/workflows/tophat-build-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
name: Tophat Build Request

# Triggers tophat build in oasis-frontend for each PR
# This allows PRs to be tested on the staging environment

on:
pull_request:
types: [opened, synchronize]
paths:
- '**'

jobs:
notify:
name: 'Trigger Tophat 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 oasis-frontend Tophat Build
env:
BUILDKITE_BEARER: ${{ secrets.BUILDKITE_BEARER }}
BUILDKITE_PIPELINE: ${{ secrets.BUILDKITE_PIPELINE }}
run: |
echo "🚀 Triggering tophat 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": "Tophat 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 "✅ Tophat build triggered"

- name: Comment on PR
uses: mshick/add-pr-comment@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
message: |
### :tophat: To tophat this PR:

You can add the following URL parameter to your browser to tophat this PR:

`?tophat_location=${{ steps.pr_info.outputs.branch }}/${{ steps.pr_info.outputs.sha }}`

---
Loading