GitHub Spoke
Manage distributed version control and source code in GitHub from your ServiceNow instance. Create flows in ServiceNow to manage collaborative features such as tracking bugs, feature requests, tasks and so on, for projects in GitHub. View and analyze meaningful usage data for GitHub Enterprise Cloud and GitHub Enterprise Server software subscriptions so that you can reclaim stale licenses.
Request apps on the Store
Visit the ServiceNow Store website to view all the available apps and for information about submitting requests to the store. For cumulative release notes information for all released apps, see the ServiceNow Store version history release notes.
Integration Hub subscription
This spoke requires an Integration Hub subscription. For more information, see Legal schedules - IntegrationHub overview.
Spoke version
GitHub spoke v2.5.2 is the latest version.
Supported versions
This spoke was built for GitHub API version v3, but may be compatible with later versions.
Spoke requirements
- GitHub account
- User with admin credentials
- Token to authenticate the ServiceNow instance
GitHub Webhooks module
Bi-directional webhooks can be set up to be notified about the required events. Routing policy defines conditions that must be met to notify the ServiceNow app. These conditions are based on the events in GitHub for which you want to be notified about. When the conditions are met, the routing policy triggers the associated subflow, which in turn automates the GitHub tasks.
- GitHub Webhook Registries
- GitHub WebHook Routing Policies
| Supported GitHub fields | ||
|---|---|---|
| Action | Project Card Creator | Ref |
| Base Ref | Project Card Note | Ref Type |
| Commit Comment Body | Project Card Previous Note | Release Assets |
| Commit Comment Created At | Project Card Updated At | Release Author |
| Commit Comment Path | Project Column Created At | Release Body |
| Commit Comment Updated At | Project Column Name | Release Created At |
| Commit Comment User | Project Column Previous Name | Release Draft |
| Force Push | Project Column Updated At | Release Name |
| GitHub Instance URL | Project Created At | Release Published At |
| Issue Assigned To | Project Name | Release Tag Name |
| Issue Assignees | Project Previous Body | Release Target Commits |
| Issue Body | Project Previous Name | Repository Archived |
| Issue Closed At | Project State | Repository Created At |
| Issue Comment | Project Updated At | Repository Description |
| Issue Comment Count | Pull Request Assigned To | Repository inactive |
| Issue Comment Created At | Pull Request Assignees | Repository Full Name |
| Issue Comment Updated At | Pull Request Body | Repository Has Issues |
| Issue Created At | Pull Request Closed At | Repository Has Projects |
| Issue Labeled To | Pull Request Comment Count | Repository Import Status |
| Issue Labels | Pull Request Created At | Repository License |
| Issue Locked | Pull Request Draft | Repository Open Issues Count |
| Issue Milestone | Pull Request Labeled To | Repository Owner |
| Issue Previous Body | Pull Request Labels | Repository Private |
| Issue Previous Comment | Pull Request Locked | Repository Pushed At |
| Issue Previous Milestone | Pull Request Mergeable | Repository Starred At |
| Issue Previous Title | Pull Request Merged | Repository Updated At |
| Issue Previously Assigned To | Pull Request Merged At | Repository Vulnerability Alert Affected Range |
| Issue Previously Labeled To | Pull Request Milestone | Repository Vulnerability Alert External Identifier |
| Issue State | Pull Request Previous Body | Repository Vulnerability Alert Fixed In |
| Issue Title | Pull Request Previous Title | Repository Vulnerability Alert Package Name |
| Issue Updated At | Pull Request Previously Assigned To | Security Advisory Description |
| Issue User | Pull Request Previously Labeled To | Security Advisory ID |
| Milestone Closed At | Pull Request Rebaseable | Security Advisory Published At |
| Milestone Created At | Pull Request Review Body | Security Advisory Severity |
| Milestone Creator | Pull Request Review Comment | Security Advisory Summary |
| Milestone Description | Pull Request Review Comment Count | Security Advisory Updated At |
| Milestone Due On | Pull Request Review Comment Created At | Security Advisory Withdrawn At |
| Milestone State | Pull Request Review Comment File Path | Sender login |
| Milestone Title | Pull Request Review Comment Previous Comment | Status Commit Message |
| Milestone Updated At | Pull Request Review Comment Updated At | Status Context |
| Organization Description | Pull Request Review Previous Body | Status Created At |
| Organization Login | Pull Request Review State | Status Description |
| Pre-Release | Pull Request State | Status Name |
| Project Body | Pull Request Title | Status State |
| Project Card Archived | Pull Request Updated At | Status Updated At |
| Project Card Created At | Pull Request User | Webhook Event |
To use other conditions in the routing policy, create a routing policy in the GitHub WebHook Routing Policies module and specify conditions according to your requirement. See Set up bi-directional webhook for the GitHub spoke for information regarding setting up and configuring the webhooks.
Spoke subflows
| Subflow | Description | Supported GitHub Event |
|---|---|---|
| Process GitHub Branch and Tag Webhook Events | Handles branch and tag webhook events. | Branch and Tag |
| Process GitHub Commit Webhook Events | Handles commit webhook events. | Commit |
| Process GitHub Issue Webhook Events | Handles issue webhook events. | Issue |
| Process GitHub Milestone Webhook Events | Handles milestone webhook events. | Milestone |
| Process GitHub Project Webhook Events | Handles project webhook events. | Project |
| Process GitHub Pull Request Webhook Events | Handles pull request webhook events. | Pull Request |
| Process GitHub Push Webhook Events | Handles push request webhook events. | Push Request |
| Process GitHub Release Webhook Events | Handles release webhook events. | Release |
| Process GitHub Repository Webhook Events | Handles repository webhook events. | Repository |
| Process GitHub Security Webhook Events | Handles security webhook events. | Security |
| Process GitHub Webhook Events | Handles all GitHub webhook events. |
Note:
This subflow handles all GitHub events. You can customize this subflow to handle other GitHub webhook events that are not supported by default. |
To create subflows to handle other GitHub webhook events or handle the supported GitHub webhook events differently, customize the Process GitHub Webhook Events subflow. For this, you must a create a copy of the subflow, parse the payload, and customize the subflow according to your requirement. Payload is one of the inputs to the subflow.
While customizing subflows, you must confirm that the subflows are configured to avoid infinite loops.
- You must configure webhooks to use the spoke subflow. See Set up bi-directional webhook for the GitHub spoke for information regarding setting up and configuring the webhook.
- The sample subflows run as a user by default. It can be configured to run as a system.
- GitHub spoke supports application/json payload. Configure the GitHub webhook accordingly. See the GitHub Developer documentation for instructions on creating and configuring a webhook.
Spoke actions
The GitHub spoke provides actions manage branches, issues, repositories, and source code when events occur in ServiceNow. Available actions include:
| Category | Action | Description |
|---|---|---|
| Branch Management | Create Branch | Creates a branch in GitHub based on a specific commit SHA. |
| Delete Branch | Deletes a branch from the GitHub repository. | |
| Get Branch | Retrieves the details of a branch in the GitHub repository. | |
| Get Branch Protection | Retrieves the restriction details of the required branch. | |
| List Branches | Retrieves the list of all branches in a repository. | |
| Remove Branch Protection | Removes protection on the required branch. | |
| Update Branch Protection | Updates protection on the required branch. | |
| Issue Management | Create Comment on Issue | Creates comment on a required issue. |
| Create Issue | Creates issue for the required repository. | |
| Delete Comment on Issue | Deletes comment on a required issue. | |
| Lock Issue | Locks the required issue. This limits the conversation to collaborators only. | |
| Look Up Comments on Issue | Retrieves the list of comments on an issue. | |
| Look Up Issues | Retrieves the list of issues for a repository. | |
| Unlock Issue | Unlocks the required issue. This opens conversation to all users. | |
| Update Comment on Issue | Updates a comment on an issue. | |
| Update Issue | Updates the details of the required issue. | |
| Metadata Retrieval | Look up Fields by Action | Retrieves the list of fields for an action filter in the GitHub Fields table. |
| Look up Branches Metadata | Retrieves metadata of the branches. | |
| Look up Issues Metadata | Retrieves metadata of the issues. | |
| Look up Milestones Metadata | Retrieves metadata of the milestones. | |
| Look up Pull Requests Metadata | Retrieves metadata of the pull requests. | |
| Organization Management | Get Organization Plan | Retrieves the plan name of an organization. |
| List of Organization Members | Retrieves the list of all members within an organization. | |
| List Organization Repositories | Retrieves the list of all repositories within an organization. | |
| Remove Organization Member | Removes a user from an organization. | |
| Look up Organization Events Stream | Retrieves the list of events in an organization based on the provided look back date. | |
| Look up Organization Outside Collaborators Stream | Retrieves the list of all Outside Collaborators within an organization. | |
| Remove Organization Outside Collaborator | Removes an outside collaborator from an organization. | |
| Look up Organization Pending Outside Collaborators Stream | Retrieves a list of pending collaborators within a repository. | |
| Look up Organization Invitations Stream | Retrieves a list of invitations within an organization. | |
| Repository Management | Add Collaborator | Adds collaborator to the required repository. |
| Create Comment on Pull Request | Create review comments on a pull request. | |
| Create Milestone | Creates milestone for the required repository. | |
| Create Pull Request | Creates a pull request for a repository. | |
| Create Reply on Pull Request Review Comment | Creates reply to a review comment for a pull request. | |
| Create Repository | Creates a repository in GitHub. | |
| Delete Comment on Pull Request | Deletes review comment on a pull request. | |
| Delete Milestone | Deletes milestone from the required repository. | |
| List Comments on Pull Request | Retrieves the list of all review comments on a pull request. | |
| List Milestones | Retrieves the list of all milestones in a repository. | |
| List Repository Events | Retrieves the list of events across a repository. | |
| Look Up Pull Requests | Retrieves the details of pull requests for a repository. | |
| Look Up Repositories | Retrieves the details of repositories based on a specific user or organization. | |
| Merge Pull Request | Merges the pull request to a repository. | |
| Remove Collaborator | Removes collaborator from a repository. | |
| Update Comment on Pull Request | Updates review comments provided for a pull request. | |
| Update Milestone | Updates the details of a milestone in a repository. | |
| Update Pull Request | Updates the details of a pull request in a repository. | |
| Update Repository | Updates the details of a repository in GitHub. | |
| Source Code Management | Create Comment on Commit | Creates a comment for the required commit using its SHA. |
| Create or update a file | Creates a file or updates an existing file in a repository. | |
| Get Comments By Commit ID | Retrieves comments provided for a single commit. | |
| Get Commit Information By ID | Retrieves the contents of the required commit reference. | |
| Get File Content | Retrieves the contents of a file in a repository. Note: This action supports files with file size up to 1 MB. |
|
| List Commits on a Repository | Retrieves the details of all commits made on a repository. | |
| User Management | Get All Users for Enterprise Server | Retrieves the list of all GitHub Enterprise Server users. |
| List Organizations for the Authenticated User | Retrieves the list of organizations that the logged-in user is a member of. | |
| Suspend User | Suspends a GitHub user account. | |
| Look up Authenticated User | Retrieves information about the authenticated user. |
Spoke modules
| Module | Description |
|---|---|
| GitHub Owner | Displays the GitHub owner records that you had created. |
| GitHub Repositories | Displays the details of the GitHub repositories associated with the GitHub owners. |
Connection and credential alias requirements
Integration Hub uses aliases to manage connection and credential information, and OAuth credentials. Using an alias eliminates the need to configure multiple credentials and connection information profiles when using multiple environments. If the connection or credential information changes, you don't need to update any actions that use the connection.
For information about setting up the spoke, see Set up the GitHub spoke.