Skip to content

Commit d05d332

Browse files
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>
1 parent a485fc9 commit d05d332

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

scripts/clean-go-files.ps1

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
$directories = Get-ChildItem -Path $env:MainDirectory -Directory -Exclude @("core", "scripts", ".github" , "tests")
1+
# Only generated model/request-builder directories should be removed before regeneration.
2+
# Exclude hand-maintained folders and ALL dot-directories (".*" matches .github, .config,
3+
# .azure-pipelines, .vscode, .devcontainer, etc.) so repo tooling, CI and security-baseline
4+
# config are not deleted by generation runs.
5+
$directories = Get-ChildItem -Path $env:MainDirectory -Directory -Exclude @("core", "scripts", "tests", ".*")
26
foreach ($directory in $directories) {
37
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"
48
}

0 commit comments

Comments
 (0)