Skip to content

Commit

Permalink
Limit preview to modified projects
Browse files Browse the repository at this point in the history
  • Loading branch information
rossjrw committed Sep 20, 2024
1 parent ffa4f83 commit decbb22
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,24 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install & build projects

- name: Determine changed projects
id: changes
run: |
CHANGED_PROJECTS=$(git diff --name-only origin/${{ github.event.pull_request.base.ref }}...origin/${{ github.event.pull_request.head.ref }} -- 'source/*' | cut -d/ -f2 | sort -u)
echo "CHANGED_PROJECTS=$CHANGED_PROJECTS" >> $GITHUB_ENV
- name: Install & build changed projects
run: |
mkdir dist
for project in $(cd source && ls -d */); do
for project in $CHANGED_PROJECTS; do
pushd source/$project
npm install
npm run build
popd
cp -r source/$project/dist dist/$project
done
- name: Deploy preview
uses: rossjrw/pr-preview-action@v1
with:
Expand Down

0 comments on commit decbb22

Please sign in to comment.