Skip to content

Commit 27fbd33

Browse files
fix(scripts): cover .github/ skill files in copyright header validation (#1055) (#1098)
The copyright header validation script (`Test-CopyrightHeaders.ps1`) was silently skipping all files under `.github/` because: 1. **`Get-ChildItem` without `-Force`** did not enumerate dot-prefixed directories (`.github/`, `.venv/`) 2. **Wildcard substring matching** for exclusions (`-like "*$excludePath*"`) caused `.git` to inadvertently match `.github`, `.gitter`, `.gitbook`, etc. This PR fixes both root causes and adds SPDX/copyright headers to the 29 Python files that were missed. ### Changes - **Centralized `$DefaultExcludePaths`** — Single source of truth for default exclusions, referenced by both the script parameter and `Invoke-CopyrightHeaderCheck` - **Regex-based exclusion** — Replaced wildcard substring matching with path-separator-anchored regex (`[/\\](?:name)(?:[/\\]|$)`), preventing partial-prefix false matches - **`-Force` on `Get-ChildItem`** — Ensures dot-prefixed directories are enumerated - **13 new Pester tests** — Exclusion logic boundary tests and AST-based drift prevention tests - **29 Python files** — Added `# Copyright (c) Microsoft Corporation.` and `# SPDX-License-Identifier: MIT` headers ## Related Issue(s) Fixes #1055 ## Type of Change Select all that apply: **Code & Documentation:** * [x] Bug fix (non-breaking change fixing an issue) * [ ] New feature (non-breaking change adding functionality) * [ ] Breaking change (fix or feature causing existing functionality to change) * [ ] Documentation update **Infrastructure & Configuration:** * [ ] GitHub Actions workflow * [x] Linting configuration (markdown, PowerShell, etc.) * [ ] Security configuration * [ ] DevContainer configuration * [ ] Dependency update **AI Artifacts:** * [ ] Reviewed contribution with `prompt-builder` agent and addressed all feedback * [ ] Copilot instructions (`.github/instructions/*.instructions.md`) * [ ] Copilot prompt (`.github/prompts/*.prompt.md`) * [ ] Copilot agent (`.github/agents/*.agent.md`) * [ ] Copilot skill (`.github/skills/*/SKILL.md`) **Other:** * [x] Script/automation (`.ps1`, `.sh`, `.py`) * [ ] Other (please describe): ## Testing - **44 Pester tests passing** (31 existing + 13 new) covering: - Individual exclusion validation (`.git`, `.venv`, `.copilot-tracking`, `node_modules`) - Partial-prefix safety (`.git` not matching `.github`, `.gitter`, `.gitbook`) - `-Force` enumeration of dot-directories - Empty exclusions baseline, multiple simultaneous exclusions, deep nesting, custom paths, overlapping extensions - AST-based introspection verifying `$DefaultExcludePaths` contents and function parameter default alignment - **139/139 copyright headers passing** across all scanned files - **0 PSScriptAnalyzer findings** on changed scripts ## Checklist ### Required Checks * [x] Documentation is updated (if applicable) * [x] Files follow existing naming conventions * [x] Changes are backwards compatible (if applicable) * [x] Tests added for new functionality (if applicable) ### Required Automated Checks The following validation commands must pass before merging: * [x] Markdown linting: `npm run lint:md` * [x] Spell checking: `npm run spell-check` * [x] Frontmatter validation: `npm run lint:frontmatter` * [x] Skill structure validation: `npm run validate:skills` (pre-existing warnings only — `.pytest_cache`, `.ruff_cache`, `.venv` in powerpoint skill) * [x] Link validation: `npm run lint:md-links` (0 broken links) * [x] PowerShell analysis: `npm run lint:ps` * [ ] Plugin freshness: `npm run plugin:generate` (no plugin changes in this PR) ## Security Considerations * [x] This PR does not contain any sensitive or NDA information * [x] Any new dependencies have been reviewed for security issues * [x] Security-related scripts follow the principle of least privilege ## Additional Notes - Exclusion regex uses `[regex]::Escape()` on path names, preventing regex injection from exclusion entries. - The `-Force` fix was the primary root cause — without it, `Get-ChildItem` silently skips `.github/skills/` on Windows. --------- Co-authored-by: Katrien De Graeve <katriendg@users.noreply.github.com>
1 parent dec56ac commit 27fbd33

31 files changed

Lines changed: 278 additions & 15 deletions

.github/skills/experimental/powerpoint/scripts/build_deck.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# SPDX-License-Identifier: MIT
13
"""Build a PowerPoint slide deck from YAML content and style definitions.
24
35
Usage::

.github/skills/experimental/powerpoint/scripts/export_slides.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# SPDX-License-Identifier: MIT
13
"""Export PowerPoint slides to PDF with optional slide filtering.
24
35
Converts a PPTX file to PDF using LibreOffice headless mode. When specific

.github/skills/experimental/powerpoint/scripts/extract_content.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# SPDX-License-Identifier: MIT
13
"""Extract content from an existing PPTX into YAML content and style definitions.
24
35
Usage::

.github/skills/experimental/powerpoint/scripts/pptx_charts.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# SPDX-License-Identifier: MIT
13
"""Chart build and extract utilities for PowerPoint skill scripts.
24
35
Provides add_chart_element() for building charts from YAML definitions

.github/skills/experimental/powerpoint/scripts/pptx_colors.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# SPDX-License-Identifier: MIT
13
"""Color resolution and conversion utilities for PowerPoint skill scripts.
24
35
Supports #RRGGBB hex values and @theme_name references for theme colors.

.github/skills/experimental/powerpoint/scripts/pptx_fills.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# SPDX-License-Identifier: MIT
13
"""Fill and line application/extraction utilities for PowerPoint skill scripts.
24
35
Handles solid, gradient, and pattern fills plus line/border properties.

.github/skills/experimental/powerpoint/scripts/pptx_fonts.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# SPDX-License-Identifier: MIT
13
"""Font normalization, matching, and extraction utilities.
24
35
Centralizes font-related constants and functions used by

.github/skills/experimental/powerpoint/scripts/pptx_shapes.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# SPDX-License-Identifier: MIT
13
"""Shape constants, maps, and rotation utilities for PowerPoint skill scripts.
24
35
Provides the expanded SHAPE_MAP (30+ entries), an inverse AUTO_SHAPE_NAME_MAP

.github/skills/experimental/powerpoint/scripts/pptx_tables.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# SPDX-License-Identifier: MIT
13
"""Table build and extract utilities for PowerPoint skill scripts.
24
35
Provides add_table_element() for building tables from YAML definitions

.github/skills/experimental/powerpoint/scripts/pptx_text.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# SPDX-License-Identifier: MIT
13
"""Text frame, paragraph, and run property utilities for PowerPoint skill scripts.
24
35
Centralizes text properties (margins, auto-size, spacing, underline,

0 commit comments

Comments
 (0)