Skip to content

Validate change-notes as a PR check - #4116

Draft
mario-campos wants to merge 8 commits into
mainfrom
mario-campos/validate-cn-workflow
Draft

Validate change-notes as a PR check#4116
mario-campos wants to merge 8 commits into
mainfrom
mario-campos/validate-cn-workflow

Conversation

@mario-campos

Copy link
Copy Markdown
Contributor

This PR extends the behavior of the recently added scripts/changetool tool by adding:

  1. Support for passing a directory path. When passed, changetool will scan its contents (ignoring .gitkeep) for change-note files to validate. This feature is used directly in...
  2. A workflow job in the pr-checks.yml workflow file for executing changetool in PRs as a check.

This PR also introduces an "empty" top-level directory, unreleased-change-notes, to be the destination of future change-note files. This can be changed if another location is more suitable.

Risk assessment

For internal use only. Please select the risk level of this change:

  • Low risk: Changes are fully under feature flags, or have been fully tested and validated in pre-production environments and are highly observable, or are documentation or test only.

Which use cases does this change impact?

Workflow types:

  • N/A

Products:

  • N/A

Environments:

  • Testing/None - This change does not impact any CodeQL workflows in production.

How did/will you validate this change?

  • Unit tests - I am depending on unit test coverage (i.e. tests in .test.ts files).

If something goes wrong after this change is released, what are the mitigation and rollback strategies?

  • Development/testing only - This change cannot cause any failures in production.

How will you know if something goes wrong after this change is released?

  • N/A

Are there any special considerations for merging or releasing this change?

  • No special considerations - This change can be merged at any time.

Merge / deployment checklist

  • Confirm this change is backwards compatible with existing workflows.
  • Consider adding a changelog entry for this change.
  • Confirm the readme and docs have been updated if necessary.

@mario-campos
mario-campos requested a review from a team as a code owner August 31, 2026 16:50
Copilot AI balanced review requested due to automatic review settings August 31, 2026 16:50
@github-actions github-actions Bot added the size/M Should be of average difficulty to review label Aug 31, 2026

This comment was marked as outdated.

This comment was marked as outdated.

@github github deleted a comment from connected79844 Sep 1, 2026
mbg

This comment was marked as outdated.

@mario-campos

Copy link
Copy Markdown
Contributor Author

Closing this to re-work these changes after a migration to the pr-checks directory. Changes will be pushed to a new PR.

mario-campos and others added 5 commits September 10, 2026 21:52
This commit also introduces the 'empty' home directory for future change-notes.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Michael B. Gale <mbg@github.com>
@mario-campos
mario-campos marked this pull request as draft September 11, 2026 02:58
@mario-campos
mario-campos force-pushed the mario-campos/validate-cn-workflow branch from f2789ac to ef0cd9e Compare September 11, 2026 03:07

@mbg mbg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Appreciate that this is a draft pending the changes in the other PRs, but some drive-by comments since I saw this and you could look at incorporating the feedback when updating this PR once the others are merged.

Comment on lines +119 to +122
working-directory: pr-checks
# "unreleased-change-notes" resolves to a path relative to scripts/changetool.
# So, we need to pass the absolute path to the directory by prefixing $GITHUB_WORKSPACE.
run: npx tsx validate-changelog.ts "$GITHUB_WORKSPACE/unreleased-change-notes"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Alternatively you could not set working-directory and specify pr-checks/validate-changelog.ts as the script path. That works around the need to use $GITHUB_WORKSPACE and the lengthy explanation.

Even better, however, would be to add a constant to pr-checks/config.ts for the path joined onto REPO_ROOT and use that as the path (assuming it will always be that path).

Comment thread eslint.config.mjs
},
{
files: ["**/*.ts", "**/*.js"],
files: ["**/*.ts", "**/*.js", "**/*.mts"],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍🏻

* @param filepath The path to the change-note file or directory to validate.
* @returns True if the path is valid, false otherwise.
*/
export function isValidChangenoteFileOrDir(filepath: string): boolean {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Minor: no strong need to change this, but consider decoupling I/O from the validation logic when writing functions like this to avoid having to create real directories / files in the unit tests. Alternatively, consider stubbing the I/O operations for the tests to return the hard-coded test data, but that has the downside that it breaks test parallelism.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Should be of average difficulty to review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants