Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 40 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,46 @@ on:
push:
branches: [master]
pull_request:
paths-ignore:
- 'lerna.json'
- 'packages/*/package.json'
workflow_dispatch:

permissions:
contents: read
pull-requests: read

jobs:
changes:
name: Detect version-only changes
runs-on: ubuntu-latest
outputs:
version_only: ${{ steps.filter.outputs.version_only }}
steps:
- name: Check the PR changes only version files
id: filter
if: github.event_name == 'pull_request'
env:
GH_TOKEN: ${{ github.token }}
PR: ${{ github.event.pull_request.number }}
REPO: ${{ github.repository }}
run: |
if ! files=$(gh api "repos/$REPO/pulls/$PR/files" --paginate --jq '.[].filename'); then
echo "Could not list PR files — running full CI to be safe."
echo "version_only=false" >> "$GITHUB_OUTPUT"
exit 0
fi
printf 'Changed files:\n%s\n' "$files"
# version_only=true only if EVERY changed file is lerna.json or a top-level
# packages/<pkg>/package.json (exactly what version-bump.yml commits).
others=$(printf '%s\n' "$files" | grep -vE '^(lerna\.json|packages/[^/]+/package\.json)$' || true)
if [ -n "$files" ] && [ -z "$others" ]; then
echo "version_only=true" >> "$GITHUB_OUTPUT"
else
echo "version_only=false" >> "$GITHUB_OUTPUT"
fi

build:
name: Build
needs: [changes]
if: ${{ !(startsWith(github.head_ref, 'release/') && github.event.pull_request.user.login == 'github-actions[bot]' && needs.changes.outputs.version_only == 'true') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
Expand Down Expand Up @@ -38,7 +71,8 @@ jobs:

test:
name: Test ${{ matrix.package }}
needs: [build]
needs: [build, changes]
if: ${{ !(startsWith(github.head_ref, 'release/') && github.event.pull_request.user.login == 'github-actions[bot]' && needs.changes.outputs.version_only == 'true') }}
strategy:
matrix:
os: [ubuntu-latest]
Expand Down Expand Up @@ -140,7 +174,8 @@ jobs:

regression:
name: Regression
needs: [build]
needs: [build, changes]
if: ${{ !(startsWith(github.head_ref, 'release/') && github.event.pull_request.user.login == 'github-actions[bot]' && needs.changes.outputs.version_only == 'true') }}
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
Expand Down
42 changes: 38 additions & 4 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,46 @@ on:
push:
branches: [master]
pull_request:
paths-ignore:
- 'lerna.json'
- 'packages/*/package.json'
workflow_dispatch:

permissions:
contents: read
pull-requests: read

jobs:
changes:
name: Detect version-only changes
runs-on: ubuntu-latest
outputs:
version_only: ${{ steps.filter.outputs.version_only }}
steps:
- name: Check the PR changes only version files
id: filter
if: github.event_name == 'pull_request'
env:
GH_TOKEN: ${{ github.token }}
PR: ${{ github.event.pull_request.number }}
REPO: ${{ github.repository }}
run: |
if ! files=$(gh api "repos/$REPO/pulls/$PR/files" --paginate --jq '.[].filename'); then
echo "Could not list PR files — running full CI to be safe."
echo "version_only=false" >> "$GITHUB_OUTPUT"
exit 0
fi
printf 'Changed files:\n%s\n' "$files"
# version_only=true only if EVERY changed file is lerna.json or a top-level
# packages/<pkg>/package.json (exactly what version-bump.yml commits).
others=$(printf '%s\n' "$files" | grep -vE '^(lerna\.json|packages/[^/]+/package\.json)$' || true)
if [ -n "$files" ] && [ -z "$others" ]; then
echo "version_only=true" >> "$GITHUB_OUTPUT"
else
echo "version_only=false" >> "$GITHUB_OUTPUT"
fi

build:
name: Build
needs: [changes]
if: ${{ !(startsWith(github.head_ref, 'release/') && github.event.pull_request.user.login == 'github-actions[bot]' && needs.changes.outputs.version_only == 'true') }}
runs-on: windows-latest
steps:
- uses: actions/checkout@v5
Expand Down Expand Up @@ -38,7 +71,8 @@ jobs:

test:
name: Test ${{ matrix.package }}
needs: [build]
needs: [build, changes]
if: ${{ !(startsWith(github.head_ref, 'release/') && github.event.pull_request.user.login == 'github-actions[bot]' && needs.changes.outputs.version_only == 'true') }}
strategy:
fail-fast: false
matrix:
Expand Down
Loading