provider="github"Connect GitHub
Let your Python automations work with repos, issues and pull requests as the GitHub user who runs them, through your own GitHub OAuth app.
The github preset signs people in with a GitHub OAuth app, so each run acts as the person who started it, with access to the repos they can reach.
Declare the connection
import requests
from callables import Connection, Group
github = Connection("github", provider="github", scopes=["repo"])
gh = Group("github", title="GitHub", connections=[github])
@gh.deploy(title="My open pull requests")
def my_pull_requests() -> list[dict]:
"""Pull requests you opened that are still open."""
resp = requests.get("https://api.github.com/search/issues",
headers={"Authorization": f"Bearer {github.token}", "Accept": "application/vnd.github+json"},
params={"q": "is:pr is:open author:@me"})
resp.raise_for_status()
return [{"title": i["title"], "url": i["html_url"]} for i in resp.json()["items"]]Set up the OAuth app
- In GitHub, open Settings → Developer settings → OAuth Apps → New OAuth App. For an app your company owns, create it under the organization's settings instead.
- Set Authorization callback URL to
https://callables.app/connections/callback. - Register it, then Generate a new client secret. Copy the Client ID and the secret into your project's secrets as
GITHUB_CLIENT_IDandGITHUB_CLIENT_SECRET, or the names you giveclient_id=Secret(...)andclient_secret=Secret(...).
| You want to | Scope |
|---|---|
| Read and write private and public repos | repo |
| Public repos only | public_repo |
| Read organization membership | read:org |
| Read the person's profile | read:user |
GitHub OAuth app tokens don't expire, so people stay connected until they revoke the app in their GitHub settings.
Testing locally
A GitHub OAuth app has a single callback URL. To use call connect, create a second OAuth app for local testing with the callback http://localhost:8765/callback, and put that app's ID and secret in .env.
A full step-by-step GitHub guide is on its way. Until then, the connections docs cover how connections work.
Run your scripts on each person's own account
Declare a connection, push, and share. Everyone connects once and every run uses their account.