Pulumi GitHub Provider
raw JSON → 6.13.0 verified Mon Apr 27 auth: no python
Pulumi provider for managing GitHub resources (repositories, teams, webhooks, actions, etc.). Currently at v6.13.0, requires Python >=3.9. Updates follow terraform-provider-github releases, with frequent patch releases.
pip install pulumi-github Common errors
error pulumi-github: error: 401 Bad credentials ↓
cause GitHub token not set or invalid.
fix
Set GITHUB_TOKEN environment variable or run
pulumi config set github:token <YOUR_TOKEN>. error ImportError: cannot import name 'Repository' from 'pulumi_github' ↓
cause Misnamed import or older version where resource names differed (e.g., `GithubRepository`).
fix
Use correct import:
from pulumi_github import Repository. For older releases, see docs for the exact resource name. error pulumi-github: error: 404 Not Found: repository not found ↓
cause Repository name collision or insufficient permissions.
fix
Ensure the repo name is unique in your GitHub account/org and the token has repo scope.
Warnings
gotcha Resource name (first argument) is the Pulumi logical name, not the GitHub repo name. The `name` property defines the actual GitHub repo name. ↓
fix Always set `name=` property to the desired repo name.
breaking Upgrading from Pulumi GitHub <6.0.0 requires schema changes; resources like `GithubRepository` renamed to `Repository`. See bridge upgrade guide. ↓
fix Check the provider changelog for migration steps; use `pulumi preview` before upgrade.
gotcha GitHub token must be configured via `pulumi config set github:token` or environment variable `GITHUB_TOKEN`. Missing token leads to auth errors. ↓
fix Set `GITHUB_TOKEN` env var or use `pulumi config set github:token <token>`.
deprecated Some older resources (e.g., `GithubActionsSecret`) may be deprecated in favour of `ActionsSecret`. Check the provider docs. ↓
fix Use the new namespaced resources (e.g., `ActionsSecret`).
gotcha The provider relies on the Terraform bridge; some Terraform behaviours (e.g., state drift detection) may differ from native Pulumi providers. ↓
fix Run `pulumi refresh` periodically to sync state.
Install
pulumi config set github:token <YOUR_GITHUB_TOKEN> Imports
- Repository wrong
import pulumi_github # then Repository is accessed via pulumi_github.Repositorycorrectfrom pulumi_github import Repository - Team
from pulumi_github import Team - ActionsSecret
from pulumi_github import ActionsSecret
Quickstart
import pulumi
from pulumi_github import Repository
# Set config: pulumi config set github:token <token>
repo = Repository("my-repo",
name="my-repo",
description="Created with Pulumi",
visibility="public",
has_issues=True,
)
pulumi.export("repo_url", repo.html_url)