Skip to content

[Toggletip] Update Usage and Style tab #28

[Toggletip] Update Usage and Style tab

[Toggletip] Update Usage and Style tab #28

Workflow file for this run

name: deploy preview
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
pull_request_target:
branches:
- main
permissions:
pull-requests: write
jobs:
netlify:
if: github.repository == 'carbon-design-system/carbon-website'
runs-on: ubuntu-latest
environment:
name: Preview
url: ${{ steps.url_preview.outputs.NETLIFY_PREVIEW_URL }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Use Node.js 20.x
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: 20.x
- name: Install packages
run: yarn install --immutable --network-timeout 300000
- name: Gatsby Cache Folder
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
id: gatsby-cache-folder
with:
path: .cache
key: ${{ runner.os }}-cache-gatsby
restore-keys: |
${{ runner.os }}-cache-gatsby
- name: Gatsby Public Folder
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
id: gatsby-public-folder
with:
path: public/
key: ${{ runner.os }}-public-gatsby
restore-keys: |
${{ runner.os }}-public-gatsby
- name: Build site
run: yarn build
env:
GATSBY_EXPERIMENTAL_PAGE_BUILD_ON_DATA_CHANGES: true
NODE_ENV: production
CI: true
- name: Deploy to Netlify
id: netlify_deploy
run: |
yarn netlify deploy \
--cwd=public \
--site=${{ secrets.NETLIFY_SITE_ID }} \
--auth=${{ secrets.NETLIFY_AUTH_TOKEN }} \
--alias=${{ github.event.number }} \
--json \
> deploy_output.json
- name: Generate URL Preview
id: url_preview
run: |
NETLIFY_PREVIEW_URL=$(jq -r '.deploy_url' deploy_output.json)
echo "NETLIFY_PREVIEW_URL=$NETLIFY_PREVIEW_URL" >> "$GITHUB_OUTPUT"
- name: Comment URL Preview on PR
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
env:
NETLIFY_PREVIEW_URL:
${{ steps.url_preview.outputs.NETLIFY_PREVIEW_URL }}
with:
script: |

Check failure on line 73 in .github/workflows/deploy-preview.yml

View workflow run for this annotation

GitHub Actions / deploy preview

Invalid workflow file

The workflow is not valid. .github/workflows/deploy-preview.yml (Line: 73, Col: 19): Unrecognized named-value: 'process'. Located at position 1 within expression: process.env.NETLIFY_PREVIEW_URL
// Define a hidden reference we'll put in new comments and also use
// to find existing comments
let hiddenReference = '<!--CarbonWebsiteDeployPreviewComment-DoNotDelete--> '
// Get the existing comments
const {data: comments} = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.number,
})
// Find the existing deploy preview comment
const deployPreviewComment = comments.find(comment => comment.body.includes(hiddenReference))
// Craft the comment body
let comment = hiddenReference + "Deploy preview "
if (process.env.NETLIFY_PREVIEW_URL) {
comment = comment + "successfully published at <a href=\"${{ process.env.NETLIFY_PREVIEW_URL }}\">${{ process.env.NETLIFY_PREVIEW_URL }}</a> with commit (${{ github.sha }})"
} else {
comment = comment + "failed to publish"
}
// Create or update comment
if (deployPreviewComment) {
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: deployPreviewComment.id,
body: comment
})
} else {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.number,
body: comment
})
}