Skip to content

fix: update PNPM installation steps to use corepack for better versio… #49

fix: update PNPM installation steps to use corepack for better versio…

fix: update PNPM installation steps to use corepack for better versio… #49

name: "Copilot Setup Steps"
# Automatically run the setup steps when they are changed to allow for easy validation, and
# allow manual testing through the repository's "Actions" tab
on:
workflow_dispatch:
push:
paths:
- .github/workflows/copilot-setup-steps.yml
pull_request:
paths:
- .github/workflows/copilot-setup-steps.yml
jobs:
# The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot.
copilot-setup-steps:
environment: copilot
runs-on: ubuntu-latest
# Set the permissions to the lowest permissions possible needed for your steps.
# Copilot will be given its own token for its operations.
permissions:
# If you want to clone the repository as part of your setup steps, for example to install dependencies, you'll need the `contents: read` permission. If you don't clone the repository in your setup steps, Copilot will do this for you automatically after the steps complete.
contents: read
# You can define any steps you want, and they will run before the agent starts.
# If you do not check out your code, Copilot will do this for you.
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
cache: "pnpm"
- name: Install PNPM
run: |
npm install --global corepack@latest
corepack enable
corepack prepare pnpm@latest-10 --activate
pnpm --version
- name: Cache pnpm store
id: pnpm-cache
uses: actions/cache@v4
with:
path: |
~/.local/share/pnpm/store/v3
node_modules
packages/*/node_modules
apps/*/node_modules
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
- name: Install JavaScript dependencies
run: pnpm install --frozen-lockfile
if: steps.pnpm-cache.outputs.cache-hit != 'true'
- name: Cache Playwright browsers
id: playwright-cache
uses: actions/cache@v4
with:
path: /home/runner/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-playwright-
- name: Install Playwright browsers
run: |
echo "Installing Playwright browsers for UI testing..."
pnpm exec playwright install --with-deps
env:
PLAYWRIGHT_BROWSERS_PATH: /home/runner/.cache/ms-playwright
if: steps.playwright-cache.outputs.cache-hit != 'true'
- name: Install Java SDK (Required for SonarCloud)
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Verify required environment variables
run: |
if [ -z "$SONAR_TOKEN" ]; then
echo "Error: SONAR_TOKEN is not set."
exit 1
fi
if [ -z "$GH_TOKEN" ]; then
echo "Error: GH_TOKEN is not set."
exit 1
fi
echo "All required environment variables are set."
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}