From 272638c3239192990d928b517ff1c34fb07c40c2 Mon Sep 17 00:00:00 2001 From: Copilot Date: Sat, 8 Aug 2026 17:05:19 +0000 Subject: [PATCH] ci: add PR-triggered test workflow (fixes #66) Wire npm run test:unit into CI so PRs are validated before merge. Previously the only gate was deploy-gh-pages.yml, which runs on push to main after merge -- this allowed PR #37 to merge with a syntactically broken scripts/validate-awards.mjs, only caught when the deploy workflow failed on main. Adds a pull_request + push-to-main triggered workflow that runs npm run test:unit, plus a node --check syntax gate over all scripts/**/*.mjs files as a cheap pre-test sanity check. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .github/workflows/test.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..5b145d4f --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,27 @@ +name: Test + +on: + pull_request: + push: + branches: + - main + +permissions: + contents: read + +env: + NODE_VERSION: '22' + +jobs: + unit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 + - uses: actions/setup-node@v4 + with: + node-version: ${{ env.NODE_VERSION }} + cache: npm + - run: npm ci + - run: npm run test:unit + - name: Syntax-check scripts + run: find scripts -name '*.mjs' -print0 | xargs -0 -n1 node --check