mirror of
https://github.com/pockethost/pockethost.git
synced 2025-11-24 14:35:49 +00:00
chore(root): Add dashboard preview links to PRs
This commit is contained in:
parent
d5e850041e
commit
2e4ae1f417
35
.github/workflows/publish-dashboard.yaml
vendored
35
.github/workflows/publish-dashboard.yaml
vendored
@ -7,6 +7,13 @@ on:
|
|||||||
- packages/dashboard/**
|
- packages/dashboard/**
|
||||||
- package.json
|
- package.json
|
||||||
- pnpm-lock.yaml
|
- pnpm-lock.yaml
|
||||||
|
pull_request:
|
||||||
|
types: [opened, synchronize, reopened]
|
||||||
|
paths:
|
||||||
|
- .github/workflows/publish-dashboard.yaml
|
||||||
|
- packages/dashboard/**
|
||||||
|
- package.json
|
||||||
|
- pnpm-lock.yaml
|
||||||
|
|
||||||
env:
|
env:
|
||||||
PUBLIC_APEX_DOMAIN: ${{ vars.PUBLIC_APEX_DOMAIN }}
|
PUBLIC_APEX_DOMAIN: ${{ vars.PUBLIC_APEX_DOMAIN }}
|
||||||
@ -18,6 +25,7 @@ jobs:
|
|||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
deployments: write
|
deployments: write
|
||||||
|
pull-requests: write
|
||||||
name: Publish to Cloudflare Pages
|
name: Publish to Cloudflare Pages
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@ -52,6 +60,33 @@ jobs:
|
|||||||
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
|
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
|
||||||
command: pages deploy ./packages/dashboard/build --project-name=pockethost --branch=${{ github.head_ref || github.ref_name }}
|
command: pages deploy ./packages/dashboard/build --project-name=pockethost --branch=${{ github.head_ref || github.ref_name }}
|
||||||
|
|
||||||
|
- name: Find related pull request
|
||||||
|
id: find_pr
|
||||||
|
uses: actions/github-script@v7
|
||||||
|
with:
|
||||||
|
result-encoding: string
|
||||||
|
script: |
|
||||||
|
const { owner, repo } = context.repo
|
||||||
|
const branch = (context.payload.pull_request && context.payload.pull_request.head && context.payload.pull_request.head.ref)
|
||||||
|
|| process.env.GITHUB_HEAD_REF
|
||||||
|
|| process.env.GITHUB_REF_NAME
|
||||||
|
const prs = await github.rest.pulls.list({ owner, repo, state: 'open', head: `${owner}:${branch}` })
|
||||||
|
if (prs.data.length > 0) {
|
||||||
|
return String(prs.data[0].number)
|
||||||
|
}
|
||||||
|
return ''
|
||||||
|
|
||||||
|
- name: Comment preview URL on PR
|
||||||
|
if: steps.find_pr.outputs.result != ''
|
||||||
|
uses: marocchino/sticky-pull-request-comment@v2
|
||||||
|
with:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
number: ${{ steps.find_pr.outputs.result }}
|
||||||
|
header: pockethost-dashboard-preview
|
||||||
|
message: |
|
||||||
|
✅ Preview available: ${{ steps.deployment.outputs.deployment-url }}
|
||||||
|
Triggered by @${{ github.actor }} on `${{ github.ref_name }}`.
|
||||||
|
|
||||||
- name: Discord feature branch notification
|
- name: Discord feature branch notification
|
||||||
if: github.ref_name != env.MAIN_BRANCH
|
if: github.ref_name != env.MAIN_BRANCH
|
||||||
env:
|
env:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user