As a maintainer, I want to enforce that any updates to FAQ pages also update their last_updated metadata so that readers know when the content was last reviewed or changed.
🧠 Context
Currently, contributors can edit FAQ pages without updating the last_updated field in the frontmatter. This makes it unclear whether the information is still current.
We want to ensure that any time a file in the faq section is modified, its last_updated value is also updated in the same commit.
Example FAQ page structure:
---
title: "What is the COMP 1405 Z Section?"
date: 2024-10-06T00:00:00Z
last_updated: 2024-10-06T00:00:00Z
draft: false
layout: faq-question
summary: "The Z section is an accelerated course that combines the content of COMP 1405 and COMP 1406 into a single term."
contributors:
- Aditya "Jacc" Padmakar
sources:
- name: Shopify Dev Degree
link: https://devdegree.ca/
- name: Override Requests
link: https://carleton.ca/registrar/registration/override-requests/
---
We want a CI step to fail the build if a modified FAQ file does not include a change to the last_updated value.
🛠️ Implementation Plan
-
Write a Node.js script
-
Create a script called check-last-updated.js (or similar)
-
Use git diff --name-only HEAD~1 HEAD to get changed files
-
Filter for files in the faq/ directory (or wherever FAQ content is stored)
-
For each file:
- Use
git diff to check if the last_updated: line has changed
- If the file was changed but
last_updated was not, log an error
-
Add script to CI workflow
-
Optional: Add friendly error message
- Instruct contributors to update the
last_updated field when modifying FAQ content
✅ Acceptance Criteria
As a maintainer, I want to enforce that any updates to FAQ pages also update their
last_updatedmetadata so that readers know when the content was last reviewed or changed.🧠 Context
Currently, contributors can edit FAQ pages without updating the
last_updatedfield in the frontmatter. This makes it unclear whether the information is still current.We want to ensure that any time a file in the
faqsection is modified, itslast_updatedvalue is also updated in the same commit.Example FAQ page structure:
We want a CI step to fail the build if a modified FAQ file does not include a change to the
last_updatedvalue.🛠️ Implementation Plan
Write a Node.js script
Create a script called
check-last-updated.js(or similar)Use
git diff --name-only HEAD~1 HEADto get changed filesFilter for files in the
faq/directory (or wherever FAQ content is stored)For each file:
git diffto check if thelast_updated:line has changedlast_updatedwas not, log an errorAdd script to CI workflow
Create or update a GitHub Actions workflow at
.github/workflows/check-faq-updated.ymlAdd a job that:
Fail the workflow if any violations are detected
Optional: Add friendly error message
last_updatedfield when modifying FAQ content✅ Acceptance Criteria
A script exists (e.g.
check-last-updated.js) that:last_updated:is unchanged in a modified fileA GitHub Actions workflow runs the script on each PR
The CI fails with a clear message if any FAQ page is modified without updating
last_updatedOnly files in the
faq/directory are affected by this rule