From 543d771369df7ae44118df51b706bb0f2e17a7c8 Mon Sep 17 00:00:00 2001 From: Ben Allfree Date: Sat, 9 Aug 2025 17:09:27 -0700 Subject: [PATCH] chore(root): GA fixes --- .github/workflows/publish-dashboard.yaml | 28 +++++------------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/.github/workflows/publish-dashboard.yaml b/.github/workflows/publish-dashboard.yaml index fb40634c..352fe314 100644 --- a/.github/workflows/publish-dashboard.yaml +++ b/.github/workflows/publish-dashboard.yaml @@ -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