Skip to content

Auto-update ms.date in docs-mslearn on PR changes - #1985

Merged
Michael Flanakin (flanakin) merged 2 commits into
devfrom
flanakin/mslearn-dates
Feb 23, 2026
Merged

Auto-update ms.date in docs-mslearn on PR changes#1985
Michael Flanakin (flanakin) merged 2 commits into
devfrom
flanakin/mslearn-dates

Conversation

@flanakin

Copy link
Copy Markdown
Collaborator

🛠️ Description

Add a GitHub Action workflow that automatically updates the ms.date field in docs-mslearn markdown files when they are modified in a pull request. This ensures documentation dates stay current without manual intervention.

Changes include:

  • GitHub Action (.github/workflows/update-mslearn-dates.yml): Triggers on PRs that modify docs-mslearn/**/*.md files, updates the ms.date frontmatter to the current date, and commits the change back to the PR branch
  • Unit test (Action.UpdateMsLearnDates.Tests.ps1): Validates the GitHub Action workflow structure, triggers, permissions, and security considerations
  • Lint test (MsLearnDocs.Tests.ps1): Validates all docs-mslearn files have proper ms.date frontmatter in MM/DD/YYYY format
  • Test runner update: Added -Actions parameter to Test-PowerShell.ps1 for running GitHub Action tests (pattern: Action.*.Tests.ps1)

📋 Checklist

🔬 How did you test this change?

  • 🤏 Lint tests
  • 🤞 PS -WhatIf / az validate
  • 👍 Manually deployed + verified
  • 💪 Unit tests
  • 🙌 Integration tests

🙋‍♀️ Do any of the following that apply?

  • 🚨 This is a breaking change.
  • 🤏 The change is less than 20 lines of code.

📑 Did you update docs/changelog.md?

  • ✅ Updated changelog (required for dev PRs)
  • ➡️ Will add log in a future PR (feature branch PRs only)
  • ❎ Log not needed (small/internal change)

📖 Did you update documentation?

  • ✅ Public docs in docs (required for dev)
  • ✅ Public docs in docs-mslearn (required for dev)
  • ✅ Internal dev docs in docs-wiki (required for dev)
  • ✅ Internal dev docs in src (required for dev)
  • ➡️ Will add docs in a future PR (feature branch PRs only)
  • ❎ Docs not needed (small/internal change)

Add GitHub Action workflow that automatically updates the ms.date field
in docs-mslearn markdown files when they are modified in a pull request.
This ensures documentation dates stay current without manual intervention.

Also adds:
- Pester unit test to validate the GitHub Action workflow
- Pester lint test to validate ms.date format in all docs-mslearn files
- New -Actions parameter to Test-PowerShell.ps1 for running Action tests

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces automation to keep Microsoft Learn documentation dates current by automatically updating the ms.date field in docs-mslearn markdown files when they are modified in a pull request. This reduces manual maintenance burden and ensures documentation metadata stays accurate.

Changes:

  • Adds a GitHub Action workflow that triggers on docs-mslearn markdown file changes, updates ms.date to the current date, and commits the change back to the PR branch
  • Implements comprehensive unit tests for the GitHub Action workflow structure and security
  • Adds lint tests to validate ms.date format compliance across all docs-mslearn files
  • Extends the test runner to support GitHub Action tests with a new -Actions parameter

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
.github/workflows/update-mslearn-dates.yml New workflow that auto-updates ms.date fields in changed docs-mslearn markdown files
src/powershell/Tests/Unit/Action.UpdateMsLearnDates.Tests.ps1 Unit tests validating workflow structure, triggers, permissions, and security
src/powershell/Tests/Lint/MsLearnDocs.Tests.ps1 Lint tests ensuring ms.date format compliance (MM/DD/YYYY) across all docs-mslearn files
src/scripts/Test-PowerShell.ps1 Added -Actions parameter to run GitHub Action tests (Action.*.Tests.ps1 pattern)

Comment thread .github/workflows/update-mslearn-dates.yml
Comment thread .github/workflows/update-mslearn-dates.yml Outdated
@flanakin Michael Flanakin (flanakin) added this to the v14 milestone Feb 11, 2026
@flanakin Michael Flanakin (flanakin) changed the title feat: Auto-update ms.date in docs-mslearn on PR changes Auto-update ms.date in docs-mslearn on PR changes Feb 11, 2026
@flanakin Michael Flanakin (flanakin) added Skill: DevOps GitHub setup and automation Skill: Documentation Documentation updates Tool: FinOps guide Implementing FinOps guide and removed Skill: Documentation Documentation updates labels Feb 11, 2026
Use `git add -u docs-mslearn/` instead of wildcard pattern to only
stage tracked files that were actually modified by the workflow.

🤖 Generated with [Claude Code](https://claude.ai/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@flanakin

Copy link
Copy Markdown
Collaborator Author

🤖 [AI][Claude] PR Update Summary

Addressed: 2 thread(s)

  • ✅ Implemented: 1
  • 🤔 Needs discussion: 1
  • ❓ Questions: 0

Changes: Updated git add command in workflow to use -u flag for safer file staging. Pushed back on changelog requirement since this is an internal CI/CD change.

@flanakin
Michael Flanakin (flanakin) merged commit 3d0df1d into dev Feb 23, 2026
5 checks passed
@flanakin
Michael Flanakin (flanakin) deleted the flanakin/mslearn-dates branch February 23, 2026 08:05
Michael Flanakin (flanakin) added a commit that referenced this pull request Mar 10, 2026
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs: Review 👀 PR that is ready to be reviewed Skill: DevOps GitHub setup and automation Tool: FinOps guide Implementing FinOps guide

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants