summaryrefslogtreecommitdiffstats
path: root/.github/workflows/format-workflow.yml
blob: 50c96a629bddd10e91ad8e73c531f6f85d19e1a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
name: Format + Docs Workflow
on:
  push:
    paths: ["docs/**", "**.md", "**.toml", "**.js", "**.json", "**.ts"]
  pull_request:
    paths: ["docs/**", "**.md", "**.toml", "**.js", "**.json", "**.ts"]

jobs:
  # Run the dprint code formatter for documentation
  dprint:
    name: Dprint [Docs Formatter]
    runs-on: ubuntu-latest
    steps:
      - name: Setup | Checkout
        uses: actions/checkout@v4
      - name: Docs | Format
        uses: dprint/check@v2.2

  # Validate preset files
  taplo:
    name: Taplo [Preset schema validation]
    runs-on: ubuntu-latest
    steps:
      - name: Setup | Checkout
        uses: actions/checkout@v4
      - name: Install | Taplo
        run: cargo install --debug --locked --version 0.9.0 taplo-cli
      - name: Presets | Validate with schema
        run: taplo lint --schema "file://${GITHUB_WORKSPACE}/.github/config-schema.json" docs/.vuepress/public/presets/toml/*.toml

  # If this is not a Crowdin PR, block changes to translated documentation
  block-crowdin:
    name: Block Translated Changes
    runs-on: ubuntu-latest
    if: ${{ github.event_name == 'pull_request' }}
    steps:
      - name: Prevent File Change
        uses: xalvarez/prevent-file-change-action@v1.6.0
        if: ${{ github.event.pull_request.head.ref != 'i18n_master' }}
        with:
          githubToken: ${{ secrets.GITHUB_TOKEN }}
          pattern: docs/[a-z][a-z][a-z]?-[A-Z][A-Z]?/.*