62 lines
1.6 KiB
YAML
62 lines
1.6 KiB
YAML
name: CI
|
|
|
|
on:
|
|
pull_request:
|
|
branches: [ master ]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- 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$|\.github/workflows/|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
|
|
if: steps.changes.outputs.run_build == 'true'
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 24.13.0
|
|
cache: npm
|
|
|
|
- name: Pin npm version
|
|
if: steps.changes.outputs.run_build == 'true'
|
|
run: |
|
|
npm i -g npm@11.8.0
|
|
npm --version
|
|
|
|
- name: Install dependencies
|
|
if: steps.changes.outputs.run_build == 'true'
|
|
run: npm ci
|
|
|
|
- name: Build
|
|
if: steps.changes.outputs.run_build == 'true'
|
|
run: npm run build --if-present
|