Organization

class github.Organization.Organization

This class represents Organizations.

The reference can be found here https://docs.github.com/en/rest/reference/orgs

add_to_members(member: NamedUser, role: Opt[str] = NotSet) → None
Calls

PUT /orgs/{org}/memberships/{user}

add_to_public_members(public_member: NamedUser) → None
Calls

PUT /orgs/{org}/public_members/{user}

create_fork(repo: Repository, name: Opt[str] = NotSet, default_branch_only: Opt[bool] = NotSet) → Repository
Calls

POST /repos/{owner}/{repo}/forks

create_repo_from_template(name: str, repo: Repository, description: Opt[str] = NotSet, include_all_branches: Opt[bool] = NotSet, private: Opt[bool] = NotSet) → Repository

self.name :calls: POST /repos/{template_owner}/{template_repo}/generate

create_hook(name: str, config: dict[str, str], events: Opt[list[str]] = NotSet, active: Opt[bool] = NotSet) → Hook
Calls

POST /orgs/{owner}/hooks

Parameters
  • name – string

  • config – dict

  • events – list of string

  • active – bool

Return type

github.Hook.Hook

create_project(name: str, body: Union[str, github.GithubObject._NotSetType] = NotSet) → github.Project.Project
Calls

POST /orgs/{org}/projects

create_repo(name: str, description: Opt[str] = NotSet, homepage: Opt[str] = NotSet, private: Opt[bool] = NotSet, visibility: Opt[str] = NotSet, has_issues: Opt[bool] = NotSet, has_wiki: Opt[bool] = NotSet, has_downloads: Opt[bool] = NotSet, has_projects: Opt[bool] = NotSet, team_id: Opt[int] = NotSet, auto_init: Opt[bool] = NotSet, license_template: Opt[str] = NotSet, gitignore_template: Opt[str] = NotSet, allow_squash_merge: Opt[bool] = NotSet, allow_merge_commit: Opt[bool] = NotSet, allow_rebase_merge: Opt[bool] = NotSet, delete_branch_on_merge: Opt[bool] = NotSet, allow_update_branch: Opt[bool] = NotSet, is_template: Opt[bool] = NotSet, allow_auto_merge: Opt[bool] = NotSet, use_squash_pr_title_as_default: Opt[bool] = NotSet, squash_merge_commit_title: Opt[str] = NotSet, squash_merge_commit_message: Opt[str] = NotSet, merge_commit_title: Opt[str] = NotSet, merge_commit_message: Opt[str] = NotSet, custom_properties: Opt[dict[str, Any]] = NotSet) → github.Repository.Repository
Calls

POST /orgs/{org}/repos

create_secret(secret_name: str, unencrypted_value: str, visibility: str = 'all', selected_repositories: Opt[list[github.Repository.Repository]] = NotSet, secret_type: str = 'actions') → github.OrganizationSecret.OrganizationSecret
Parameters
  • secret_name – string name of the secret

  • unencrypted_value – string plain text value of the secret

  • visibility – string options all or selected

  • selected_repositories – list of repositrories that the secret will be available in

  • secret_type – string options actions or dependabot

Calls

PUT /orgs/{org}/{secret_type}/secrets/{secret_name}

get_secrets(secret_type: str = 'actions') → PaginatedList[OrganizationSecret]

Gets all organization secrets :param secret_type: string options actions or dependabot :rtype:

PaginatedList of github.OrganizationSecret.OrganizationSecret

get_secret(secret_name: str, secret_type: str = 'actions') → OrganizationSecret
Calls

‘GET /orgs/{org}/{secret_type}/secrets/{secret_name} <https://docs.github.com/en/rest/actions/secrets#get-an-organization-secret>`_

Parameters
  • secret_name – string

  • secret_type – string options actions or dependabot

Return type

github.OrganizationSecret.OrganizationSecret

create_team(name: str, repo_names: Opt[list[Repository]] = NotSet, permission: Opt[str] = NotSet, privacy: Opt[str] = NotSet, description: Opt[str] = NotSet, parent_team_id: Opt[int] = NotSet, maintainers: Opt[list[int]] = NotSet, notification_setting: Opt[str] = NotSet) → Team
Calls

POST /orgs/{org}/teams

Parameters
  • name – string

  • repo_names – list of github.Repository.Repository

  • permission – string

  • privacy – string

  • description – string

  • parent_team_id – integer

  • maintainers – list of: integer

  • notification_setting – string

Return type

github.Team.Team

create_variable(variable_name: str, value: str, visibility: str = 'all', selected_repositories: github.GithubObject.Opt[list[github.Repository.Repository]] = NotSet) → github.OrganizationVariable.OrganizationVariable
Calls

POST /orgs/{org}/actions/variables/

Parameters
Return type

github.OrganizationVariable.OrganizationVariable

get_variables() → PaginatedList[OrganizationVariable]

Gets all organization variables :rtype: PaginatedList of github.OrganizationVariable.OrganizationVariable

get_variable(variable_name: str) → OrganizationVariable
Calls

‘GET /orgs/{org}/actions/variables/{variable_name} <https://docs.github.com/en/rest/actions/variables#get-an-organization-variable>`_

Parameters

variable_name – string

Return type

github.OrganizationVariable.OrganizationVariable

delete_hook(id: int) → None
Calls

DELETE /orgs/{owner}/hooks/{id}

Parameters

id – integer

Return type

None`

edit(billing_email: Union[str, github.GithubObject._NotSetType] = NotSet, blog: Union[str, github.GithubObject._NotSetType] = NotSet, company: Union[str, github.GithubObject._NotSetType] = NotSet, description: Union[str, github.GithubObject._NotSetType] = NotSet, email: Union[str, github.GithubObject._NotSetType] = NotSet, location: Union[str, github.GithubObject._NotSetType] = NotSet, name: Union[str, github.GithubObject._NotSetType] = NotSet) → None
Calls

PATCH /orgs/{org}

edit_hook(id: int, name: str, config: dict[str, str], events: Opt[list[str]] = NotSet, active: Opt[bool] = NotSet) → Hook
Calls

PATCH /orgs/{owner}/hooks/{id}

get_events() → PaginatedList[Event]
Calls

GET /orgs/{org}/events

Return type

PaginatedList of github.Event.Event

get_hook(id: int) → github.Hook.Hook
Calls

GET /orgs/{owner}/hooks/{id}

get_hooks() → PaginatedList[Hook]
Calls

GET /orgs/{owner}/hooks

get_hook_delivery(hook_id: int, delivery_id: int) → github.HookDelivery.HookDelivery
Calls

GET /orgs/{owner}/hooks/{hook_id}/deliveries/{delivery_id}

Parameters
  • hook_id – integer

  • delivery_id – integer

Return type

github.HookDelivery.HookDelivery

get_hook_deliveries(hook_id: int) → github.PaginatedList.PaginatedList[github.HookDelivery.HookDeliverySummary][github.HookDelivery.HookDeliverySummary]
Calls

GET /orgs/{owner}/hooks/{hook_id}/deliveries

Parameters

hook_id – integer

Return type

PaginatedList of github.HookDelivery.HookDeliverySummary

get_issues(filter: Opt[str] = NotSet, state: Opt[str] = NotSet, labels: Opt[list[Label]] = NotSet, sort: Opt[str] = NotSet, direction: Opt[str] = NotSet, since: Opt[datetime] = NotSet) → PaginatedList[Issue]
Calls

GET /orgs/{org}/issues

Return type

PaginatedList of github.Issue.Issue

Parameters
  • filter – string

  • state – string

  • labels – list of github.Label.Label

  • sort – string

  • direction – string

  • since – datetime

Return type

PaginatedList of github.Issue.Issue

get_members(filter_: Opt[str] = NotSet, role: Opt[str] = NotSet) → PaginatedList[NamedUser]
Calls

GET /orgs/{org}/members

get_projects(state: Opt[str] = NotSet) → PaginatedList[Project]
Calls

GET /orgs/{org}/projects

get_public_members() → PaginatedList[NamedUser]
Calls

GET /orgs/{org}/public_members

Return type

PaginatedList of github.NamedUser.NamedUser

get_outside_collaborators(filter_: Opt[str] = NotSet) → PaginatedList[NamedUser]
Calls

GET /orgs/{org}/outside_collaborators

remove_outside_collaborator(collaborator: NamedUser) → None
Calls

DELETE /orgs/{org}/outside_collaborators/{username}

Parameters

collaboratorgithub.NamedUser.NamedUser

Return type

None

convert_to_outside_collaborator(member: NamedUser) → None
Calls

PUT /orgs/{org}/outside_collaborators/{username}

Parameters

membergithub.NamedUser.NamedUser

Return type

None

get_public_key(secret_type: str = 'actions') → PublicKey
Calls

GET /orgs/{org}/{secret_type}/secrets/public-key

Parameters

secret_type – string options actions or dependabot

Return type

github.PublicKey.PublicKey

get_repo(name: str) → Repository
Calls

GET /repos/{owner}/{repo}

Parameters

name – string

Return type

github.Repository.Repository

get_repos(type: Opt[str] = NotSet, sort: Opt[str] = NotSet, direction: Opt[str] = NotSet) → PaginatedList[Repository]
Calls

GET /orgs/{org}/repos

Parameters
  • type – string (‘all’, ‘public’, ‘private’, ‘forks’, ‘sources’, ‘member’)

  • sort – string (‘created’, ‘updated’, ‘pushed’, ‘full_name’)

  • direction – string (‘asc’, desc’)

get_team(id: int) → Team
Calls

GET /teams/{id}

get_team_by_slug(slug: str) → Team
Calls

GET /orgs/{org}/teams/{team_slug}

get_teams() → PaginatedList[Team]
Calls

GET /orgs/{org}/teams

invitations() → PaginatedList[NamedUser]
Calls

GET /orgs/{org}/invitations

invite_user(user: Opt[NamedUser] = NotSet, email: Opt[str] = NotSet, role: Opt[str] = NotSet, teams: Opt[list[Team]] = NotSet) → None
Calls

POST /orgs/{org}/invitations

Parameters
Return type

None

cancel_invitation(invitee: NamedUser) → bool
Calls

DELETE /orgs/{org}/invitations/{invitation_id}

Parameters

inviteegithub.NamedUser.NamedUser

Return type

None

has_in_members(member: NamedUser) → bool
Calls

GET /orgs/{org}/members/{user}

Parameters

membergithub.NamedUser.NamedUser

Return type

bool

has_in_public_members(public_member: NamedUser) → bool
Calls

GET /orgs/{org}/public_members/{user}

Parameters

public_membergithub.NamedUser.NamedUser

Return type

bool

remove_from_membership(member: NamedUser) → None
Calls

DELETE /orgs/{org}/memberships/{user}

Parameters

membergithub.NamedUser.NamedUser

Return type

None

remove_from_members(member: NamedUser) → None
Calls

DELETE /orgs/{org}/members/{user}

Parameters

membergithub.NamedUser.NamedUser

Return type

None

remove_from_public_members(public_member: NamedUser) → None
Calls

DELETE /orgs/{org}/public_members/{user}

Parameters

public_membergithub.NamedUser.NamedUser

Return type

None

create_migration(repos: list[str], lock_repositories: Opt[bool] = NotSet, exclude_attachments: Opt[bool] = NotSet) → Migration
Calls

POST /orgs/{org}/migrations

Parameters
  • repos – list or tuple of str

  • lock_repositories – bool

  • exclude_attachments – bool

Return type

github.Migration.Migration

get_migrations() → PaginatedList[Migration]
Calls

GET /orgs/{org}/migrations

Return type

PaginatedList of github.Migration.Migration

get_installations() → PaginatedList[Installation]
Calls

GET /orgs/{org}/installations

Return type

PaginatedList of github.Installation.Installation

get_dependabot_alerts(state: Opt[str] = NotSet, severity: Opt[str] = NotSet, ecosystem: Opt[str] = NotSet, package: Opt[str] = NotSet, scope: Opt[str] = NotSet, sort: Opt[str] = NotSet, direction: Opt[str] = NotSet) → PaginatedList[OrganizationDependabotAlert]
Calls

GET /orgs/{org}/dependabot/alerts

Parameters
  • state – Optional string

  • severity – Optional string

  • ecosystem – Optional string

  • package – Optional string

  • scope – Optional string

  • sort – Optional string

  • direction – Optional string

Return type

PaginatedList of github.DependabotAlert.DependabotAlert