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.

InputDefaultNotes
Authorize URL
string
/ Required
Hidden Field
authorizeUrl
https://github.com/login/oauth/authorize
Authorization URL
Client ID
string
/ Required
clientId
Client identifier
Client Secret
password
/ Required
clientSecret
Client secret
Scopes
string
scopes
Space-delimited scopes; refer to [GitHub's documentation for details](https://docs.github.com/en/developers/apps/building-oauth-apps/scopes-for-oauth-apps)
Token URL
string
/ Required
Hidden Field
tokenUrl
https://github.com/login/oauth/access_token
Token URL

Triggers

Webhook

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

InputNotes
Webhook Secret
string
webhookSecret
An optional secret to use to verify webhook authenticity. See https://docs.github.com/en/developers/webhooks-and-events/webhooks/securing-your-webhooks

Data Sources

List Repos

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

InputNotes
Connection
connection
/ Required
connection
 

{
"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

InputDefaultNotes
Connection
connection
/ Required
connection
 
 
Inputs
string
inputs
{"input1":"My Value","input2":"My Other Value"}
Input keys and values configured in the workflow file. This can be a JSON input mapping, or a reference to a previous step that returned an object.
Owner
string
/ Required
owner
The account OWNER of the repository (https://github.com/OWNER/REPO)
Ref
string
/ Required
ref
The git reference for the workflow
Repository Name
string
/ Required
repo
The name of the REPO (https://github.com/OWNER/REPO)
Workflow Id
string
/ Required
workflowId
The ID of the workflow

Git Create Blob

Create a blob | key: gitCreateBlob

InputDefaultNotes
Connection
connection
/ Required
connection
 
 
Content
string
/ Required
content
The new blob"s content
Encoding
string
encoding
utf-8
The encoding used for "content"
Owner
string
/ Required
owner
The account OWNER of the repository (https://github.com/OWNER/REPO)
Repository Name
string
/ Required
repo
The name of the REPO (https://github.com/OWNER/REPO)

Git Create Ref

Create a reference | key: gitCreateRef

InputNotesExample
Connection
connection
/ Required
connection
 
 
Key
string
key
 
"refs/heads/newbranch"
Owner
string
/ Required
owner
The account OWNER of the repository (https://github.com/OWNER/REPO)
 
Ref
string
/ Required
ref
The name of the fully qualified reference (ie: "refs/heads/master")
 
Repository Name
string
/ Required
repo
The name of the REPO (https://github.com/OWNER/REPO)
 
Sha
string
/ Required
sha
The SHA1 value for this reference
 

Git Create Tree

Create a tree | key: gitCreateTree

InputDefaultNotesExample
Base Tree
string
baseTree
The SHA1 of an existing Git tree object which will be used as the base for the new tree
9fb037999f264ba9a7fc6274d15fa3ae2ab98312
Connection
connection
/ Required
connection
 
 
 
Owner
string
/ Required
owner
The account OWNER of the repository (https://github.com/OWNER/REPO)
 
Repository Name
string
/ Required
repo
The name of the REPO (https://github.com/OWNER/REPO)
 
Tree
code
/ Required
tree
Objects (of "path", "mode", "type", and "content" or "sha") specifying a tree structure. See https://docs.github.com/en/rest/git/trees#create-a-tree
 

Git Get Ref

Get a reference | key: gitGetRef

InputNotes
Connection
connection
/ Required
connection
 
Owner
string
/ Required
owner
The account OWNER of the repository (https://github.com/OWNER/REPO)
Ref
string
/ Required
ref
ref parameter
Repository Name
string
/ Required
repo
The name of the REPO (https://github.com/OWNER/REPO)

Issues Create Comment

Create an issue comment | key: issuesCreateComment

InputNotes
Body
string
/ Required
body
The contents of the comment
Connection
connection
/ Required
connection
 
Issue Number
string
/ Required
issueNumber
The number that identifies the issue
Owner
string
/ Required
owner
The account OWNER of the repository (https://github.com/OWNER/REPO)
Repository Name
string
/ Required
repo
The name of the REPO (https://github.com/OWNER/REPO)

Issues List Comments

List issue comments | key: issuesListComments

InputDefaultNotes
Connection
connection
/ Required
connection
 
 
Issue Number
string
/ Required
issueNumber
The number that identifies the issue
Owner
string
/ Required
owner
The account OWNER of the repository (https://github.com/OWNER/REPO)
Page
string
page
1
Page number of the results to fetch
Per Page
string
perPage
30
The number of results per page (max 100)
Repository Name
string
/ Required
repo
The name of the REPO (https://github.com/OWNER/REPO)
Since
string
since
Only show notifications updated after the given time

Pulls Create

Create a pull request | key: pullsCreate

InputDefaultNotesExample
Base
string
/ Required
base
The name of the branch you want the changes pulled into
 
Body
string
body
The contents of the pull request
 
Connection
connection
/ Required
connection
 
 
 
Draft
boolean
draft
false
Indicates whether the pull request is a draft
 
Head
string
/ Required
head
The name of the branch where your changes are implemented
 
Issue
string
issue
 
1
Maintainer Can Modify
boolean
maintainerCanModify
false
Indicates whether [maintainers can modify](https://docs
 
Owner
string
/ Required
owner
The account OWNER of the repository (https://github.com/OWNER/REPO)
 
Repository Name
string
/ Required
repo
The name of the REPO (https://github.com/OWNER/REPO)
 
Title
string
title
The title of the new pull request
 

Raw Request

Send raw HTTP request to Github | key: rawRequest

InputDefaultNotesExample
Connection
connection
/ Required
connection
 
 
 
Data
string
data
The HTTP body payload to send to the URL.
{"exampleKey": "Example Data"}
Debug Request
boolean
debugRequest
false
Enabling this flag will log out the current request.
 
File Data
string
Key Value List
fileData
File Data to be sent as a multipart form upload.
[{key: "example.txt", value: "My File Contents"}]
Form Data
string
Key Value List
formData
The Form Data to be sent as a multipart form upload.
[{"key": "Example Key", "value": new Buffer("Hello World")}]
Header
string
Key Value List
headers
A list of headers to send with the request.
User-Agent: curl/7.64.1
Max Retry Count
string
maxRetries
0
The maximum number of retries to attempt.
 
Method
string
/ Required
method
The HTTP method to use.
 
Query Parameter
string
Key Value List
queryParams
A list of query parameters to send with the request. This is the portion at the end of the URL similar to ?key1=value1&key2=value2.
 
Response Type
string
/ Required
responseType
json
The type of data you expect in the response. You can request json, text, or binary data.
 
Retry On All Errors
boolean
retryAllErrors
false
If true, retries on all erroneous responses regardless of type.
 
Retry Delay (ms)
string
retryDelayMS
0
The delay in milliseconds between retries.
 
Timeout
string
timeout
The maximum time that a client will await a response to its request
2000
URL
string
/ Required
url
Input the path only (/octocat), The base URL is already included (https://api.github.com). For example, to connect to https://api.github.com/octocat, only /octocat is entered in this field.
/octocat
Use Exponential Backoff
boolean
useExponentialBackoff
false
Specifies whether to use a pre-defined exponential backoff strategy for retries.
 

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

InputNotes
Callback URL
string
/ Required
callbackUrl
The URL to send data to
Connection
connection
/ Required
connection
 
Events
string
/ Required
Value List
events
Determines what events trigger a webhook to fire
Owner
string
/ Required
owner
The account OWNER of the repository (https://github.com/OWNER/REPO)
Repository Name
string
/ Required
repo
The name of the REPO (https://github.com/OWNER/REPO)
Webhook Secret
string
webhookSecret
An optional secret to use to verify webhook authenticity. See https://docs.github.com/en/developers/webhooks-and-events/webhooks/securing-your-webhooks

Repos Delete Instance Webhooks

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

InputNotes
Connection
connection
/ Required
connection
 
Owner
string
/ Required
owner
The account OWNER of the repository (https://github.com/OWNER/REPO)
Repository Name
string
/ Required
repo
The name of the REPO (https://github.com/OWNER/REPO)

Repos Delete Webhook

Delete a repository webhook by ID | key: reposDeleteWebhook

InputNotes
Connection
connection
/ Required
connection
 
Hook ID
string
/ Required
hookId
The unique identifier of the hook
Owner
string
/ Required
owner
The account OWNER of the repository (https://github.com/OWNER/REPO)
Repository Name
string
/ Required
repo
The name of the REPO (https://github.com/OWNER/REPO)

Repos List For Org

List organization repositories | key: reposListForOrg

InputDefaultNotes
Connection
connection
/ Required
connection
 
 
Direction
string
direction
The order to sort by
Org
string
/ Required
org
The organization name
Page
string
page
1
Page number of the results to fetch
Per Page
string
perPage
30
The number of results per page (max 100)
Sort
string
sort
created
The property to sort the results by
Type
string
type
Specifies the types of repositories you want returned

Repos List Webhooks

List webhooks of a repository | key: reposListWebhooks

InputDefaultNotes
Connection
connection
/ Required
connection
 
 
Owner
string
/ Required
owner
The account OWNER of the repository (https://github.com/OWNER/REPO)
Repository Name
string
/ Required
repo
The name of the REPO (https://github.com/OWNER/REPO)
Show only instance webhooks
boolean
showOnlyInstanceWebhooks
true
Show only webhooks that point to this instance

Users Get By Username

Get a user | key: usersGetByUsername

InputNotes
Connection
connection
/ Required
connection
 
Username
string
/ Required
username
The handle for the GitHub user account