[SPN-2931] Stop SDK regen from deleting .github/ tree#29
Merged
Conversation
PR #23 (auto/sdk-update) was deleting our entire .github/ directory on every regen — CODEOWNERS, generate.yml, publish-pypi.yml, publish-testpypi.yml, and sdk-update.yml itself all showed as removed in the bot PR. Root cause: scripts/post_generate.py runs shutil.rmtree(PROJECT_ROOT / ".github") as part of its "cleanup generator artifacts" pass. That logic was written when .github/ was 100% openapi-generator output (the Python template still writes a default .github/workflows/python.yml). Since then we've added our own workflows under .github/, but the cleanup kept indiscriminately rm-rf'ing the whole tree. Fix: 1. Add .github/** to .openapi-generator-ignore so the generator never writes there in the first place. This makes the cleanup step a no-op for .github/ regardless of what the upstream template emits. 2. Remove ".github" from post_generate.py's unwanted list with a comment explaining why it's intentionally absent (so a future maintainer doesn't re-add it). Verified locally: ran `make generate` after the change; .github/ contents are byte-identical to before, git status reports a clean working tree for the directory. Next bot run on auto/sdk-update should drop the five .github deletions from the diff. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
anderslyman
approved these changes
Jun 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PR #23 (auto/sdk-update) was deleting our entire `.github/` directory on every regen — `CODEOWNERS`, `generate.yml`, `publish-pypi.yml`, `publish-testpypi.yml`, and `sdk-update.yml` itself all showed as removed in the bot PR diff.
Root cause
`scripts/post_generate.py` did:
```python
for unwanted in [".gitlab-ci.yml", ".github", "test-requirements.txt"]:
...
elif path.is_dir():
shutil.rmtree(path)
```
That logic was written when `.github/` was 100% openapi-generator output (the Python template still writes a default `.github/workflows/python.yml`). Since then we've added our own workflows under `.github/`, but the cleanup kept indiscriminately rm-rf'ing the whole tree.
Fix
Verified
Ran `make generate` locally after the change. `.github/` contents are byte-identical to before; `git status` reports a clean working tree for the directory.
Test plan
🤖 Generated with Claude Code