chore(root): GA fixes

This commit is contained in:
Ben Allfree 2025-08-09 17:09:27 -07:00
parent cc7cab4555
commit 543d771369

View File

@ -64,43 +64,27 @@ jobs:
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
command: pages deploy ./packages/dashboard/build --project-name=pockethost --branch=${{ github.event.pull_request.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 != ''
if: github.event_name == 'pull_request_target'
uses: marocchino/sticky-pull-request-comment@v2
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
number: ${{ steps.find_pr.outputs.result }}
number: ${{ github.event.pull_request.number }}
header: pockethost-dashboard-preview
message: |
✅ Preview available: ${{ steps.deployment.outputs.deployment-url }}
Triggered by @${{ github.actor }} on `${{ github.ref_name }}`.
Triggered by @${{ github.actor }} on `${{ github.event.pull_request.head.ref }}`.
- name: Discord feature branch notification
if: github.ref_name != env.MAIN_BRANCH
if: github.event_name == 'pull_request_target' || (github.event_name == 'push' && github.ref_name != env.MAIN_BRANCH)
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
uses: Ilshidur/action-discord@master
with:
args: '**DASHBOARD PREVIEW** ${{ steps.deployment.outputs.deployment-url }} was generated by ${{ github.actor }} in [${{ env.GIT_COMMIT_SHORT_SHA }}](https://github.com/${{ github.repository}}/commit/${{ github.sha }}) on [${{ github.repository}}#${{ github.ref_name }}](https://github.com/${{ github.repository}}/tree/${{ github.ref_name }}) with memo `${{ env.GIT_COMMIT_MESSAGE_SUBJECT }}`'
args: '**DASHBOARD PREVIEW** ${{ steps.deployment.outputs.deployment-url }} was generated by ${{ github.actor }} in [${{ env.GIT_COMMIT_SHORT_SHA }}](https://github.com/${{ github.repository}}/commit/${{ github.sha }}) on [${{ github.repository}}#${{ github.event.pull_request.head.ref || github.ref_name }}](https://github.com/${{ github.repository}}/tree/${{ github.event.pull_request.head.ref || github.ref_name }}) with memo `${{ env.GIT_COMMIT_MESSAGE_SUBJECT }}`'
- name: Discord live branch notification
if: github.ref_name == env.MAIN_BRANCH
if: github.event_name == 'push' && github.ref_name == env.MAIN_BRANCH
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
uses: Ilshidur/action-discord@master