Skip to content

[SPN-2931] Stop SDK regen from deleting .github/ tree#29

Merged
drago1216 merged 1 commit into
mainfrom
aaronbarnes/SPN-2931-protect-github
Jun 1, 2026
Merged

[SPN-2931] Stop SDK regen from deleting .github/ tree#29
drago1216 merged 1 commit into
mainfrom
aaronbarnes/SPN-2931-protect-github

Conversation

@drago1216

Copy link
Copy Markdown
Contributor

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

  1. Add `.github/**` to `.openapi-generator-ignore` so the generator never writes there in the first place. The cleanup step then becomes 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 so a future maintainer doesn't re-add it.

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

  • Re-trigger `sdk-update.yml` after merge; the bot PR should no longer show `.github/` deletions.

🤖 Generated with Claude Code

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>
@drago1216 drago1216 requested a review from a team as a code owner June 1, 2026 19:59
@drago1216 drago1216 merged commit 6181f5c into main Jun 1, 2026
5 checks passed
@drago1216 drago1216 deleted the aaronbarnes/SPN-2931-protect-github branch June 1, 2026 20:22
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.

2 participants