Skip to content

Add FAQ last_updated_at check CI step #587

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
4 tasks
MathyouMB opened this issue May 26, 2025 · 0 comments
Open
4 tasks

Add FAQ last_updated_at check CI step #587

MathyouMB opened this issue May 26, 2025 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@MathyouMB
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Ready
Development

No branches or pull requests

2 participants