Repository navigation
Description
Sub-issue of #5. This needs an org admin. It is the same setup as the ai-openshell-sdk-go App and its sdk-bot environment on sdk-go (ai-openshell/sdk-go#2), repeated for this repository.
Why
The automation in #5 opens a PR for each new core release tag and keeps a drift issue up to date. Release tagging will use the same identity later. Pushes and PRs made with GITHUB_TOKEN don't trigger workflows, so bump PRs would get no CI. A personal token would make one person the last pusher, and main-integrity then wouldn't let them approve the PR. A GitHub App with narrow permissions avoids both problems.
Steps
1. Create the App
Go to ai-openshell → Settings → Developer settings → GitHub Apps → New GitHub App.
| Setting | Value |
|---|---|
| GitHub App name | ai-openshell-sdk-python (matches ai-openshell-sdk-go) |
| Homepage URL | https://github.com/ai-openshell/sdk-python |
| Webhook | Uncheck Active. No webhook URL or secret. |
| Repository permissions | Contents: Read and write. Pull requests: Read and write. Issues: Read and write. Metadata: Read-only (set automatically). |
| Organization and account permissions | None |
| Where can this GitHub App be installed? | Only on this account |
The App doesn't need Workflows permission: no automation edits files under .github/workflows/. Each workflow narrows its token further per job.
2. Generate a private key and note the Client ID
On the App's General page:
- Copy the Client ID, which starts with
Iv. The workflows use the Client ID, not the numeric App ID. - Under Private keys, click Generate a private key. That downloads a
.pemfile.
3. Install the App on sdk-python only
Install App → ai-openshell → Only select repositories → sdk-python.
4. Create the sdk-bot environment
Only main may deploy to the environment. That way a workflow on a pushed branch or a fork PR can't read the secrets or mint a bot token. This matches sdk-go.
In the UI: sdk-python → Settings → Environments → New environment, name it sdk-bot. Under Deployment branches and tags, choose Selected branches and tags and add the branch rule main. Don't add required reviewers, because the scheduled jobs run unattended.
Or with gh:
gh api -X PUT repos/ai-openshell/sdk-python/environments/sdk-bot \
-F 'deployment_branch_policy[protected_branches]=false' \
-F 'deployment_branch_policy[custom_branch_policies]=true'
gh api -X POST repos/ai-openshell/sdk-python/environments/sdk-bot/deployment-branch-policies \
-f name=main -f type=branch5. Add the two environment secrets
They are environment secrets on sdk-bot, not repository secrets.
| Secret | Value |
|---|---|
SDK_BOT_CLIENT_ID |
The Client ID from step 2 |
SDK_BOT_PRIVATE_KEY |
The full contents of the .pem file, including the BEGIN and END lines |
gh secret set SDK_BOT_CLIENT_ID --repo ai-openshell/sdk-python --env sdk-bot --body '<client-id>'
gh secret set SDK_BOT_PRIVATE_KEY --repo ai-openshell/sdk-python --env sdk-bot < ai-openshell-sdk-python.*.private-key.pemThen delete the local .pem file. If the key is ever needed again, generate a new one on the App page and revoke the old one.
6. Check the setup
gh api repos/ai-openshell/sdk-python/environments/sdk-bot \
--jq '.deployment_branch_policy'
# {"custom_branch_policies":true,"protected_branches":false}
gh api repos/ai-openshell/sdk-python/environments/sdk-bot/deployment-branch-policies \
--jq '.branch_policies[].name'
# main
gh secret list --repo ai-openshell/sdk-python --env sdk-bot
# SDK_BOT_CLIENT_ID, SDK_BOT_PRIVATE_KEYThe first real use comes when #5 lands: core-watch should open a bump PR as ai-openshell-sdk-python[bot], with CI running on it.
Notes
- Rulesets: the org rulesets
dcoandmain-integritycover only the default branch. The bot pushes tocore/<tag>branches and opens PRs intomain, so it needs no bypass. Its commits carrySigned-off-by, so DCO passes. - Reusing the sdk-go App: adding
sdk-pythonto the existingai-openshell-sdk-goinstallation would also work. That needs the same environment and secrets, with a new private key for that App. A separate App keeps each repository's credentials independent and its bot name accurate, so please create the new one unless there's a reason not to. - Later: the PyPI publishing environment is a separate issue. It uses trusted publishing (OIDC), not a secret.
Done when
- The
ai-openshell-sdk-pythonApp exists with the permissions above and is installed onsdk-pythononly. - The
sdk-botenvironment exists, and onlymaincan deploy to it. -
SDK_BOT_CLIENT_IDandSDK_BOT_PRIVATE_KEYare set assdk-botenvironment secrets.
Activity
[-]Python SDK migration: GitHub App and sdk-bot environment for the automation[/-][+]ci: GitHub App and sdk-bot environment for the automation[/+]ci(release): tag, publish to PyPI and release when a stable pin lands
ci(release): tag, publish to PyPI and release when a stable pin lands
SDAChess commentedon Nov 9, 2026
This is done.