# GitHub

[GitHub](https://github.com/) is a software development service for hosting and version control.

Torq enables quick and easy integration with GitHub, so you can automate anything and everything within moments. Torq's public GitHub steps include:

- Get Issue

- Get File

- Run GraphQL query

- List Repositories

- +30 more...

If you don't see a step you need, you can [create your own](https://kb.torq.io/en/articles/9183207-creating-custom-steps-in-torq-automate-anything) in various ways, such as using the **Send an HTTP Request** step or Torq’s Step Builder, and share it across your organization.

You can integrate GitHub with Torq using either a [personal access token](#h_353be53df8) or an [installation access token (JWT)](#h_dcd82ec784).

## **Prerequisites**

Before you begin:

- Ensure you have access to a GitHub account that is associated with an organization that has at least the **App Manager** role.

- Ensure you have access to a Torq account with at least the **Contributor** role.

# **Use GitHub to trigger workflows in Torq**

## **Create a GitHub trigger integration in Torq**

To create a GitHub trigger integration instance that provides access to HTTP headers, you must [create a generic webhook](https://kb.torq.io/en/articles/9730143-enable-hmac-signature-validation-for-github-webhook-deliveries#h_f3c674f6b4) and click **Accept raw HTTP requests**.

1. **Add the integration:** Go to **Build > Integrations > Triggers > GitHub** and click **Add Instance.**

2. **Name the integration:** Give the integration a unique and meaningful name.

3. **Finalize**: Click **Add** and **Copy** the generated endpoint. You will need the URL for the webhook.

![](https://downloads.intercomcdn.com/i/o/eomhaz2o/1448676215/68ad89841501336fea8223f06959/GitHub%2Btrigger%2Bintegration.png?expires=1793573100&amp;signature=ca6c9f10afcacfc08af74ee3546a68682ea4fe655da8ed2bf3a71aa0b819e926&amp;req=dSQjHs95m4NeXPMW1HO4zXk6QP59QHlC5%2FNp8FX9SmfeThLiSFFebMb3iDo6%0AkfIlsVwozwBbjRKE1x8%3D%0A)

## **Create a GitHub App**

1. **Open GitHub:** Navigate to **Settings > Developer settings**.

2. **Create a GitHub App:** Click **New GitHub App,** enter your password, and then click **Confirm** to confirm access to your account.

  ![](https://downloads.intercomcdn.com/i/o/eomhaz2o/1448655459/17323925d41578c8ae9b75fca278/Screenshot+2025-03-27+at+12_13_34.png?expires=1793573100&amp;signature=9ebd9d3f450e8e34fdb32450eb301c762d21a83cffec3d6bb492a7e15f39b2b6&amp;req=dSQjHs97mIVaUPMW1HO4zVtp4pQzHmVstRTtQDm1FcEr1KZI7auSf2KCsMMk%0Af0xO%0A)

3. **Register the GitHub App:**

  1. Name: Enter a meaningful name.

  2. Homepage URL: Enter <https://app.torq.io/>.

  3. Webhook URL: Paste the Torq endpoint you generated [earlier](#h_73b4455655).

4. **Finalize:** Click **Create GitHub App**.

# **Use GitHub steps Torq workflow with personal access tokens**

## **Generate a GitHub API key**

1. **Open GitHub:** Navigate to **Settings > Developer settings > GitHub Apps** and select the app you created [earlier](#h_54cfae1ed6).

2. **Create a secret:** Select the **General** tab and click **Generate a new client secret** in the Client secrets section.

3. **Finalize: Copy** the client secret to save it for later.

![](https://downloads.intercomcdn.com/i/o/eomhaz2o/1448676217/b2a96a467e867f5a5b46991bb242/Screenshot%2B2025-03-27%2Bat%2B14_47_59.png?expires=1793573100&amp;signature=4b28ac478284d6f109d4398b53713ac100580971395c9670b8056b40ee49890b&amp;req=dSQjHs95m4NeXvMW1HO4zYJS%2FUT9wz6CH9vZ36zJfp6%2BuUR2VJKKyJqiaA8F%0AlQYWJqKXIKVmJgqJ%2B98%3D%0A)

## **Create a GitHub steps integration in Torq**

1. **Navigate to the integration:** Go to **Build > Integrations > Steps > GitHub** and click **Add Instance**.

2. **Configure the integration:**

  1. Give the integration a unique and meaningful name.

  2. Paste the GitHub secret that you copied [earlier](#h_edc065825f).

3. **Finalize:** Click **Add**.

![](https://downloads.intercomcdn.com/i/o/eomhaz2o/1448676216/9895185be62f6563c20a999df300/Screenshot%2B2025-03-30%2Bat%2B10_10_26%2Bcopy.png?expires=1793573100&amp;signature=1ebb4c901b20cb952cb27b7b7bac098421572f41dfe259435f2ca303769b7b5e&amp;req=dSQjHs95m4NeX%2FMW1HO4zXODvhiM4iJEgtC9bXBQ6%2Fx4Y%2FxNpCmt70jO2t7I%0AwUnMrPHnj2CFXjROj3A%3D%0A)

​

# **Use GitHub steps in Torq workflows with installation access tokens**

## **Create a GitHub App**

1. **Open GitHub:** Navigate to **Settings > Developer settings**.

2. **Create a GitHub App:** Click **New GitHub App,** enter your password, and then click **Confirm** to confirm access to your account.

  ![](https://downloads.intercomcdn.com/i/o/eomhaz2o/1448655459/17323925d41578c8ae9b75fca278/Screenshot+2025-03-27+at+12_13_34.png?expires=1793573100&amp;signature=9ebd9d3f450e8e34fdb32450eb301c762d21a83cffec3d6bb492a7e15f39b2b6&amp;req=dSQjHs97mIVaUPMW1HO4zVtp4pQzHmVstRTtQDm1FcEr1KZI7auSf2KCsMMk%0Af0xO%0A)

3. **Register the GitHub App:**

  1. Enter a meaningful name.

  2. For **Homepage URL**, enter <https://app.torq.io/>.

  3. For **Callback URL**, enter <https://redir.torq.io/integrations/oauth_2>.

  4. Enable **Expire user authorization tokens**.

  5. Enable **Request user authorization (OAuth) during installation**.

  6. Disable the webhook.

  7. For Permissions, select the relevant permissions required for the Torq workflows’ interactions with the GitHub account.

  8. Select **Only on this account** to restrict the App's installation to this account.

4. **Finalize:** Click **Create GitHub App**.

## **Install the GitHub App**

1. **Copy the client ID:** Select the GitHub App's **General** tab and copy the client ID to save it for later. You will need it to set up custom secrets in Torq.

  ![](https://downloads.intercomcdn.com/i/o/eomhaz2o/1891979727/de419b41cfc8b9868f2f5cf2f022/Screenshot-2B2025-03-27-2Bat-2B14_47_59.png?expires=1793573100&amp;signature=67719dcf6841fc666d45766eb0fde2f969662a6499d9d08181b03ad2a76aaa60&amp;req=dSguF8B5lIZdXvMW1HO4zZK%2Ff36UC%2FjVmcq2JcY1C2bu5y8U0neY6M5FR8Ba%0A8ZHT%0A)

2. **Create a private key:** Click **Generate a private key** in the **Private keys** section.

3. **Copy the key:** Copy the key to save it for later. You will need it to set up custom secrets in Torq.

4. **Copy the installation ID:** Navigate to **Settings > Applications,** select the **Installed GitHub Apps** tab, and click **Configure** next to the installed App to copy the installation ID.

5. **Transfer ownership:** Select the **Advanced** tab and click **Transfer ownership**.

  1. Enter the GitHub App's name.

  2. Enter the name of the organization to which you want to transfer the App.

  3. Click **Transfer this GitHub App.**

6. **Install and authorize the App:** Select the **Install** tab and click **Install**.

  1. Select **All repositories**.

  2. Click **Install & Authorize**.

## **Create custom secrets in Torq**

Store application tokens as custom secrets so you can easily access them via the workflow context and use them to verify GitHub steps.

1. **Navigate to the integration**: In Torq, go to **Build > Integrations** > **Custom Secrets** and click **Add Instance**.

2. **Add the client ID**:

  1. Enter a meaningful name for the client ID, such as `github_app_client_id`.

  2. Paste the client ID you copied [earlier](#h_8098b2ced5).

  3. Click **Add**.

3. **Add the installation ID:**

  1. Enter a meaningful name for the installation ID, such as `github_app_installation_id`.

  2. Paste the installation ID you generated and copied [earlier](#h_8098b2ced5).

  3. Click **Add**.

4. **Add the private key:**

  1. Enter a meaningful name for the installation ID, such as `github_signing_key`.

  2. Paste the private key you generated and copied [earlier](#h_8098b2ced5).

  3. Click **Add**.

![](https://downloads.intercomcdn.com/i/o/eomhaz2o/1891989469/8a1ddabd07c3e5676a0011a549e7/Screenshot-2B2025-08-21-2Bat-2B12_12_18-2Bcopy.png?expires=1793573100&amp;signature=754175279f95ebc04ada3f0ee59f256c605ddf276a6f90b826a02f2256e1d448&amp;req=dSguF8B2lIVZUPMW1HO4zUCtqFfVD2O%2Bol1G7DkN2FOg%2FDyvZBwu3Kb20%2BQv%0AAGARI4vJ5ZhKMODQ90g%3D%0A)

Once the IDs are saved as custom secrets, you can access them in workflows by entering `$.secrets` and selecting them from the context.

## **Create a GitHub application access token in Torq**

1. **Open the workflow:** Navigate to **Build > Workflows** and open the relevant workflow.

2. **Create a JWT:** Add the **Create GitHub JWT** step and configure its parameters.

  1. For the client ID, use the workflow context to select the client ID custom secret.

  2. For the private key, use the workflow context to select the private key custom secret.

3. **Create the app access token:** Add the **Get Application Access Token** step and configure its parameters.

  1. For the API URL, enter <https://api.github.com>.

  2. For **Installation**, use the workflow context to select the installation ID custom secret.

  3. For the JWT, use the workflow context to select the output of the **Create GitHub JWT** step.

4. **(Optional) Test the integration:** Add the **List User Repositories** step, click the More Options menu next to the **Integration** parameter, and click **Set values separately**.

  1. Use the workflow context to select the token you generated with the **Get Application Access Token** step.

  2. Run the step. If the integration was set up correctly, you will get a list of all the repositories the GitHub App can access.

# **Templates**

Now that you've added your integrations, check out these specially crafted templates by Torq's security experts. Visit Torq's template library for [more](https://app.torq.io/templates?).

- [Gather CircleCI Environment Variables from GitHub Org Repos](https://app.torq.io/templates?id=4b644482-e961-4cba-9c9c-daf8948084ea)

- [Synchronize Torq Case Runbooks from a GitHub Repository](https://app.torq.io/templates?id=9ce7cd67-8fd0-470b-b912-6ea95863c32e)