GitHub
Receive GitHub events via webhooks and call the GitHub API from your patterns.
GitHub is one of the most common integrations for automation workflows. You can receive events from GitHub (push, pull request, issue, deployment) and call the GitHub API to read data, create comments, manage labels, and more. In DRAGOPS, both directions use standard nodes — On Webhook for inbound events and HTTP Request for outbound API calls.
Receive GitHub events
GitHub sends webhook events when activity happens in a repository — pushes, pull requests, issues, releases, deployments, and dozens more. To receive these events in DRAGOPS, you point a GitHub webhook at your pattern's webhook URL.
Set up the GitHub webhook
- Open your pattern in the DRAGOPS editor and note the webhook URL from the Triggers panel. DRAGOPS assigns this URL when you create the pattern, so it is available before you deploy.
- In GitHub, go to your repository's Settings > Webhooks > Add webhook.
- Paste your DRAGOPS webhook URL in the Payload URL field.
- Set Content type to
application/json. - Choose which events to receive — select Let me select individual events and pick the ones you need (for example, Issues, Pull requests, Pushes).
- Select Add webhook.
GitHub sends a ping event immediately to verify the URL is reachable. Once your pattern is deployed, it receives all selected events at that URL.
Parse the incoming event
Every GitHub webhook delivery includes headers that identify the event type and a JSON body with the event payload.
Key headers:
| Header | Description |
|---|---|
x-github-event | The event type: push, issues, pull_request, ping, etc. |
x-github-delivery | A unique ID for this delivery (useful for deduplication) |
x-hub-signature-256 | HMAC-SHA256 signature for payload verification |
To determine the event type in your pattern:
- Wire On Webhook's Headers output pin to a Get Property node.
- Set the Key to
x-github-event. - Use a Branch node (or multiple branches) to route execution based on the event type.
Verify the webhook signature
GitHub signs every webhook payload with an HMAC-SHA256 signature using a secret you configure. To verify that a request genuinely came from GitHub:
- When creating the webhook in GitHub, enter a Secret value.
- In your pattern, extract the
x-hub-signature-256header using Get Property. - Compute the expected signature from the raw request body and your secret using an HMAC node.
- Compare the computed signature to the received signature.
- Use a Branch node to reject requests with invalid signatures.
This prevents unauthorized services from triggering your pattern.
Example payloads
Issues event (opened)
{
"action": "opened",
"issue": {
"number": 42,
"title": "Login page returns 500 error",
"body": "Steps to reproduce: ...",
"labels": [
{ "name": "bug" }
],
"user": {
"login": "octocat"
},
"html_url": "https://github.com/my-org/my-repo/issues/42"
},
"repository": {
"full_name": "my-org/my-repo"
}
}Push event
{
"ref": "refs/heads/main",
"commits": [
{
"id": "abc123",
"message": "Fix authentication timeout",
"author": { "name": "octocat", "email": "[email protected]" },
"url": "https://github.com/my-org/my-repo/commit/abc123"
}
],
"repository": {
"full_name": "my-org/my-repo"
},
"pusher": {
"name": "octocat"
}
}Call the GitHub API
The GitHub REST API lets you read and write data across repositories, issues, pull requests, releases, and more. In DRAGOPS, you call it with the HTTP Request node.
Authentication
The GitHub API requires authentication for most endpoints. You have two options:
Option A: Use a GitHub connection (recommended)
- Go to the Connections page in the DRAGOPS dashboard and set up a GitHub OAuth connection.
- In the editor, select your HTTP Request node and choose the GitHub connection from the Connection dropdown in the Inspector Panel.
- DRAGOPS injects the
Authorizationheader automatically.
Option B: Use a personal access token manually
- Generate a personal access token in GitHub under Settings > Developer settings > Personal access tokens.
- In your pattern, build the authorization header:
- Wire the token value (from a secret or a variable) to the Format node's first input.
List repository issues
Create a comment on an issue
To post a comment, send a POST request to the issue comments endpoint with a JSON body:
Get repository information
Complete example: Auto-acknowledge bug reports
This pattern receives a GitHub issue event, checks whether the issue has a "bug" label, and automatically posts a comment acknowledging the bug report.
Pattern layout
Step-by-step
- On Webhook receives the GitHub webhook delivery.
- Get Property (Key: "x-github-event") extracts the event type from the headers.
- Branch checks if the event is
issues. If not, the pattern logs and exits. - Get Property (Key: "action") extracts the action from the body.
- Branch checks if the action is
opened. Only newly opened issues proceed. - Get Property (Key: "issue") extracts the issue object.
- The pattern checks whether the issue's labels array contains an entry with
"name": "bug". You can use JSON Stringify on the labels array and a string Contains check, or iterate with For Each and compare label names. - If the issue has a "bug" label, the pattern builds a comment and posts it to the GitHub API.
Building the comment request
Test the pattern
- Select Run in the toolbar.
- Enter test event data that simulates a GitHub issue event:
{
"body": {
"action": "opened",
"issue": {
"number": 42,
"title": "Login page returns 500 error",
"labels": [{ "name": "bug" }],
"user": { "login": "octocat" },
"html_url": "https://github.com/my-org/my-repo/issues/42"
},
"repository": {
"full_name": "my-org/my-repo"
}
},
"headers": {
"x-github-event": "issues",
"x-github-delivery": "test-delivery-001",
"content-type": "application/json"
},
"query": {},
"method": "POST"
}- Verify that the execution flow reaches the HTTP Request node that posts the comment. In a live environment with a valid token, the comment appears on the GitHub issue.
Test with curl
Once the pattern is deployed, you can simulate a GitHub webhook delivery with curl:
curl -X POST https://your-dragops-webhook-url \
-H "Content-Type: application/json" \
-H "X-GitHub-Event: issues" \
-H "X-GitHub-Delivery: test-001" \
-d '{
"action": "opened",
"issue": {
"number": 42,
"title": "Login page returns 500 error",
"labels": [{"name": "bug"}],
"user": {"login": "octocat"},
"html_url": "https://github.com/my-org/my-repo/issues/42"
},
"repository": {
"full_name": "my-org/my-repo"
}
}'Tips
- Use tap mode for real payloads. Instead of writing test JSON by hand, use tap mode to capture a real GitHub webhook delivery in the editor.
- Filter events at the source. In GitHub's webhook settings, select only the events you need. This reduces unnecessary executions and keeps your pattern focused.
- Set the User-Agent header. GitHub's API requires a
User-Agentheader. If you get 403 responses, add a Set Property node with the keyUser-Agentand a descriptive value likeDRAGOPS-Automation. - Handle rate limits. The GitHub API enforces rate limits (5,000 requests per hour for authenticated users). Check the
x-ratelimit-remainingresponse header and add retry logic for high-volume patterns. - Use connections for tokens. Store your GitHub personal access token or OAuth credentials in a connection rather than hardcoding them in String literals. Connections are encrypted, updatable, and revocable.
Related
- Make HTTP requests -- HTTP Request node reference with authentication patterns
- Webhooks -- webhook URLs, tap mode, and HMAC signature validation
- Work with JSON -- parse GitHub API responses and build request bodies
- Handle errors -- wrap API calls in Try / Catch for resilient integrations
- Connect external services -- store GitHub tokens securely with connections