Skip to content

Add FAQ last_updated_at check CI step #587

@MathyouMB

Description

@MathyouMB

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

  1. 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
  2. Add script to CI workflow

    • Create or update a GitHub Actions workflow at .github/workflows/check-faq-updated.yml

    • Add a job that:

      • Checks out the repo
      • Installs Node
      • Runs the script
    • Fail the workflow if any violations are detected

  3. Optional: Add friendly error message

    • Instruct contributors to update the last_updated field when modifying FAQ content

✅ Acceptance Criteria

  • A script exists (e.g. check-last-updated.js) that:

    • Detects modified FAQ files
    • Fails if last_updated: is unchanged in a modified file
  • A 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_updated

  • Only files in the faq/ directory are affected by this rule

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

Status

Ready

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions