GitHub integration

Project owners, as well as account owners and admins, can create a GitHub integration so that commits, pull requests and branches in GitHub automatically attach to the appropriate stories and epics. This replaces the old Pivotal Tracker Service Hook integrations.

Creating a new GitHub integration

If you are a project owner, or an admin or owner of the account that includes the project, you can create a GitHub integration for the project. Check the integration permissions for more information.

Adding a new GitHub Integration to a project

  1. Click the MORE tab in your project, then choose Integrations in the sidebar.
  2. Select the Add an integration button at the top, then choose GitHub.

Configuring the integration

Next, you’ll need to configure the integration to work for one or more projects in your account.

Configure GitHub integration

  1. Naming your integration: It’s important to name the integration so that it can be easily identified in the event it needs to be edited later. For example, “Frontend GitHub Integration”, etc.

  2. Pivotal Tracker Projects: You’ll need to pick which Tracker projects the GitHub integration can access. It is not necessary to set up individual GitHub Integrations for each individual project on your account.

  3. Webhook Payload URL: The payload URL is made available to you once the integration has been saved, and is the first of two pieces of information you will need to setup webhooks at the organization or repository level in GitHub. The other item you will need is the webhook “secret token” mentioned below.

  4. Webhook Secret Token: The “secret token” is made available to you once the integration has been saved, and is the second piece of information you will need to setup webhooks at the organization or repository level in GitHub.

Creating the webhook on GitHub

Navigate to the webhook creation portion of a repository or organization and fill out the form. You can also visit the setup form directly at links like:

https://github.com/[organization_name][repo_name]/settings/hooks/new or https://github.com/organizations/[organization_name]/settings/hooks/new

Configure GitHub integration

  1. Payload URL: This can be obtained from the integration configuration page in Tracker as seen in item 3 above.

  2. Content type: This field will need to be changed to application/json (it defaults to application/x-www-form-urlencoded).

  3. Secret: This can also be obtained from the integration configuration page in Tracker as seen in item 4 above.

  4. SSL verification: We recommend keeping this set to Enable SSL verification.

  5. Which events would you like to trigger this webhook?: We recommend choosing Send me everything. At this time, the Pivotal Tracker Integration only requires the following events: Pushes & Pull Requests. However, we recommend selecting “Send me everything” so that you are automatically opted-in for future updates utilizing webhooks.

  6. Make sure Active is selected, then click Add webhook. If everything was setup correctly, there should be a successful webhook post under the “Recent Deliveries” section.

Using the GitHub integration: Branches

GitHub branch on a story

Attaching branches to a story automatically

If you create a branch from the command line and include the story or epic id in the branch name, Tracker will automatically attach a branch to the story or epic. For example, creating a branch with the name 123123-super-cool-feature will attach it to the story with id 123123.

Using the GitHub integration: Pull requests

Code section with Pull Request

Tracker will automatically attach a pull request to a story or epic if the name of the branch that is being merged starts with that story or epic’s ID, as described in Attaching Branches to a Story Automatically above. The PR icon’s color will match its status in GitHub:

Pull request green icon for open = Open Pull request red icon for closed = Closed Pull request purple icon for merged = Merged Pull request gray icon for unknown = Unknown (when manually pasted into ‘Code’ field)

Using the GitHub integration: Commits

GitHub Commit

If your project has a GitHub integration and webhook setup, you can also attach commits to a story’s activity/comment stream by using a commit message tagged with the story id. The syntax for your commit message is pretty simple. Add the Tracker story id with a preceding hash symbol within square brackets at the end of your commit message. Optionally, you can include a state change for the Tracker story within the brackets. Currently, there are two state changes supported: Finished and Delivered. For example, including “Finishes” or “Fixes” in your commit message will change the specified story to the Finished state, while “Delivers” will change the specified story to Delivered state.

[(Finishes|Fixes|Delivers) #TRACKER_STORY_ID]

The commit message in the example below adds a commit to story 123123 and changes story state to “Finished” with the “finishes” keyword.

git commit -m "[finishes #123123] Updated settings for holograph projector"

If you just fixed a CSS bug for story #109683950, your commit might look like this:

Example of syntax for tagging your commits to Tracker stories

You can specify multiple story ids in a commit by separating each id with a comma or space, within square brackets. However, all story ids will show in the commit on all specified stories.

[#TRACKER_STORY_ID,#TRACKER_STORY_ID] or [#TRACKER_STORY_ID #TRACKER_STORY_ID]

Alternatively, you can place each story id in its on set of square brackets, and separate each set of brackets with a comma or space. This will prevent story ids from showing up in non-related stories.

[#TRACKER_STORY_ID],[#TRACKER_STORY_ID] or [#TRACKER_STORY_ID] [#TRACKER_STORY_ID]

Attaching GitHub resources to your story

You can manually attach GitHub resources to your stories using the CODE field. Simply paste in the GitHub link to your pull request or branch, and it will be interpreted and attached.

Configure GitHub integration

Managing GitHub integrations

An existing GitHub integration can only be updated by the project owner, account owner, or admin who created the integration. Account owners and admins can delete any GitHub integrations for projects in their account. Check the integration permissions for more information.

Troubleshooting Tips

We’re sorry that you’re experiencing issues with your GitHub integration, and hope the following tips and troubleshooting steps might help.

  • Please make sure you’ve set up an integration for GitHub under MORE > Integrations (as described in the Creating a new GitHub integration section above).
  • The creator of the integration should make sure they’ve added all of the Projects and Repositories they expect to push and receive commits from in the GitHub Integration Configuration page (MORE > Integrations).

If all of the above looks good, please consider the following:

  • It is not necessary to set up individual GitHub Integrations for each individual project on your account. Any number of projects can be associated with any number of GitHub repositories and/or organizations in a single GitHub Integration, regardless of which project you chose to start setting it up from.
  • Only project owners, as well as account owners/admins, can create new GitHub Integrations.
  • Only the user who created a GitHub Integration may edit that integration. Account owners and admins may view and delete integrations that they did not create, but they can’t edit them.

If the above does not help, please email tracker@pivotal.io with answers to the following:

  1. Is the issue to do with posting commit messages, attaching PRs or branches?
  2. The project(s) where the GitHub Integration(s) has been configured (preferably the project IDs).
  3. The project(s) that you are having the issue with.
  4. The story ID for a story where the commit message comment, branch or PR did not appear.
  5. The exact commit message, PR message or branch names that were used.
  6. The approximate time (including Time Zone) of the action.

Learn more

The Tracker blog post announcing the new and improved GitHub integration has additional information.

Previous
Source Control Management (SCM)
Next
GitHub’s service hook for Tracker