Skip to content

Add PoliCheck banned-words validation for PR titles and descriptions - #11761

Open
Galina Paskaleva (gpaskaleva-msft) wants to merge 2 commits into
mainfrom
user/gpaskaleva/github-policheck
Open

Add PoliCheck banned-words validation for PR titles and descriptions#11761
Galina Paskaleva (gpaskaleva-msft) wants to merge 2 commits into
mainfrom
user/gpaskaleva/github-policheck

Conversation

@gpaskaleva-msft

Copy link
Copy Markdown
Contributor

Summary

Adds a validation stage to the PR pipeline that scans each pull request's title and description for words that should not be shared publicly. On a match, it posts a comment on the PR and fails the check.

An equivalent check was enforced before mainline development moved to GitHub; this restores that protection so PR titles and descriptions are guarded again.

Fixes #11730

What this introduces

A new ValidatePrContent stage in build/WinUI-GitHub-PR.yml that runs on every PR:

  • Reads the PR title + description via the public GitHub API.
  • Scans them against a configured word list.
  • On a match: comments on the PR (indicating the offending word) and fails the check.
  • Skips automated bot PRs (e.g. dotnet-maestro[bot]).
  • Idempotent commenting — no duplicate comments on re-runs.

Approach

  • The word list is stored as a secret and fetched at runtime, so it is masked in logs and never exposed in pipeline output.
  • The check is self-contained: if its configuration is missing, only this stage fails — it does not block the rest of the build.
  • Reuses existing pipeline credentials — no new tokens are introduced.

Notes

  • Enabling this check requires one-time pipeline configuration (secret + authorization), tracked separately from this PR.
  • Until that configuration is in place, this stage will report as failing; the failure is isolated to this stage.

Testing

  • Validated with a throwaway PR containing a flagged word in the title/description.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@microsoft-github-policy-service microsoft-github-policy-service Bot added the needs-triage Issue needs to be triaged by the area owners label Sep 2, 2026
@gpaskaleva-msft

Copy link
Copy Markdown
Contributor Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
1 pipeline(s) were filtered out due to trigger conditions.

@gpaskaleva-msft

Copy link
Copy Markdown
Contributor Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
1 pipeline(s) were filtered out due to trigger conditions.

@harshit7962

Copy link
Copy Markdown
Contributor

Re-queuing the build as a few extra service connections have been now disabled.

@harshit7962

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
1 pipeline(s) were filtered out due to trigger conditions.

@harshit7962 Harshit (harshit7962) 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.

Still reviewing, posting single finding as of now

Comment thread build/WinUI-GitHub-PR.yml
displayName: Comment on PR about banned words
condition: and(succeeded(), eq(variables['needComment'], 'true'))
inputs:
gitHubConnection: 'WinUI'

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.

do we need to mention service connection explicitly? Also, this is not the service connection we use. Please check this again, ideally service connection should not be mentioned explicitly. Why is this needed? Also, if I am not wrong, this service connection was recently introduced, so why is it needed now?

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

Labels

needs-triage Issue needs to be triaged by the area owners

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[WinUI OSS] Enable PoliCheck on GitHub PRs

2 participants