From f14d8611ba80f7c29409c0824f5651096a734b83 Mon Sep 17 00:00:00 2001 From: Anam Navied Date: Mon, 11 May 2026 13:16:22 -0400 Subject: [PATCH] Add Instruction to ensure Copyright header is present at start of script and module files (#27408) --- .../script-module-file-format.instructions.md | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/instructions/script-module-file-format.instructions.md diff --git a/.github/instructions/script-module-file-format.instructions.md b/.github/instructions/script-module-file-format.instructions.md new file mode 100644 index 0000000000..922e0d4aa3 --- /dev/null +++ b/.github/instructions/script-module-file-format.instructions.md @@ -0,0 +1,27 @@ +--- +applyTo: + - "**/*.ps1" + - "**/*.psm1" +--- + +# Script and Module File Format + +These instructions define required file-level formatting for PowerShell scripts and module files in this repository. + +## Copyright Header + +If a change adds a new `.ps1` file or `.psm1` file or touches an existing one, the file should start with the copyright and license header and have an empty line after it, as shown in the example below: + +```powershell +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. + +``` + +Do not place blank lines, comments, or code before this header. + +## Requirements + +- Add the copyright header when creating a new `.ps1` or `.psm1` file. +- Preserve the header when editing an existing `.ps1` or `.psm1` file. +- If an existing `.ps1` or `.psm1` file is missing the header, only modify that file to add the header if a change touches that file. Do not make a change to add the header if the file is not being modified.