Skip to content

Release Tracking

Release Tracking #457

name: Diff
on:
pull_request:
jobs:
changes:
uses: ./.github/workflows/hasChanged.yml
test:
if: ${{ github.repository == 'primer/primitives' && needs.changes.outputs.outputAffected == 'true' }}
name: Primitives v2
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Checkout reference branch
uses: actions/checkout@v3
with:
ref: ${{ github.base_ref }}
path: temp-main
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'npm'
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: npm install --legacy-peer-deps --ignore-scripts
- name: Install dependencies (reference)
run: pushd temp-main; npm install --legacy-peer-deps --ignore-scripts; popd
- name: Build
run: npm run build:tokens
- name: Build (reference)
run: pushd temp-main; npm run build:tokens; popd
- name: Export diff
run: |
diff -r -y --width=150 -B -I '*' -I 'Generated' --suppress-common-lines temp-main/tokens-v2-private/css tokens-v2-private/css | tail -n +2 > diff.txt
npx ts-node ./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.3.0
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.3.0
with:
message: |
### 🟢 No design token changes found
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMMENT_IDENTIFIER: 'primitives-diff'