name: Test scripts

on:
  pull_request:
    paths:
      - 'shell/install.sh'
      - '.github/workflows/scripts.yml'
      - '.github/scripts/scripts/hygiene.sh'
      - '.github/scripts/common/hygiene-preamble.sh'
  push:
    branches:
      - 'master'
      - '2.**'

defaults:
  run:
    shell: bash

jobs:
  hygiene-scripts:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3
    - name: Check scripts
      env:
        # Defined only on pull request jobs
        BASE_REF_SHA: ${{ github.event.pull_request.base.sha }}
        PR_REF_SHA: ${{ github.event.pull_request.head.sha }}
      run: bash -exu .github/scripts/scripts/hygiene.sh
