Skip to content

vendor_connectors.github

Github Connector using jbcom ecosystem packages.

GithubConnectorGithub connector for repository operations.
get_github_api_errorExtract error message from Github exception.
build_github_actions_workflowGenerate a GitHub Actions workflow YAML string.
FilePath
DEFAULT_PER_PAGE

None

vendor_connectors.github.get_github_api_error(exc: github.GithubException.GithubException) → str | None

Section titled “vendor_connectors.github.get_github_api_error(exc: github.GithubException.GithubException) → str | None”

Extract error message from Github exception.

100

class vendor_connectors.github.GithubConnector(github_owner: str, github_repo: str | None = None, github_branch: str | None = None, github_token: str | None = None, per_page: int = DEFAULT_PER_PAGE, logger: lifecyclelogging.Logging | None = None, **kwargs)

Section titled “class vendor_connectors.github.GithubConnector(github_owner: str, github_repo: str | None = None, github_branch: str | None = None, github_token: str | None = None, per_page: int = DEFAULT_PER_PAGE, logger: lifecyclelogging.Logging | None = None, **kwargs)”

Bases: vendor_connectors.base.VendorConnectorBase

Github connector for repository operations.

Initialize the connector.

Args: api_key: API key (overrides environment variable) base_url: Base URL (overrides class default) timeout: HTTP timeout in seconds logger: Logger instance **kwargs: Passed to DirectedInputsClass

Get a repository branch by name.

Create a new repository branch.

Get a file from the repository.

Update a file in the repository.

Delete a file from the repository.

List organization members.

Args: role: Filter by role (‘admin’, ‘member’). None returns all. include_pending: Include pending invitations. Defaults to False.

Returns: Dictionary mapping usernames to member data.

Get a specific organization member.

Args: username: GitHub username.

Returns: Member data or None if not found.

List organization repositories.

Args: type_filter: Filter type (‘all’, ‘public’, ‘private’, ‘forks’, ‘sources’, ‘member’). include_branches: Include branch information. Defaults to False.

Returns: Dictionary mapping repo names to repository data.

Get a specific repository.

Args: repo_name: Repository name.

Returns: Repository data or None if not found.

List organization teams.

Args: include_members: Include team members. Defaults to False. include_repos: Include team repositories. Defaults to False.

Returns: Dictionary mapping team slugs to team data.

Get a specific team.

Args: team_slug: Team slug.

Returns: Team data or None if not found.

Add a member to a team.

Args: team_slug: Team slug. username: GitHub username. role: Role (‘member’ or ‘maintainer’). Defaults to ‘member’.

Returns: True if successful.

Remove a member from a team.

Args: team_slug: Team slug. username: GitHub username.

Returns: True if successful.

Execute a GraphQL query against the GitHub API.

Args: query: GraphQL query string. variables: Optional query variables.

Returns: Query response data.

Get organization members with their verified emails.

Uses GraphQL to get verified email addresses for org members.

Args: members: Pre-fetched members dict. Fetched if not provided. domain_filter: Filter by email domain (e.g., ‘company.com’).

Returns: Dictionary mapping usernames to member data with verified emails.

Build a GitHub Actions workflow structure.

Args: name: Workflow name. on: Trigger configuration. jobs: Jobs configuration. env: Global environment variables. permissions: Workflow permissions. concurrency: Concurrency settings. defaults: Default settings for jobs.

Returns: Workflow configuration dict suitable for YAML export.

Build a GitHub Actions workflow job.

Args: runs_on: Runner label(s). steps: Job steps. needs: Dependencies on other jobs. if_condition: Conditional expression. env: Job environment variables. strategy: Matrix strategy. timeout_minutes: Job timeout. services: Service containers. outputs: Job outputs.

Returns: Job configuration dict.

Build a GitHub Actions workflow step.

Args: name: Step name. uses: Action to use (e.g., ‘actions/checkout@v4’). run: Shell command(s) to run. with_params: Input parameters for the action. env: Step environment variables. if_condition: Conditional expression. working_directory: Working directory for run commands. shell: Shell to use for run commands. id: Step ID for outputs.

Returns: Step configuration dict.

create_python_ci_workflow(python_versions: list[str] | None = None, test_command: str = ‘pytest’, lint_command: str = ‘ruff check’, format_command: str | None = ‘ruff format —check’, install_command: str = ‘uv sync —all-packages’, working_directory: str = ’.’) → dict[str, Any]

Section titled “create_python_ci_workflow(python_versions: list[str] | None = None, test_command: str = ‘pytest’, lint_command: str = ‘ruff check’, format_command: str | None = ‘ruff format —check’, install_command: str = ‘uv sync —all-packages’, working_directory: str = ’.’) → dict[str, Any]”

Create a standard Python CI workflow.

Args: python_versions: Python versions to test. Defaults to [‘3.12’]. test_command: Test command. Defaults to ‘pytest’. lint_command: Lint command. Defaults to ‘ruff check’. format_command: Format check command. None to skip. install_command: Dependency install command. working_directory: Working directory for commands.

Returns: Complete workflow configuration.

Generate a GitHub Actions workflow YAML string.