Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/storage-finder-sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Sync Storage Finder Data

on:
schedule:
- cron: "0 0 * * 6"
Copy link

Copilot AI Dec 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR title and description mention "hourly sync", but the cron schedule "0 0 * * 6" runs weekly on Saturdays at midnight UTC, not hourly.

If hourly sync is intended, the cron should be "0 * * * *". If weekly is correct, the PR description should be updated to reflect this.

Suggested change
- cron: "0 0 * * 6"
- cron: "0 * * * *"

Copilot uses AI. Check for mistakes.
workflow_dispatch:

jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Bun
uses: oven-sh/setup-bun@v2

- name: Install dependencies
run: bun install --frozen-lockfile

- name: Generate storage finder data from sheet
run: bun scripts/storage-finder-data-generator/generate.ts --output src/data/storage-finder

- name: Lint and format
run: |
bun lint --fix
Copy link

Copilot AI Dec 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bun lint --fix command may not work as intended. The lint script runs both lint:js and lint:css, but the --fix flag will be appended to the entire command, not passed to the individual linters. This means it would try to run pnpm lint:js && pnpm lint:css --fix, which only fixes CSS issues.

Consider running the commands separately:

- name: Lint and format
  run: |
    bun lint:js --fix
    bun lint:css --fix
    bun format

Or define a lint:fix script in package.json that properly handles both linters.

Suggested change
bun lint --fix
bun lint:js --fix
bun lint:css --fix

Copilot uses AI. Check for mistakes.
bun format

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "chore: sync storage finder data from sheet"
3 changes: 1 addition & 2 deletions docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,7 @@ const config: Config = {
items: [
{
label: "Feedback",
to:
"https://docs.google.com/forms/d/e/1FAIpQLSeHnmkPdR_IvWnT6a7U_V3RpfmQrpS8hjxI11FNnsZMlrBa4g/viewform",
to: "https://docs.google.com/forms/d/e/1FAIpQLSeHnmkPdR_IvWnT6a7U_V3RpfmQrpS8hjxI11FNnsZMlrBa4g/viewform",
},
{
label: "Announcements",
Expand Down
8 changes: 8 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ const eslintConfig = tseslint.config(
reactPlugin.configs.flat["jsx-runtime"],
jsxA11y.flatConfigs.recommended,

{
settings: {
react: {
version: "detect",
},
},
},

{
rules: {
"@typescript-eslint/consistent-type-imports": [
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"@docusaurus/types": "^3.9.2",
"@eslint/compat": "^1.4.1",
"@types/react": "^19.2.2",
"csv-parse": "^6.1.0",
"eslint": "^9.39.0",
"eslint-config-prettier": "^10.1.8",
"eslint-import-resolver-typescript": "^4.4.4",
Expand Down
18 changes: 13 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 45 additions & 0 deletions scripts/storage-finder-data-generator/MAINTENANCE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Storage Finder CSV Importer: Maintainer Guide

This approach aims to balance user-friendliness (content editors update the Google Sheet) with functionality (developers tune `config.ts` so the JSON stays in sync).

## What the CLI does

- Reads a CSV export of the shared Google Sheet (either via `STORAGE_FINDER_SHEET_URL` or `--csv <path>`).
- Applies the questions/choices/matchers defined in `scripts/storage-finder-data-generator/config.ts`.
- Generates `facet-tree.json` and `service-list.json` with slug-based IDs.

## How to regenerate data

```sh
bun scripts/storage-finder-data-generator/generate.ts \
--csv "Datafinder Data - Sheet1.csv" \
--output src/data/storage-finder
```

- Omit `--csv` to download from `STORAGE_FINDER_SHEET_URL`.
- Use `--output` to write elsewhere (defaults to `src/data/storage-finder/generated` in the code).
- If you do not have Bun, install it from [https://bun.sh/](https://bun.sh/) or run with `pnpm dlx tsx scripts/storage-finder-data-generator/generate.ts ...`. Node does not run TypeScript by default; `tsx` provides the TypeScript loader.

## How to add or change a question

1. Add a column to the sheet that contains the signals you want to match.
2. In `scripts/storage-finder-data-generator/config.ts`, add a new facet entry to `FACET_CONFIGS`:
- Set `id` (slug), `name`, `controlType` (`radio` or `checkbox`), `column` (sheet column name), and `choices` (labels the app should show).
- Add `matchers`: regex patterns that map cell text to choice IDs. Include `allowMultipleMatches: true` if a radio question legitimately matches more than one choice.
- If no regex matches, `fallback: "all"` keeps the service visible; otherwise supply an explicit array of choice IDs.
3. Regenerate with the CLI and verify in the app.

## Service fields

Field definitions live in `scripts/storage-finder-data-generator/config.ts` (`FIELD_DEFINITIONS`). They map sheet columns to service detail rows (Links, Use Case, Limitations, Permission Settings, Eligibility, Synchronous Access, Alumni Access, Backup). Adjust labels or formatters there if the sheet schema changes.

## Naming and IDs

- Services are slugged from the `Title` column; duplicates get `-2`, `-3`, etc.
- Facet and choice IDs are slugs defined in `config.ts`; keep them stable to avoid breaking references.

## Validation rules

- Radio facets throw if more than one choice matches unless `allowMultipleMatches` is set.
- Blank cells render as “Not Available” in service fields.
- Regexes match against raw cell text; use clear keywords in the sheet for deterministic mapping.
Loading
Loading