Skip to content

Bump checkout, setup-node and cache actions in workflows #145

Bump checkout, setup-node and cache actions in workflows

Bump checkout, setup-node and cache actions in workflows #145

name: Build & check
on:
pull_request:
types:
- opened
- synchronize
- reopened
- assigned
- closed
- edited
- labeled
- locked
- ready_for_review
- review_request_removed
- review_requested
- unassigned
- unlabeled
- unlocked
workflow_dispatch:
jobs:
build:
name: Build
runs-on: ubuntu-latest
outputs:
changes: ${{ steps.check-for-changes.outputs.diff }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
- name: Get Yarn cache folder path
id: yarn-cache-folder
run: echo "path=$( yarn cache dir )" >> $GITHUB_OUTPUT
- name: Set up Yarn cache
id: yarn-cache
uses: actions/cache@v4
with:
path: ${{ steps.yarn-cache-folder.outputs.path }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Node packages via Yarn
run: yarn install --frozen-lockfile --cache-folder ${{ steps.yarn-cache-folder.outputs.path }}
- name: Build
run: yarn build
- name: Check for changes
id: check-for-changes
run: |
{
echo "diff<<EOF"
git diff
echo "EOF"
} >> "$GITHUB_OUTPUT"
check:
name: Check distribution file
runs-on: ubuntu-latest
needs: build
steps:
- if: ${{ needs.build.outputs.changes != '' }}
name: Fail
run: exit 1