GitHub 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 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 or an installation access token (JWT).
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
Add the integration: Go to Build > Integrations > Triggers > GitHub and click Add Instance.
Name the integration: Give the integration a unique and meaningful name.
(Optional) Add an authentication header: Click Add.
Enter a name.
Click Generate Random Secret or enter your own.
Click Copy Secret to save it for later.
Finalize: Click Add and Copy the generated endpoint. You will need the URL for the webhook.
Create a GitHub App
Open Github: Navigate to Settings > Developer settings.
Create a GitHub App: Click New GitHub App, enter your password, and then click Confirm to confirm access to your account.
Register the GitHub App:
Name: Enter a meaningful name.
Homepage URL: Enter
https://app.torq.io/.Webhook URL: Paste the Torq endpoint you generated earlier.
Finalize: Click Create GitHub App.
Use GitHub steps Torq workflow with personal access tokens
Generate a GitHub API key
Open Github: Navigate to Settings > Developer settings > GitHub Apps and select the app you created earlier.
Create a secret: Select the General tab and click Generate a new client secret in the Client secrets section.
Finalize: Copy the client secret to save it for later.
Create a GitHub steps integration in Torq
Navigate to the integration: Go to Build > Integrations > Steps > GitHub and click Add Instance.
Configure the integration:
Give the integration a unique and meaningful name.
Paste the GitHub secret that you copied earlier.
Finalize: Click Add.
Use GitHub steps in Torq workflows with installation access tokens
Create a GitHub App
Open Github: Navigate to Settings > Developer settings.
Create a GitHub App: Click New GitHub App, enter your password, and then click Confirm to confirm access to your account.
Register the GitHub App:
Enter a meaningful name.
For Homepage URL, enter
https://app.torq.io/.For Callback URL, enter
https://redir.torq.io/integrations/oauth_2.Enable Expire user authorization tokens.
Enable Request user authorization (OAuth) during installation.
Disable the webhook.
For Permissions, select the relevant permissions required for the Torq workflows’ interactions with the GitHub account.
Select Only on this account to restrict the App's installation to this account.
Finalize: Click Create GitHub App.
Install the GitHub App
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.
Create a private key: Click Generate a private key in the Private keys section.
Copy the key: Copy the key to save it for later. You will need it to set up custom secrets in Torq.
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.
Transfer ownership: Select the Advanced tab and click Transfer ownership.
Enter the GitHub App's name.
Enter the name of the organization to which you want to transfer the App.
Click Transfer this GitHub App.
Install and authorize the App: Select the Install tab and click Install.
Select All repositories.
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.
Navigate to the integration: In Torq, go to Build > Integrations > Custom Secrets and click Add Instance.
Add the client ID:
Enter a meaningful name for the client ID, such as
github_app_client_id.Paste the client ID you copied earlier.
Click Add.
Add the installation ID:
Enter a meaningful name for the installation ID, such as
github_app_installation_id.Paste the installation ID you generated and copied earlier.
Click Add.
Add the private key:
Enter a meaningful name for the installation ID, such as
github_signing_key.Paste the private key you generated and copied earlier.
Click Add.
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
Open the workflow: Navigate to Build > Workflows and open the relevant workflow.
Create a JWT: Add the Create GitHub JWT step and configure its parameters.
For the client ID, use the workflow context to select the client ID custom secret.
For the private key, use the workflow context to select the private key custom secret.
Create the app access token: Add the Get Application Access Token step and configure its parameters.
For the API URL, enter
https://api.github.com.For Installation, use the workflow context to select the installation ID custom secret.
For the JWT, use the workflow context to select the output of the Create GitHub JWT step.
(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.
Use the workflow context to select the token you generated with the Get Application Access Token step.
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.






