Skip to content

buildContext 함수 수정 (issue #22) #28

buildContext 함수 수정 (issue #22)

buildContext 함수 수정 (issue #22) #28

Workflow file for this run

name: Package CI
on:
pull_request:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install pnpm
run: npm install -g pnpm
- name: Install dependencies
run: pnpm install --no-frozen-lockfile
- name: Update lockfile
run: |
git config user.name github-actions
git config user.email [email protected]
git add pnpm-lock.yaml
git commit -m "Update pnpm-lock.yaml" || echo "No changes to commit"
git push || echo "No changes to push"
- name: Fetch main branch
run: git fetch origin main
- name: Get changed workspaces
id: changesets
run: |
CHANGED_WORKSPACES=$(git diff --name-only origin/main...HEAD -- packages/ | grep 'packages/' | cut -d '/' -f 2 | sort | uniq | tr '\n' ',')
echo "Changed workspaces: $CHANGED_WORKSPACES"
echo "CHANGED_WORKSPACES=$CHANGED_WORKSPACES" >> $GITHUB_ENV
- name: Add empty changeset if necessary
if: env.CHANGED_WORKSPACES != ''
run: |
if pnpm changeset status --since-ref main --verbose | grep -q 'Some packages have been changed'; then
pnpm changeset add --empty
fi
- name: Run tests for changed packages
if: env.CHANGED_WORKSPACES != ''
run: |
IFS=',' read -r -a packages <<< "${CHANGED_WORKSPACES}"
for package in "${packages[@]}"; do
if [ -n "$package" ]; then
echo "Running tests for package: $package"
pnpm -r --filter "./packages/$package" test
fi
done