Add workflow to verify copyright headers in changed code#26201
Conversation
Co-authored-by: TravisEz13 <10873629+TravisEz13@users.noreply.github.com>
Co-authored-by: TravisEz13 <10873629+TravisEz13@users.noreply.github.com>
Co-authored-by: TravisEz13 <10873629+TravisEz13@users.noreply.github.com>
…idelines.md changes Co-authored-by: TravisEz13 <10873629+TravisEz13@users.noreply.github.com>
Co-authored-by: TravisEz13 <10873629+TravisEz13@users.noreply.github.com>
Co-authored-by: TravisEz13 <10873629+TravisEz13@users.noreply.github.com>
|
https://github.com/dotnet/runtime doesn't use a copyright header for |
|
…psm1, .psd1; remove duplicate GitHub Script check; use path-filters action Co-authored-by: TravisEz13 <10873629+TravisEz13@users.noreply.github.com>
Done in commit 8c8f8f4. Changes made:
The workflow now triggers only on changes to the four supported file types and uses the path-filters action you referenced. |
|
The copyright header string is already defined in |
@xtqqczze Do you want to submit a PR? I was mostly just trying to see if GitHub Copilot agent could handle this. |
|
I don't think the current approach will work, we have to account for files like: |
|
However, dotnet format does not format files that aren’t included in a project or solution. I know we have files that are not compiled. |
We don't have to mark this as a required workflow. We can mark it as informational, and the intent is for it to only run on changed filed. |
We don't have to mark this as a required workflow. We can mark it as informational and the intent is for it to only run on changed filed.
That PR is too broad and unlikely to get merged. Look at the code owners file and split it into chunks that a single maintainer can approve. Feel free to start with my areas. |
|
This pull request has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 15 days. It will be closed if no further activity occurs within 10 days of this comment. |
Summary
This PR adds an automated GitHub Actions workflow that verifies all changed source code files include the proper Microsoft copyright header. The workflow runs on Linux and uses PowerShell for verification.
Changes
New Copyright Verification Script (
tools/verifyCopyright.ps1)//) for C# files (.cs)#) for PowerShell files (.ps1,.psm1,.psd1)New GitHub Actions Workflow (
.github/workflows/verify-copyright.yml).github/actions/infrastructure/path-filtersaction to detect changed files.cs,.ps1,.psm1,.psd1)Documentation Updates (
.github/CONTRIBUTING.md)Testing
The verification script has been thoroughly tested with:
Example Usage
When a PR is submitted with files missing copyright headers, the workflow will fail and display:
Contributors can also run the script locally:
Fixes the requirement to verify copyright headers on all changed code in pull requests.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.