database/.github/workflows/check.yml
2025-03-16 05:26:04 +03:00

34 lines
1.1 KiB
YAML

name: check
on:
workflow_dispatch:
pull_request:
types: [opened, synchronize, reopened, edited]
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- uses: actions/setup-node@v3
if: ${{ !env.ACT }}
with:
node-version: '22.12.0'
cache: 'npm'
- name: changed files
id: files
run: |
FILES=data/*.csv
ANY_CHANGED=false
ALL_CHANGED_FILES=$(git diff --name-only "${FILES}" | tr '\n' ' ')
if [ -n "${ALL_CHANGED_FILES}" ]; then
ANY_CHANGED=true
fi
echo "all_changed_files=$ALL_CHANGED_FILES" >> "$GITHUB_OUTPUT"
echo "any_changed=$ANY_CHANGED" >> "$GITHUB_OUTPUT"
- name: install dependencies
if: steps.files.outputs.any_changed == 'true'
run: npm install
- name: validate
if: steps.files.outputs.any_changed == 'true'
run: npm run db:validate -- ${{ steps.files.outputs.all_changed_files }}