Module for interacting with the GitHub v3 API.
New in version 2016.3.0.
PyGithub python module
Configure this module by specifying the name of a configuration profile in the minion config, minion pillar, or master config. The module will use the 'github' key by default, if defined.
For example:
github:
token: abc1234
org_name: my_organization
# optional: some functions require a repo_name, which
# can be set in the config file, or passed in at the CLI.
repo_name: my_repo
# optional: it can be dangerous to change the privacy of a repository
# in an automated way. set this to True to allow privacy modifications
allow_repo_privacy_changes: False
Create a new github repository.
The name of the team to be created.
The description of the repository.
The URL with more information about the repository.
The visiblity of the repository. Note that private repositories require a paid GitHub account.
Whether to enable issues for this repository.
Whether to enable the wiki for this repository.
Whether to enable downloads for this repository.
Whether to create an initial commit with an empty README.
The desired language or platform for a .gitignore, e.g "Haskell".
The desired LICENSE template to apply, e.g "mit" or "mozilla".
The name of the profile configuration to use. Defaults to github
.
CLI Example:
salt myminion github.add_repo 'repo_name'
New in version 2016.11.0.
Create a new Github team within an organization.
The name of the team to be created.
The description of the team.
The names of repositories to add the team to.
The level of privacy for the team, can be 'secret' or 'closed'.
The default permission for new repositories added to the team, can be 'pull', 'push' or 'admin'.
The name of the profile configuration to use. Defaults to github
.
CLI Example:
salt myminion github.add_team 'team_name'
New in version 2016.11.0.
Adds a team member to a team with team_name.
The name of the team member to add.
The name of the team of which to add the user.
The name of the profile configuration to use. Defaults to github
.
CLI Example:
salt myminion github.add_team_member 'user_name' 'team_name'
New in version 2016.11.0.
Adds a repository to a team with team_name.
The name of the repository to add.
The name of the team of which to add the repository.
The name of the profile configuration to use. Defaults to github
.
The permission for team members within the repository, can be 'pull', 'push' or 'admin'. If not specified, the default permission specified on the team will be used.
New in version 2017.7.0.
CLI Example:
salt myminion github.add_team_repo 'my_repo' 'team_name'
New in version 2016.11.0.
Add a GitHub user.
The user for which to obtain information.
The name of the profile configuration to use. Defaults to github
.
CLI Example:
salt myminion github.add_user github-handle
Updates an existing Github repository.
The name of the team to be created.
The description of the repository.
The URL with more information about the repository.
The visiblity of the repository. Note that private repositories require a paid GitHub account.
Whether to enable issues for this repository.
Whether to enable the wiki for this repository.
Whether to enable downloads for this repository.
The name of the profile configuration to use. Defaults to github
.
CLI Example:
salt myminion github.add_repo 'repo_name'
New in version 2016.11.0.
Updates an existing Github team.
The name of the team to be edited.
The description of the team.
The level of privacy for the team, can be 'secret' or 'closed'.
The default permission for new repositories added to the team, can be 'pull', 'push' or 'admin'.
The name of the profile configuration to use. Defaults to github
.
CLI Example:
salt myminion github.edit_team 'team_name' description='Team description'
New in version 2016.11.0.
Return information about a single issue in a named repository.
New in version 2016.11.0.
The number of the issue to retrieve.
The name of the repository from which to get the issue. This argument is
required, either passed via the CLI, or defined in the configured
profile. A repo_name
passed as a CLI argument will override the
repo_name defined in the configured profile, if provided.
The name of the profile configuration to use. Defaults to github
.
The amount of data returned by each issue. Defaults to min
. Change
to full
to see all issue output.
CLI Example:
salt myminion github.get_issue 514
salt myminion github.get_issue 514 repo_name=salt
Return information about the comments for a given issue in a named repository.
New in version 2016.11.0.
The number of the issue for which to retrieve comments.
The name of the repository to which the issue belongs. This argument is
required, either passed via the CLI, or defined in the configured
profile. A repo_name
passed as a CLI argument will override the
repo_name defined in the configured profile, if provided.
The name of the profile configuration to use. Defaults to github
.
Only comments updated at or after this time are returned. This is a
timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ
.
The amount of data returned by each issue. Defaults to min
. Change
to full
to see all issue output.
CLI Example:
salt myminion github.get_issue_comments 514
salt myminion github.get_issue 514 repo_name=salt
Returns information for all issues in a given repository, based on the search options.
New in version 2016.11.0.
The name of the repository for which to list issues. This argument is
required, either passed via the CLI, or defined in the configured
profile. A repo_name
passed as a CLI argument will override the
repo_name defined in the configured profile, if provided.
The name of the profile configuration to use. Defaults to github
.
The number of a GitHub milestone, or a string of either *
or
none
.
If a number is passed, it should refer to a milestone by its number
field. Use the github.get_milestone
function to obtain a milestone's
number.
If the string *
is passed, issues with any milestone are
accepted. If the string none
is passed, issues without milestones
are returned.
Indicates the state of the issues to return. Can be either open
,
closed
, or all
. Default is open
.
Can be the name of a user. Pass in none
(as a string) for issues
with no assigned user or *
for issues assigned to any user.
The user that created the issue.
A user that's mentioned in the issue.
A string of comma separated label names. For example, bug,ui,@high
.
What to sort results by. Can be either created
, updated
, or
comments
. Default is created
.
The direction of the sort. Can be either asc
or desc
. Default
is desc
.
Only issues updated at or after this time are returned. This is a
timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ
.
The amount of data returned by each issue. Defaults to min
. Change
to full
to see all issue output.
GitHub paginates data in their API calls. Use this value to increase or decrease the number of issues gathered from GitHub, per page. If not set, GitHub defaults are used. Maximum is 100.
CLI Example:
salt myminion github.get_issues my-github-repo
Return information about a single milestone in a named repository.
New in version 2016.11.0.
The number of the milestone to retrieve. If provided, this option
will be favored over name
.
The name of the milestone to retrieve.
The name of the repository for which to list issues. This argument is
required, either passed via the CLI, or defined in the configured
profile. A repo_name
passed as a CLI argument will override the
repo_name defined in the configured profile, if provided.
The name of the profile configuration to use. Defaults to github
.
The amount of data returned by each issue. Defaults to min
. Change
to full
to see all issue output.
CLI Example:
salt myminion github.get_milestone 72
salt myminion github.get_milestone name=my_milestone
Return information about milestones for a given repository.
New in version 2016.11.0.
The name of the repository for which to list issues. This argument is
required, either passed via the CLI, or defined in the configured
profile. A repo_name
passed as a CLI argument will override the
repo_name defined in the configured profile, if provided.
The name of the profile configuration to use. Defaults to github
.
The state of the milestone. Either open
, closed
, or all
.
Default is open
.
What to sort results by. Either due_on
or completeness
. Default
is due_on
.
The direction of the sort. Either asc
or desc
. Default is asc
.
The amount of data returned by each issue. Defaults to min
. Change
to full
to see all issue output.
GitHub paginates data in their API calls. Use this value to increase or decrease the number of issues gathered from GitHub, per page. If not set, GitHub defaults are used.
CLI Example:
salt myminion github.get_milestones
Returns information for all pull requests in a given repository, based on the search options provided.
New in version 2017.7.0.
The name of the repository for which to list pull requests. This
argument is required, either passed via the CLI, or defined in the
configured profile. A repo_name
passed as a CLI argument will
override the repo_name
defined in the configured profile, if
provided.
The name of the profile configuration to use. Defaults to github
.
Indicates the state of the pull requests to return. Can be either
open
, closed
, or all
. Default is open
.
Filter pull requests by head user and branch name in the format of
user:ref-name
. Example: 'github:new-script-format'
. Default
is None
.
Filter pulls by base branch name. Example: gh-pages
. Default is
None
.
What to sort results by. Can be either created
, updated
,
popularity
(comment count), or long-running
(age, filtering
by pull requests updated within the last month). Default is created
.
The direction of the sort. Can be either asc
or desc
. Default
is desc
.
The amount of data returned by each pull request. Defaults to min
.
Change to full
to see all pull request output.
GitHub paginates data in their API calls. Use this value to increase or decrease the number of pull requests gathered from GitHub, per page. If not set, GitHub defaults are used. Maximum is 100.
CLI Example:
salt myminion github.get_prs
salt myminion github.get_prs base=2016.11
Return information for a given repo.
New in version 2016.11.0.
The name of the repository.
The name of the profile configuration to use. Defaults to github
.
CLI Example:
salt myminion github.get_repo_info salt
salt myminion github.get_repo_info salt profile='my-github-profile'
Return teams belonging to a repository.
New in version 2017.7.0.
The name of the repository from which to retrieve teams.
The name of the profile configuration to use. Defaults to github
.
CLI Example:
salt myminion github.get_repo_teams salt
salt myminion github.get_repo_teams salt profile='my-github-profile'
Returns the team details if a team with the given name exists, or None otherwise.
The team name for which to obtain information.
The name of the profile configuration to use. Defaults to github
.
CLI Example:
salt myminion github.get_team 'team_name'
Get a GitHub user by name.
The user for which to obtain information.
The name of the profile configuration to use. Defaults to github
.
Prints user information details. Defaults to False
. If the user is
already in the organization and user_details is set to False, the
get_user function returns True
. If the user is not already present
in the organization, user details will be printed by default.
CLI Example:
salt myminion github.get_user github-handle
salt myminion github.get_user github-handle user_details=true
Returns True if the github user is in the team with team_name, or False otherwise.
The name of the user whose membership to check.
The name of the team to check membership in.
The name of the profile configuration to use. Defaults to github
.
CLI Example:
salt myminion github.is_team_member 'user_name' 'team_name'
New in version 2016.11.0.
List all members (in lower case) without MFA turned on.
The name of the profile configuration to use. Defaults to github
.
Bypasses the use of cached team repos.
CLI Example:
salt myminion github.list_members_without_mfa
New in version 2016.11.0.
List private repositories within the organization. Dependent upon the access rights of the profile token.
New in version 2016.11.0.
The name of the profile configuration to use. Defaults to github
.
CLI Example:
salt myminion github.list_private_repos
salt myminion github.list_private_repos profile='my-github-profile'
List public repositories within the organization.
New in version 2016.11.0.
The name of the profile configuration to use. Defaults to github
.
CLI Example:
salt myminion github.list_public_repos
salt myminion github.list_public_repos profile='my-github-profile'
List all repositories within the organization. Includes public and private repositories within the organization Dependent upon the access rights of the profile token.
New in version 2016.11.0.
The name of the profile configuration to use. Defaults to github
.
CLI Example:
salt myminion github.list_repos
salt myminion github.list_repos profile='my-github-profile'
Gets the names of team members in lower case.
The name of the team from which to list members.
The name of the profile configuration to use. Defaults to github
.
Bypasses the use of cached team members.
CLI Example:
salt myminion github.list_team_members 'team_name'
New in version 2016.11.0.
Gets the repo details for a given team as a dict from repo_name to repo details. Note that repo names are always in lower case.
The name of the team from which to list repos.
The name of the profile configuration to use. Defaults to github
.
Bypasses the use of cached team repos.
CLI Example:
salt myminion github.list_team_repos 'team_name'
New in version 2016.11.0.
Lists all teams with the organization.
The name of the profile configuration to use. Defaults to github
.
Bypasses the use of cached teams.
CLI Example:
salt myminion github.list_teams
New in version 2016.11.0.
List all users within the organization.
The name of the profile configuration to use. Defaults to github
.
Bypasses the use of cached users.
New in version 2016.11.0.
CLI Example:
salt myminion github.list_users
salt myminion github.list_users profile='my-github-profile'
Remove a Github repository.
The name of the repository to be removed.
The name of the profile configuration to use. Defaults to github
.
CLI Example:
salt myminion github.remove_repo 'my-repo'
New in version 2016.11.0.
Remove a github team.
The name of the team to be removed.
The name of the profile configuration to use. Defaults to github
.
CLI Example:
salt myminion github.remove_team 'team_name'
New in version 2016.11.0.
Removes a team member from a team with team_name.
The name of the team member to remove.
The name of the team from which to remove the user.
The name of the profile configuration to use. Defaults to github
.
CLI Example:
salt myminion github.remove_team_member 'user_name' 'team_name'
New in version 2016.11.0.
Removes a repository from a team with team_name.
The name of the repository to remove.
The name of the team of which to remove the repository.
The name of the profile configuration to use. Defaults to github
.
CLI Example:
salt myminion github.remove_team_repo 'my_repo' 'team_name'
New in version 2016.11.0.
Remove a Github user by name.
The user for which to obtain information.
The name of the profile configuration to use. Defaults to github
.
CLI Example:
salt myminion github.remove_user github-handle