Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ jobs:
permissions:
id-token: write
steps:
- name: Create app token
uses: actions/create-github-app-token@v3
id: app-token
with:
client-id: ${{ vars.THEOPLAYER_BOT_APP_ID }}
private-key: ${{ secrets.THEOPLAYER_BOT_PRIVATE_KEY }}

- name: Download build artifact 🗃️
uses: actions/download-artifact@v8
with:
Expand Down Expand Up @@ -69,3 +76,22 @@ jobs:
env:
CF_DISTRIBUTION_ID: ${{ vars.CF_DISTRIBUTION_ID }}
PATH_TO_INVALIDATE: ${{ inputs.cf_invalidate_path }}

- name: Add comment to Pull Request with link to preview 🕸️
uses: actions/github-script@v9
if: ${{ inputs.environment_name == 'preview' }}
with:
github-token: ${{ steps.app-token.outputs.token }}
script: |
const body = `| Preview |
|---|
| :rocket: View preview at: ${{ inputs.environment_url }} |
| <h6>Deployed on ${new Date(Date.now()).toGMTString()}</h6> |
<!-- Sticky Pull Request comment-pr-preview -->`;

await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: body
})
1 change: 1 addition & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
# Do not run on PRs from Dependabot, since they should not need it.
if: ${{ github.event.action != 'closed' && github.triggering_actor != 'dependabot[bot]' }}
uses: ./.github/workflows/_deploy.yml
secrets: inherit
with:
environment_name: preview
environment_url: '${{ vars.PREVIEW_CLOUDFRONT_URL }}/pr-${{ github.event.number }}/'
Expand Down