Skip to content

Fix Go generation deleting non-generated repo tooling (.config, .azure-pipelines)#1446

Open
jingjingjia-ms wants to merge 1 commit into
mainfrom
jingjingjia/fix-go-clean-preserve-dotdirs
Open

Fix Go generation deleting non-generated repo tooling (.config, .azure-pipelines)#1446
jingjingjia-ms wants to merge 1 commit into
mainfrom
jingjingjia/fix-go-clean-preserve-dotdirs

Conversation

@jingjingjia-ms

@jingjingjia-ms jingjingjia-ms commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Problem

scripts/clean-go-files.ps1 deletes every top-level directory in the target repo except a hardcoded allow-list — core, scripts, .github, tests — before regenerating:

$directories = Get-ChildItem -Path $env:MainDirectory -Directory -Exclude @("core", "scripts", ".github" , "tests")

That allow-list hasn't changed since 2023-06-12, so any directory added since then is deleted wholesale on every Go generation run (kiota only regenerates the model/request-builder dirs, so anything else just vanishes from the branch).

msgraph-sdk-go / msgraph-beta-sdk-go recently gained repo tooling that isn't in the list:

  • .azure-pipelines/ — added 2026-05-15 (daily-ci-build.yml)
  • .config/ — added 2026-05-27 (1ES autobaselining + Guardian .gdnbaselines)

So the first generation PRs created after those files were added delete them:

  • microsoftgraph/msgraph-sdk-go#1013, #1014
  • microsoftgraph/msgraph-beta-sdk-go#649

Each drops .azure-pipelines/daily-ci-build.yml, .config/1espt/PipelineAutobaseliningConfig.yml, and .config/guardian/.gdnbaselines — removing CI config and 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.

Verified in isolation: with -Exclude @("core","scripts","tests",".*"), models/applications are still returned for deletion while .github/.config/.azure-pipelines/.vscode are protected.

Both the v1.0 and beta Go stages share this script (go.yml@self), so this single change fixes both repos.

Microsoft Reviewers: Open in CodeFlow

…e-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>
@jingjingjia-ms jingjingjia-ms requested a review from a team as a code owner July 3, 2026 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant