-
Notifications
You must be signed in to change notification settings - Fork 193
Auto-update ms.date in docs-mslearn on PR changes #1985
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
base: dev
Are you sure you want to change the base?
Conversation
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>
There was a problem hiding this comment.
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
-Actionsparameter
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) |
| @@ -0,0 +1,69 @@ | |||
| name: Update ms.date in docs-mslearn | |||
Copilot
AI
Feb 11, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the FinOps toolkit coding guidelines, every change must have a changelog entry in docs-mslearn/toolkit/changelog.md with no exceptions for bug fixes, features, or improvements. This PR adds a new GitHub Action feature that automatically updates ms.date fields in docs-mslearn files, which is a customer-facing change that should be documented.
The changelog entry should be added under the next release version. Since package.json shows version 13.0.0, the changelog entry should be documented under the "PowerShell module v14" or similar appropriate section (or create a new unreleased section if one doesn't exist).
The changelog entry should briefly describe this new automation feature and its benefit to contributors.
| run: | | ||
| git config --local user.email "github-actions[bot]@users.noreply.github.com" | ||
| git config --local user.name "github-actions[bot]" | ||
| git add docs-mslearn/**/*.md |
Copilot
AI
Feb 11, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The git add command uses a wildcard pattern that could stage unintended files. If there are other uncommitted changes in docs-mslearn markdown files (from previous steps or manual changes), they will be included in the commit.
Consider using git add with the specific files that were modified by this workflow. Since the sed commands only modify the files in the changed-files list, you could iterate over those files or use 'git add -u docs-mslearn/' to only add tracked files that were modified, which is safer than the wildcard pattern.
| git add docs-mslearn/**/*.md | |
| git add -u docs-mslearn/ |
🛠️ Description
Add a GitHub Action workflow that automatically updates the
ms.datefield 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/workflows/update-mslearn-dates.yml): Triggers on PRs that modifydocs-mslearn/**/*.mdfiles, updates thems.datefrontmatter to the current date, and commits the change back to the PR branchAction.UpdateMsLearnDates.Tests.ps1): Validates the GitHub Action workflow structure, triggers, permissions, and security considerationsMsLearnDocs.Tests.ps1): Validates all docs-mslearn files have properms.datefrontmatter in MM/DD/YYYY format-Actionsparameter toTest-PowerShell.ps1for running GitHub Action tests (pattern:Action.*.Tests.ps1)📋 Checklist
🔬 How did you test this change?
🙋♀️ Do any of the following that apply?
📑 Did you update
docs/changelog.md?📖 Did you update documentation?