Automate jobs board with schema validation#360
Automate jobs board with schema validation#360shibo911 wants to merge 11 commits intopybamm-team:mainfrom
Conversation
✅ Deploy Preview for pybamm-developer-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Thanks, @shibo911! Could you please investigate the build failure? |
|
BTW, you may use |
thanks, i will try to fix the pr |
…YAML via schema without unsupported flag\n- hugo: suppress legacy GetJSON error from theme (ignoreLogs)\n- css: robust badge spacing and layout for jobs cards\n- jobs: use transform.Unmarshal for YAML loading (no GetJSON)
|
Update: Build fixed; preview ready. Fixes
Verification
Notes
Ready for review. |
There was a problem hiding this comment.
Hi @shibo911, this is a good start! There is a lot of code here and while the output looks good on the deploy preview, there are a few things to consider – please see my comments below.
Also, for an individual job, I think we should use the card shortcode to include the data, and for the fields such "100% time", "Remote", etc., these should be included as badges.
My main concern is the use of AI-written code in this PR, which is generally okay as long as the code is good, but right now there are many existing patterns in the theme that the language model you've used has not accounted for. It is necessary to implement this carefully, as there is a maintenance burden attached to this new code and we'd like it if this code were to not break over the course of the many years that this website will be maintained for.
config.yaml
Outdated
| # Suppress legacy GetJSON errors originating from theme code | ||
| ignoreLogs: | ||
| - error-remote-getjson | ||
|
|
There was a problem hiding this comment.
Where is the GetJSON error coming from the theme code? Could you please elaborate? I don't see anything here: https://github.com/search?q=repo:scientific-python/scientific-python-hugo-theme+GetJSON&type=code
There was a problem hiding this comment.
addressed, I added that line to test my pr locally. I think there must have been some issue while building the server thats why i added those line, I should have restored some files while pushing git but that's a terrible mistake on my end.
.pre-commit-config.yaml
Outdated
| - id: ruff | ||
| args: ["--fix", "--show-fixes"] | ||
|
|
||
| # Jobs board validation (schema-based) |
There was a problem hiding this comment.
| # Jobs board validation (schema-based) |
The code is self-explanatory, so this doesn't need a comment
.pre-commit-config.yaml
Outdated
|
|
||
| # Jobs board validation (schema-based) | ||
| - repo: https://github.com/python-jsonschema/check-jsonschema | ||
| rev: 0.33.3 |
There was a problem hiding this comment.
| rev: 0.33.3 | |
| rev: 0.36.0 |
Is there a reason for using 0.33.3 instead of the latest release available? https://github.com/python-jsonschema/check-jsonschema
There was a problem hiding this comment.
addressed, used the latest version
layouts/partials/jobs/list.html
Outdated
| {{/* | ||
| Load only YAML postings from data/jobs/*.yaml. | ||
| Avoid reading data/jobs/schema.json (used only for validation). | ||
| */}} |
There was a problem hiding this comment.
This should be cleaned up; it is easy to understand that the file is used only for validation is redundant for the partial.
There was a problem hiding this comment.
understood and addressed
| {{- range (readDir "data/jobs") -}} | ||
| {{- if and (not .IsDir) (hasSuffix .Name ".yaml") (ne .Name "_TEMPLATE.yaml") -}} | ||
| {{- $path := printf "data/jobs/%s" .Name -}} | ||
| {{- $data := (readFile $path | transform.Unmarshal) -}} | ||
| {{- $key := replaceRE "\\.yaml$" "" .Name -}} | ||
| {{- $job := dict "key" $key | merge $data -}} | ||
| {{- $jobs = $jobs | append $job -}} | ||
| {{- end -}} | ||
| {{- end -}} | ||
|
|
||
| {{/* partition */}} | ||
| {{- $open := slice -}} | ||
| {{- $archived := slice -}} | ||
| {{- range $jobs -}} | ||
| {{- $exp := .expires -}} | ||
| {{- if or (not $exp) (ge (time $exp) $now) -}} | ||
| {{- $open = $open | append . -}} | ||
| {{- else -}} | ||
| {{- $archived = $archived | append . -}} | ||
| {{- end -}} | ||
| {{- end -}} |
There was a problem hiding this comment.
I think this can be simplified – see https://stackoverflow.com/a/33233395 for an example?
There was a problem hiding this comment.
addressed. refactored the layouts/partials/jobs/list.html to simplify data loading using hugo’s built-in data mechanism, per the review suggestion
content/jobs.md
Outdated
| 1. Open a pull request adding a YAML file at data/jobs/ following data/jobs/_TEMPLATE.yaml. | ||
| 2. Ensure dates are in YYYY-MM-DD and include a working https:// or http:// URL. | ||
| 3. Optionally, also [email us](mailto:pybamm@pybamm.org) for visibility. | ||
| 4. If applicable, make a payment or donation as per our policy. |
There was a problem hiding this comment.
Marking this comment as we'll need to get some confirmation on the proposed flow for this. @brosaplanella would be the best person to answer this, since he opened #352.
There was a problem hiding this comment.
addressed, added a neutral line just stating the submission instructions, about opening a PR through template.
content/jobs.md
Outdated
| --- | ||
|
|
||
| Welcome to the PyBaMM Jobs Board! Here you can find current job openings related to PyBaMM and battery modeling. If you're interested in contributing to the future of battery simulation and modeling, check out the opportunities below. | ||
| Welcome to the PyBaMM Jobs Board! This page is generated from simple YAML files under data/jobs/. |
There was a problem hiding this comment.
Let's bring back the previous sentence here
There was a problem hiding this comment.
It looks like the code in this file was generated with AI. While we are okay with the use of AI-written code, we consider it your responsibility to thoroughly review it and address any potential mistakes. Could you please remove the comments indicative of AI and remove the redundant CSS rules from here?
Also, these styles will apply to the entire website, so we must ensure that they affect only the jobs page.
There was a problem hiding this comment.
addressed and applied the requested clean up and scoping
scoped jobs styles to jobs page and removed ai indicative and verbose comments, also avoided unnecessary global impact, now job related rules are isolated under .jobs-board
| .markdown .adm, .markdown .adm * { | ||
| color: var(--text, #f1f5f9) !important; | ||
| } | ||
| .adm a { color: var(--primary, #9ae6b4) !important; } | ||
| /* Provide a gentle dark surface without hardcoding brand colors */ | ||
| .adm { background: var(--surface-2, rgba(255,255,255,0.06)) !important; } | ||
| } |
There was a problem hiding this comment.
Instead of !importants, we should address any dark theme problem upstream with the theme itself – I would advise against using them unless they're really needed
There was a problem hiding this comment.
addressed, removed !important and used selector specificity as advised
layouts/partials/jobs/list.html
Outdated
| <details> | ||
| <summary><h2 id="archived-roles" style="display:inline">Archived roles</h2></summary> | ||
| {{- $sortedArchived := sort $archived "expires" "desc" -}} | ||
| {{- if gt (len $sortedArchived) 0 -}} | ||
| {{- range $sortedArchived -}} | ||
| {{ partial "jobs/card.html" (dict "job" . "now" $now) }} | ||
| {{- end -}} | ||
| {{- else -}} | ||
| <p>No archived roles yet.</p> | ||
| {{- end -}} | ||
| </details> |
There was a problem hiding this comment.
This should use the theme's details shortcode instead of inline HTML code.
There was a problem hiding this comment.
addressed, removed the raw HTML and used the theme's detail shortcode
|
I will work on the comments. Thank you for the thorough review! |
…ump schema validator
…when .Site.Data is empty
…e robust across builds)

Fixes #352
Summary
data/jobs/using a shortcode + partials.expiresdate; archived retained and collapsed by default.deadlineasc; Archived byexpiresdesc.check-jsonschema+data/jobs/schema.json.How to test
pre-commit run --all-fileshugo server -Dand visit/jobs/