Skip to content

feat: cross-repo cloud preview dispatch on PRs #1

feat: cross-repo cloud preview dispatch on PRs

feat: cross-repo cloud preview dispatch on PRs #1

Workflow file for this run

name: Cloud Preview
on:
pull_request:
types: [opened, synchronize, reopened, closed]
jobs:
dispatch-deploy:
name: Trigger Cloud Preview
if: github.event.action != 'closed'
runs-on: ubuntu-latest
steps:
- name: Dispatch preview deploy
uses: actions/github-script@v7
with:
github-token: ${{ secrets.CLOUD_DISPATCH_TOKEN }}
script: |
await github.rest.actions.createWorkflowDispatch({
owner: 'AgentWorkforce',
repo: 'cloud',
workflow_id: 'preview-relayauth.yml',
ref: 'main',
inputs: {
pr_number: String(context.payload.pull_request.number),
head_sha: context.payload.pull_request.head.sha,
source_repo: context.payload.repository.full_name,
action: 'deploy',
},
});
dispatch-cleanup:
name: Cleanup Cloud Preview
if: github.event.action == 'closed'
runs-on: ubuntu-latest
steps:
- name: Dispatch preview cleanup
uses: actions/github-script@v7
with:
github-token: ${{ secrets.CLOUD_DISPATCH_TOKEN }}
script: |
await github.rest.actions.createWorkflowDispatch({
owner: 'AgentWorkforce',
repo: 'cloud',
workflow_id: 'preview-relayauth.yml',
ref: 'main',
inputs: {
pr_number: String(context.payload.pull_request.number),
head_sha: context.payload.pull_request.head.sha,
source_repo: context.payload.repository.full_name,
action: 'cleanup',
},
});