Skip to main content

GitHub Component

Manage users, repositories, licenses, and more on GitHub

Component key: github

Description

GitHub is one of the largest and most advanced development platform in the world providing code repository hosting and more.

The GitHub REST API is extensive, with almost a thousand unique endpoints. This component has actions that wrap some of those endpoints that are commonly used in integrations. Please contact us if there are other GitHub endpoints that you would find helpful wrapped in an action. Alternatively, you can reach for the Raw Request action to interact with any GitHub endpoint.

Connections

OAuth 2.0

To connect to GitHub you will need to create a new OAuth 2.0 application. Fill in the required fields and supply Prismatic's callback URL as the Authorization callback URL: https://oauth2.prismatic.io/callback

Next click "Generate a new client secret" and copy the values of both the Client ID and Client Secret.

You are now ready to create the OAuth 2.0 connection to GitHub within Prismatic:

  • Enter the Client ID and Client Secret values into the same named fields.
  • Determine what scopes your use case requires and add those to Scopes separating each with a space.

Save your integration and you should now be able to connect and authenticate to GitHub.

Triggers

Webhook

Receive and validate webhook requests from Github for webhooks you configure. | key: webhook


Data Sources

List Repos

List all of the authenticated user's repositories | key: listReposForAuthenticatedUser | type: picklist

Data Source Payload

{
"result": [
{
"key": "exampleuser/examplerepo",
"label": "exampleuser/examplerepo"
},
{
"key": "exampleorg/special-project",
"label": "exampleorg/special-project"
}
]
}

Actions

Actions Create Workflow Dispatch

Create a workflow dispatch event | key: actionsCreateWorkflowDispatch


Git Create Blob

Create a blob | key: gitCreateBlob


Git Create Ref

Create a reference | key: gitCreateRef


Git Create Tree

Create a tree | key: gitCreateTree


Git Get Ref

Get a reference | key: gitGetRef


Issues Create Comment

Create an issue comment | key: issuesCreateComment


Issues List Comments

List issue comments | key: issuesListComments


Pulls Create

Create a pull request | key: pullsCreate


Raw Request

Send raw HTTP request to Github | key: rawRequest

The Raw Request action allows you to interact with any GitHub REST API endpoint.

Suppose, for example, that you want to make use of GitHub's Render a Markdown document API endpoint. You can enter /markdown as the URL, select POST as the Method. The HTTP request's body for that endpoint needs an object with text and mode, which can be a reference of a previous step. A previous code step, for example could look like this:

module.exports = async ({ logger, configVars }, stepResults) => {
const text = `> #### The quarterly results look great!
>
> - Revenue was off the chart.
> - Profits were higher than ever.
>
> *Everything* is going according to **plan**.`;
const mode = "markdown";
return { data: { text, mode } };
};

Repos Create Webhook

Create a repository webhook | key: reposCreateWebhook


Repos Delete Instance Webhooks

Delete all webhooks pointed at this Prismatic instance | key: reposDeleteInstanceWebhooks


Repos Delete Webhook

Delete a repository webhook by ID | key: reposDeleteWebhook


Repos List For Org

List organization repositories | key: reposListForOrg


Repos List Webhooks

List webhooks of a repository | key: reposListWebhooks


Users Get By Username

Get a user | key: usersGetByUsername