Skip to content

fix(conversations): commit each attachment upload as soon as it settles #37851

fix(conversations): commit each attachment upload as soon as it settles

fix(conversations): commit each attachment upload as soon as it settles #37851

name: Deploy SPA preview on PR label
on:
pull_request:
types: [labeled, synchronize]
permissions:
contents: read
pull-requests: write
jobs:
deploy-app:
if: >-
(github.event.action == 'labeled' && github.event.label.name == 'deploy-app-preview')
|| (github.event.action == 'synchronize' && contains(github.event.pull_request.labels.*.name, 'deploy-app-preview'))
uses: ./.github/workflows/deploy-spa.yaml
with:
app: "app"
env: "prod"
region: "us"
skip_slack: true
secrets: inherit
comment-deploy-app:
needs: [deploy-app]
if: ${{ !failure() && !cancelled() && needs.deploy-app.result == 'success' }}
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Comment preview URL on PR
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
script: |
const marker = '<!-- spa-preview-app -->';
const body = `${marker}\n🚀 **App SPA preview deployed**\n\n${{ needs.deploy-app.outputs.preview_url }}`;
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
});
const existing = comments.find(c => c.body.includes(marker));
if (existing) {
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: existing.id,
body,
});
} else {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body,
});
}