Skip to content

Upgrade to v9 primitives #3471

Upgrade to v9 primitives

Upgrade to v9 primitives #3471

name: UI test
on:
pull_request:
jobs:
test:
if: ${{ github.repository == 'primer/brand' }}
name: Primitives diff
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Checkout reference branch
uses: actions/checkout@v2
with:
ref: ${{ github.base_ref }}
path: temp-main
- name: Set up Node
uses: actions/setup-node@v2
with:
node-version: 18
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies (reference)
run: pushd temp-main; npm ci --legacy-peer-deps; popd
- name: Install dependencies
run: npm ci --legacy-peer-deps
- name: Build (reference)
run: pushd temp-main; npm run build --workspace=packages/design-tokens; popd
- name: Build
run: npm run build --workspace=packages/design-tokens
- name: Export diff
run: |
diff -r -y --width=300 -B -I 'Generated' --suppress-common-lines temp-main/packages/design-tokens/lib/design-tokens/css packages/design-tokens/lib/design-tokens/css | tail -n +2 > diff.txt
npx ts-node ./packages/design-tokens/scripts/ci-check-diff.ts
- name: Read raw diff
if: hashFiles('diff.md') != ''
id: diff
uses: juliangruber/read-file-action@v1
with:
path: ./diff.md
- name: Post diff
if: hashFiles('diff.md') != ''
uses: phulsechinmay/rewritable-pr-comment@v0.2.1
with:
message: ${{ steps.diff.outputs.content }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMMENT_IDENTIFIER: 'primitives-diff'
- name: Comment on the PR about no results
if: hashFiles('diff.md') == ''
uses: phulsechinmay/rewritable-pr-comment@v0.2.1
with:
message: |
### 🟢 No design token changes found
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMMENT_IDENTIFIER: 'primitives-diff'