GitHub OAuth
JsWorkflows provides a platform-managed GitHub OAuth app — you do not need to create a GitHub OAuth app or provide credentials.
Available scopes
Section titled “Available scopes”| Resource | Operation | Scope |
|---|---|---|
| Repositories | Read public repositories | public_repo |
| Repositories | Read/write all repositories (including private) | repo |
| Issues & Pull Requests | Create/update issues & PRs | repo |
| GitHub Actions | Manage workflow files | workflow |
| User Profile | Read user profile | read:user |
| User Profile | Read user email | user:email |
| Notifications | Read & manage notifications | notifications |
Connecting
Section titled “Connecting”- Go to OAuth Connections → Add Connection → GitHub.
- Select the resources and operations your workflow needs.
- Sign in with your GitHub account and grant the requested permissions.
- Give the connection a handle (e.g.,
my-github).
GitHub OAuth tokens do not expire and are not automatically refreshed.
Example — create an issue
Section titled “Example — create an issue”class Workflow { async start(data, headers, api) { const { token, error } = await api.getOAuthToken('my-github'); if (error) { api.log('OAuth error:', error); return; }
await fetch('https://api.github.com/repos/{owner}/{repo}/issues', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${token}`, 'Accept': 'application/vnd.github+json', }, body: JSON.stringify({ title: `Order ${data.name} requires attention`, body: `Order total: ${data.total_price} ${data.currency}\nCustomer: ${data.email}`, }), }); }}Example — trigger a GitHub Actions workflow
Section titled “Example — trigger a GitHub Actions workflow”const { token } = await api.getOAuthToken('my-github');await fetch('https://api.github.com/repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${token}`, 'Accept': 'application/vnd.github+json', }, body: JSON.stringify({ ref: 'main' }),});