luka pona la TASO en TELO en TENPO la o kepeken sitelen tawa pi nimi … #1494
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Validate TOML Files | |
on: | |
push: | |
branches-ignore: ["l10n_*"] | |
paths: | |
- "**.toml" | |
- "api/src/lib/**" | |
pull_request: | |
branches-ignore: ["l10n_*"] | |
paths: | |
- "**.toml" | |
- "api/src/lib/**" | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
skip_check: | |
continue-on-error: true | |
runs-on: ubuntu-latest | |
name: Check for and skip duplicate workflows | |
outputs: | |
should_skip: ${{ steps.skip_check.outputs.should_skip }} | |
steps: | |
- id: skip_check | |
uses: fkirc/skip-duplicate-actions@v5 | |
with: | |
cancel_others: true | |
concurrent_skipping: "outdated_runs" | |
validate: | |
needs: skip_check | |
if: needs.skip_check.outputs.should_skip != 'true' | |
runs-on: ubuntu-latest | |
name: Generate schemas, validate and package TOMLs | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
ref: ${{ github.event.pull_request.head.ref }} | |
- uses: dorny/paths-filter@v3 | |
id: changes | |
with: | |
filters: | | |
schemas: | |
- 'api/src/lib/**' | |
data: | |
- '**.toml' | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 9 | |
run_install: | | |
- args: [--frozen-lockfile] | |
cwd: ./api | |
- name: Generate JSON Schemas | |
if: contains(steps.changes.outputs.changes, 'schemas') | |
run: pnpm run generate | |
working-directory: ./api | |
- name: Commit schemas | |
if: contains(steps.changes.outputs.changes, 'schemas') && !github.event.pull_request.head.repo.fork | |
uses: EndBug/add-and-commit@v9 | |
with: | |
message: "Generated schemas for ${{ github.event.pull_request.head.sha || github.event.head_commit.id || github.sha }}" | |
- name: Validate all files | |
if: contains(steps.changes.outputs.changes, 'data') | |
run: pnpm dlx @taplo/cli check | |
- name: Setup Python | |
if: contains(steps.changes.outputs.changes, 'data') | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12.1 | |
- name: Install dependencies | |
if: contains(steps.changes.outputs.changes, 'data') | |
run: pip install tomlkit && npm i -g ajv-cli ajv-formats | |
- name: Generate raw data file | |
if: contains(steps.changes.outputs.changes, 'data') | |
run: python .github/workflows/package_data.py | |
- name: Validate generated file | |
if: contains(steps.changes.outputs.changes, 'data') | |
run: | | |
list=(./api/raw/*.json) | |
for file in "${list[@]}"; do | |
if [ "${file:10}" == "sandbox.json" ]; then | |
npx ajv-cli -s "./api/generated/words.json" -c ajv-formats --errors=text -d $file; | |
else | |
npx ajv-cli -s "./api/generated/${file:10}" -c ajv-formats --errors=text -d $file; | |
fi | |
done | |
- name: Commit packaged files | |
uses: EndBug/add-and-commit@v9 | |
if: contains(steps.changes.outputs.changes, 'data') && !github.event.pull_request.head.repo.fork | |
with: | |
message: Generated raw JSON files for ${{ github.sha }} | |
pull: --commit |