From d05d3320f821c58d934577733afd2f8e536b4271 Mon Sep 17 00:00:00 2001 From: "Jingjing Jia (from Dev Box)" Date: Fri, 3 Jul 2026 12:00:08 -0700 Subject: [PATCH] Fix Go generation deleting non-generated repo tooling (.config, .azure-pipelines) clean-go-files.ps1 removes every top-level directory in the target repo except a hardcoded allow-list (core, scripts, .github, tests) before regenerating. That allow-list has not changed since 2023-06-12, so directories added since then are deleted wholesale on every generation run. msgraph-sdk-go / msgraph-beta-sdk-go recently gained: - .azure-pipelines/ (added 2026-05-15; daily-ci-build.yml) - .config/ (added 2026-05-27; 1ES autobaselining + Guardian .gdnbaselines) Because these are not in the allow-list and are not regenerated by kiota, every Go generation run deletes them. This surfaced in the first generation PRs created after those files were added (e.g. msgraph-sdk-go #1013/#1014, msgraph-beta-sdk-go #649), each dropping .azure-pipelines/daily-ci-build.yml, .config/1espt/PipelineAutobaseliningConfig.yml and .config/guardian/.gdnbaselines (removing Guardian security-scan baselines). Fix: exclude ALL dot-directories via the ".*" wildcard (matches .github, .config, .azure-pipelines, .vscode, .devcontainer, ...) in addition to core/scripts/tests. Generated model/request-builder directories never start with a dot, so they are still cleaned. Both v1.0 and beta Go stages share this script (go.yml@self), so this single change fixes both repos. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- scripts/clean-go-files.ps1 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/clean-go-files.ps1 b/scripts/clean-go-files.ps1 index 495dcae83..d1483fe87 100644 --- a/scripts/clean-go-files.ps1 +++ b/scripts/clean-go-files.ps1 @@ -1,4 +1,8 @@ -$directories = Get-ChildItem -Path $env:MainDirectory -Directory -Exclude @("core", "scripts", ".github" , "tests") +# Only generated model/request-builder directories should be removed before regeneration. +# Exclude hand-maintained folders and ALL dot-directories (".*" matches .github, .config, +# .azure-pipelines, .vscode, .devcontainer, etc.) so repo tooling, CI and security-baseline +# config are not deleted by generation runs. +$directories = Get-ChildItem -Path $env:MainDirectory -Directory -Exclude @("core", "scripts", "tests", ".*") foreach ($directory in $directories) { Remove-Item -Path $directory.FullName -Recurse -Force -Verbose -Exclude *change_notification*, "change_type.go", "lifecycle_event_type.go", "resource_data.go", "resource_permission.go" , "resource_permission_collection_response.go" }