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.

GitHub 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
Input
Authorize URL
string
/ Required
Hidden Field
Default
https://github.com/login/oauth/authorize
Notes
Authorization URL
Input
Client ID
string
/ Required
Default
Notes
Client identifier
Input
Client Secret
password
/ Required
Default
Notes
Client secret
Input
Scopes
string
Default
Notes
Space-delimited scopes; refer to [GitHub's documentation for details](https://docs.github.com/en/developers/apps/building-oauth-apps/scopes-for-oauth-apps)
Input
Token URL
string
/ Required
Hidden Field
Default
https://github.com/login/oauth/access_token
Notes
Token URL

Data Sources#

List Repos#

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

InputNotes
Input
Connection
connection
/ Required
Notes
 

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

InputDefaultNotes
Input
Connection
connection
/ Required
Default
 
Notes
 
Input
Inputs
string
Default
{"input1":"My Value","input2":"My Other Value"}
Notes
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.
Input
Owner
string
/ Required
Default
Notes
The account OWNER of the repository (https://github.com/OWNER/REPO)
Input
Ref
string
/ Required
Default
Notes
The git reference for the workflow
Input
Repository Name
string
/ Required
Default
Notes
The name of the REPO (https://github.com/OWNER/REPO)
Input
Workflow Id
string
/ Required
Default
Notes
The ID of the workflow

Git Create Blob#

Create a blob | key: gitCreateBlob

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

Git Create Ref#

Create a reference | key: gitCreateRef

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

Git Create Tree#

Create a tree | key: gitCreateTree

InputDefaultNotesExample
Input
Base Tree
string
Default
Notes
The SHA1 of an existing Git tree object which will be used as the base for the new tree
Example
9fb037999f264ba9a7fc6274d15fa3ae2ab98312
Input
Connection
connection
/ Required
Default
 
Notes
 
Example
 
Input
Owner
string
/ Required
Default
Notes
The account OWNER of the repository (https://github.com/OWNER/REPO)
Example
 
Input
Repository Name
string
/ Required
Default
Notes
The name of the REPO (https://github.com/OWNER/REPO)
Example
 
Input
Tree
code
/ Required
Default
[  {    "path": "test.txt",    "mode": "100644",    "content": "This is a test"  }]
Notes
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
Example
 

Git Get Ref#

Get a reference | key: gitGetRef

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

Issues Create Comment#

Create an issue comment | key: issuesCreateComment

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

Issues List Comments#

List issue comments | key: issuesListComments

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

Pulls Create#

Create a pull request | key: pullsCreate

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

Raw Request#

Issue a raw HTTP request | key: rawRequest

InputDefaultNotesExample
Input
Connection
connection
/ Required
Default
 
Notes
 
Example
 
Input
Data
string
Default
Notes
The HTTP body payload to send to the URL.
Example
{"exampleKey": "Example Data"}
Input
Debug Request
boolean
Default
false
Notes
Enabling this flag will log out the current request.
Example
 
Input
File Data
string
Key Value List
Default
Notes
File Data to be sent as a multipart form upload.
Example
[{key: "example.txt", value: "My File Contents"}]
Input
Form Data
string
Key Value List
Default
Notes
The Form Data to be sent as a multipart form upload.
Example
[{"key": "Example Key", "value": new Buffer("Hello World")}]
Input
Header
string
Key Value List
Default
Notes
A list of headers to send with the request.
Example
User-Agent: curl/7.64.1
Input
Max Retry Count
string
Default
0
Notes
The maximum number of retries to attempt.
Example
 
Input
Method
string
/ Required
Default
Notes
The HTTP method to use.
Example
 
Input
Query Parameter
string
Key Value List
Default
Notes
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.
Example
 
Input
Response Type
string
/ Required
Default
json
Notes
The type of data you expect in the response. You can request json, text, or binary data.
Example
 
Input
Retry On All Errors
boolean
Default
false
Notes
If true, retries on all erroneous responses regardless of type.
Example
 
Input
Retry Delay (ms)
string
Default
0
Notes
The delay in milliseconds between retries.
Example
 
Input
Timeout
string
Default
Notes
The maximum time that a client will await a response to its request
Example
2000
Input
URL
string
/ Required
Default
Notes
This is the URL to call.
Example
/sobjects/Account
Input
Use Exponential Backoff
boolean
Default
false
Notes
Specifies whether to use a pre-defined exponential backoff strategy for retries.
Example
 

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
Input
Callback URL
string
/ Required
Notes
The URL to send data to
Input
Connection
connection
/ Required
Notes
 
Input
Events
string
/ Required
Value List
Notes
Determines what events trigger a webhook to fire
Input
Owner
string
/ Required
Notes
The account OWNER of the repository (https://github.com/OWNER/REPO)
Input
Repository Name
string
/ Required
Notes
The name of the REPO (https://github.com/OWNER/REPO)

Repos Delete Webhook#

Delete a repository webhook | key: reposDeleteWebhook

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

Repos List For Org#

List organization repositories | key: reposListForOrg

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

Users Get By Username#

Get a user | key: usersGetByUsername

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