name: GameDB Lint

on:
  pull_request:
    paths:
      - 'data/resources/gamedb.yaml'
      - 'data/resources/discdb.yaml'
  push:
    branches:
      - master
      - dev
    paths:
      - 'data/resources/gamedb.yaml'
      - 'data/resources/discdb.yaml'
  workflow_dispatch:

jobs:
  gamedb-lint:
    runs-on: ubuntu-22.04
    timeout-minutes: 120
    steps:
    - uses: actions/checkout@v4.1.1
      with:
        fetch-depth: 0

    - name: Install Packages
      shell: bash
      run: |
        sudo apt-get update
        sudo apt-get -y install yamllint

    - name: Check GameDB
      shell: bash
      run: yamllint -c extras/yamllint-config.yaml -s -f github data/resources/gamedb.yaml

    - name: Check DiscDB
      shell: bash
      run: yamllint -c extras/yamllint-config.yaml -s -f github data/resources/discdb.yaml
