Merge pull request #17 from itzMiney/itzMiney-patch-1
Update CI workflow to limit PR paths
This commit is contained in:
1 file changed
+36
-3
@@ -2,7 +2,6 @@ name: CI
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
push:
|
|
||||||
branches: [ master ]
|
branches: [ master ]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@@ -11,18 +10,52 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Detect relevant changes
|
||||||
|
id: changes
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
BASE="${{ github.event.pull_request.base.sha }}"
|
||||||
|
HEAD="${{ github.sha }}"
|
||||||
|
|
||||||
|
echo "Base: $BASE"
|
||||||
|
echo "Head: $HEAD"
|
||||||
|
|
||||||
|
files="$(git diff --name-only "$BASE" "$HEAD")"
|
||||||
|
echo "Changed files:"
|
||||||
|
echo "$files"
|
||||||
|
|
||||||
|
if echo "$files" | grep -Eq '^(src/|scripts/|angular\.json$|tsconfig.*\.json$|package\.json$|package-lock\.json$|public/i18n/)'; then
|
||||||
|
echo "run_build=true" >> "$GITHUB_OUTPUT"
|
||||||
|
else
|
||||||
|
echo "run_build=false" >> "$GITHUB_OUTPUT"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Skip build (no relevant changes)
|
||||||
|
if: steps.changes.outputs.run_build != 'true'
|
||||||
|
run: |
|
||||||
|
echo "No files changed that affect the build/tests. Marking CI as successful."
|
||||||
|
exit 0
|
||||||
|
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
|
if: steps.changes.outputs.run_build == 'true'
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 24.13.0
|
node-version: 24.13.0
|
||||||
cache: npm
|
cache: npm
|
||||||
|
|
||||||
- run: npm i -g npm@11.8.0
|
- name: Pin npm version
|
||||||
- run: npm --version
|
if: steps.changes.outputs.run_build == 'true'
|
||||||
|
run: |
|
||||||
|
npm i -g npm@11.8.0
|
||||||
|
npm --version
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
|
if: steps.changes.outputs.run_build == 'true'
|
||||||
run: npm ci
|
run: npm ci
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
|
if: steps.changes.outputs.run_build == 'true'
|
||||||
run: npm run build --if-present
|
run: npm run build --if-present
|
||||||
Reference in new issue
Block a user