# These are workflows used exclusively for the mystery events sub-project
# It's basically a copy of eslint.yml & test.yml just aimed at a different branch

name: MysteryEvents

on:
  # Trigger the workflow on push or pull request,
  # but only for the mystery-battle-events branch
  push:
    branches:
      - mystery-battle-events  # Trigger on push events to the mystery-battle-events branch
  pull_request:
    branches:
      - mystery-battle-events  # Trigger on pull request events targeting the mystery-battle-events branch

jobs:
  lint:  # Define a job named "run-linters"
    name: Lint  # Human-readable name for the job
    runs-on: ubuntu-latest  # Specify the latest Ubuntu runner for the job

    steps:
      - name: Check out Git repository  # Step to check out the repository
        uses: actions/checkout@v2  # Use the checkout action version 2

      - name: Set up Node.js  # Step to set up Node.js environment
        uses: actions/setup-node@v1  # Use the setup-node action version 1
        with:
          node-version: 20  # Specify Node.js version 20

      - name: Install Node.js dependencies  # Step to install Node.js dependencies
        run: npm ci  # Use 'npm ci' to install dependencies

      - name: eslint  # Step to run linters
        run: npm run eslint-ci

  test:  # Define a job named "run-tests"
    name: Test  # Human-readable name for the job
    runs-on: ubuntu-latest  # Specify the latest Ubuntu runner for the job

    steps:
      - name: Check out Git repository  # Step to check out the repository
        uses: actions/checkout@v4  # Use the checkout action version 4

      - name: Set up Node.js  # Step to set up Node.js environment
        uses: actions/setup-node@v4  # Use the setup-node action version 4
        with:
          node-version: 20  # Specify Node.js version 20

      - name: Install Node.js dependencies  # Step to install Node.js dependencies
        run: npm ci  # Use 'npm ci' to install dependencies

      - name: tests  # Step to run tests
        run: npm run test${{ runner.debug == '0' &&':silent' || '' }} # silent on default. if debug run loud