fix(core): add dynamic ids as part of breadcrumbs #1540
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy Example Previews | |
on: | |
issue_comment: | |
types: [created] | |
jobs: | |
build_previews_matrix: | |
name: Build previews matrix | |
permissions: | |
pull-requests: write | |
issues: write | |
outputs: | |
matrix: ${{ steps.build_examples_matrix.outputs.EXAMPLES }} | |
pr_sha: ${{ steps.pr.outputs.head_sha }} | |
runs-on: ubuntu-latest | |
if: > | |
github.event.issue.pull_request && | |
contains(fromJSON('["MEMBER", "COLLABORATOR", "OWNER"]'), github.event.comment.author_association) && | |
startsWith(github.event.comment.body, '/deploy') | |
steps: | |
- uses: peter-evans/create-or-update-comment@v4 | |
with: | |
comment-id: ${{ github.event.comment.id }} | |
reactions: rocket | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get PR Info | |
id: pr | |
env: | |
PR_NUMBER: ${{ github.event.issue.number }} | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GH_REPO: ${{ github.repository }} | |
COMMENT_AT: ${{ github.event.comment.created_at }} | |
run: | | |
pr="$(gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /repos/${GH_REPO}/pulls/${PR_NUMBER})" | |
head_sha="$(echo "$pr" | jq -r .head.sha)" | |
updated_at="$(echo "$pr" | jq -r .updated_at)" | |
if [[ $(date -d $updated_at) > $(date -d $COMMENT_AT) ]]; then exit 1; fi | |
echo "head_sha=$head_sha" >> $GITHUB_OUTPUT | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ steps.pr.outputs.head_sha }} | |
- name: Build examples matrix | |
id: build_examples_matrix | |
run: node ./.github/workflows/scripts/deploy-previews.js | |
env: | |
COMMENT_BODY: '${{ github.event.comment.body }}' | |
deploy_example_preview: | |
needs: build_previews_matrix | |
if: ${{ fromJson(needs.build_previews_matrix.outputs.matrix).include }} | |
permissions: | |
pull-requests: write | |
issues: write | |
strategy: | |
matrix: ${{ fromJson(needs.build_previews_matrix.outputs.matrix) }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ needs.build_previews_matrix.outputs.pr_sha }} | |
- uses: pnpm/action-setup@v3 | |
with: | |
version: 9 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
cache: "pnpm" | |
- name: Install Dependencies | |
run: pnpm install --ignore-scripts | |
- name: Build example | |
run: pnpm build --scope ${{ matrix.name }} | |
- name: Deploy to Netlify | |
uses: nwtgck/[email protected] | |
with: | |
publish-dir: ${{ matrix.publish_dir }} | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
deploy-message: "[Comment] Deploy from GitHub Actions" | |
alias: deploy-preview-${{ matrix.name }}-${{ github.event.comment.node_id }} | |
enable-pull-request-comment: true | |
overwrites-pull-request-comment: true | |
github-deployment-environment: "deploy-preview-${{ matrix.name }}-${{ github.event.comment.node_id }}" | |
netlify-config-path: ${{ matrix.netlify_config_path }} | |
env: | |
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
timeout-minutes: 10 |