on:
  workflow_dispatch:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main
  schedule:
    - cron: "0 13 * * 2"

name: param-test

jobs:
  param-test:
    runs-on: ubuntu-latest

    env:
      GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

    steps:
      - uses: actions/checkout@v4

      - uses: r-lib/actions/setup-r@v2

      - uses: r-lib/actions/setup-r-dependencies@v2
        with:
          extra-packages: |
            any::rvest
            any::magrittr

      - name: Run param test
        run: |
          pak::pkg_install(".")
          testthat::test_dir("inst/paramtest", stop_on_failure = TRUE)
        shell: Rscript {0}
