GitHub
This walkthrough connects a GitHub account, creates an issue from a workflow, and starts a workflow whenever a new issue is opened.
The GitHub app talks to https://api.github.com. Every request made with a GitHub connection gets these default
headers, and the credentials are only ever sent to api.github.com:
Accept: application/vnd.github+json
X-GitHub-Api-Version: 2022-11-28
Like every request Blokkio sends, they also carry Blokkio's default User-Agent: Blokkio/<version> (+https://blokkio.com),
which GitHub requires.
GitHub offers two ways to connect:
| Option | Best for |
|---|---|
| Sign in with GitHub (OAuth) | The quickest setup, when your Blokkio platform has GitHub one-click sign-in configured |
| Personal access token | Fine-grained control over which repositories and permissions Blokkio gets, or when one-click isn't available |
Option A: Personal access token
1. Create the token on GitHub
In GitHub, go to Settings → Developer settings → Personal access tokens. Either token type works; Blokkio
sends it as Authorization: Bearer <token>.
Fine-grained token (recommended). Choose Fine-grained tokens → Generate new token, pick the resource owner and select the repositories Blokkio may use. Then grant the repository permissions your workflows need:
| Permission | Access | Needed for |
|---|---|---|
| Metadata | Read (always included) | Get repository, New star |
| Issues | Read and write | List issues, Create issue, Update issue, Create issue comment, New issue |
| Pull requests | Read | List pull requests, New pull request |
| Contents | Read and write | Create release, New release |
Grant only what you use: for a workflow that only reads issues, Issues: Read is enough.
Classic token. Choose Tokens (classic) → Generate new token and select the repo scope (full access to
private repositories, which includes issues, pull requests and releases). For public repositories only,
public_repo is enough.
Set an expiry date and copy the token; GitHub shows it only once.
2. Create the connection
- In Blokkio, go to Apps and open GitHub.
- In the Personal access token row, click Connect.
- Enter a name, for example
GitHub (acme bot), paste the token into Personal access token and click Create.
To manage the token centrally, store it as a secret first and click Use secret
next to the field instead of pasting it. The connection then holds secret://GITHUB_TOKEN, and you can give each
environment its own token through the secret's environment values.
On the Connections page, use ⋯ → Test connection to check the token. Blokkio calls GET /user and
reports, for example, Connected — api.github.com answered 200.
A personal access token isn't refreshed. When it expires or is revoked, the connection is marked Auth failed on the next request; edit the connection (⋯ → Edit or rename) and paste a new token.
Option B: Sign in with GitHub (OAuth)
- Go to Apps and open GitHub.
- In the Sign in with GitHub row, click Sign in.
- A popup opens on GitHub. Review the access and click Authorize.
- The popup closes and Blokkio shows GitHub connected. The new connection is named
GitHub.
Blokkio requests these scopes:
| Scope | Grants |
|---|---|
repo | Read and write access to your public and private repositories, including issues, pull requests and releases |
read:user | Read your profile |
The connection acts as you: it can reach every repository your GitHub account can, including organization repositories the organization allows OAuth apps to access. If you want to restrict Blokkio to a few repositories, use a fine-grained personal access token instead.
If the row doesn't show (one click) and connecting reports that sign-in isn't configured, one-click sign-in with GitHub isn't available right now. Use a personal access token, or your own GitHub OAuth app.
:::note Redirect URI
You never register a redirect URI for one-click sign-in: Blokkio's GitHub OAuth app already has it. For
your own GitHub OAuth app, register https://api.blokkio.com/api/connections/oauth2/callback.
:::
Create an issue from a workflow
This example opens an issue whenever a webhook receives an error report.
-
Open a workflow and add a Webhook trigger.
-
In the toolbox, search for
github create issue. Drag Create issue (listed with GitHub) onto the canvas and connect it to the trigger. This creates an App Action node with the app and action already chosen. -
Open the node and fill in:
Field Value Connection Your GitHub connection (only GitHub connections are listed) Action Create issue Owner acmeRepository websiteTitle Error: {{ $trigger.body.message }}Body Reported at {{ $now }} by {{ $trigger.body.service }}Labels ["bug", "from-blokkio"] -
Rename the node to
Create issueand save.
Blokkio sends:
POST https://api.github.com/repos/acme/website/issues
Authorization: Bearer ••••
Accept: application/vnd.github+json
X-GitHub-Api-Version: 2022-11-28
Content-Type: application/json
{ "title": "Error: Timeout", "body": "Reported at …", "labels": ["bug", "from-blokkio"] }
The node's output is GitHub's response, so later nodes can use the new issue:
{{ $nodes['Create issue'].number }}
{{ $nodes['Create issue'].html_url }}
Inputs left empty are not sent. Labels and Assignees take a JSON array or an expression that returns one.
Other GitHub actions work the same way. A list action such as List repositories follows GitHub's Link
header across pages and returns { "items": [...], "pages": n }, so you can loop over
{{ $nodes['List repositories'].items }}. See Official apps for every GitHub action and
its inputs.
:::tip Call any other endpoint
For endpoints without a ready-made action, add an HTTP Request node, choose Use
Connection with your GitHub connection and enter only the path, for example /repos/acme/website/labels.
The base URL https://api.github.com and the default headers are added for you. See
Base URL and default headers.
:::
Start a workflow on new issues
- Create a workflow and, from the toolbox, add GitHub's New issue trigger (search
github new issue). This creates an App Trigger node. - Choose your GitHub Connection and fill in Owner and Repository. Optionally set Only with
labels, for example
bug,urgent. - Set Poll Interval (seconds), for example
300. Your plan sets the minimum (see Plan limits). - Add the steps that should run for each new issue, for example a Slack message, and publish the workflow.
Blokkio polls GET /repos/{owner}/{repo}/issues and starts one run per new issue, oldest first. Pull requests,
which GitHub also lists as issues, are skipped; use the New pull request trigger for those. The first poll
after publishing only records the existing issues, so you won't get a run for every old issue.
Each run gets the issue as the trigger output:
{{ $trigger.title }}
{{ $trigger.html_url }}
{{ $trigger.user.login }}
{{ $trigger.labels[0].name }}
Trigger inputs are plain values: expressions are not evaluated in them.
GitHub also has New pull request, New release and New star triggers. They work the same way.
Start a workflow instantly
The (instant) triggers start a run the moment GitHub sends the event, instead of on the next poll. When you publish, Blokkio adds a webhook to the repository with your connection (with a random signing secret) and removes it again when you unpublish, pause or delete the workflow. See App triggers for how instant triggers work.
| Trigger | Key | What starts a run | Inputs (required) | Output |
|---|---|---|---|---|
| New issue (instant) | new_issue_instant | An issue is opened (issues event, action opened). | Owner, Repository | action, issue, repository, sender |
| New pull request (instant) | new_pull_request_instant | A pull request is opened. | Owner, Repository | action, number, pull_request, repository, sender |
| New push (instant) | new_push_instant | A push to the repository. | Owner, Repository, Only this branch (refs/heads/main) | ref, before, after, commits, head_commit, pusher |
| New release (instant) | new_release_instant | A release is published. | Owner, Repository | action, release, repository, sender |
| Repository event (instant) | repository_event | Any webhook events you list, optionally only some action values. | Owner, Repository, Events (for example issue_comment, workflow_run), Only these actions | The event payload |
The connection needs admin access to the repository: a fine-grained token with Webhooks: Read and write,
or a classic token / OAuth grant with admin:repo_hook (the one-click app asks for repo, which includes it).
Every delivery is verified with the X-Hub-Signature-256 header, and a redelivery (same X-GitHub-Delivery id)
doesn't start a second run. GitHub's ping after creating the webhook is ignored.
{{ $trigger.issue.title }}
{{ $trigger.issue.html_url }}
{{ $trigger.sender.login }}
You can see every delivery in the repository under Settings → Webhooks → Recent deliveries.
Troubleshooting
| Problem | Fix |
|---|---|
404 Not Found on a private repository | The token or OAuth grant can't see the repository. For a fine-grained token, add the repository to the token. For an organization, check that it allows the token or OAuth app. |
403 Resource not accessible by personal access token | The fine-grained token lacks a permission, for example Issues: Read and write for Create issue. |
| Publishing an instant trigger fails with answered 404 or 403 | The connection can't manage the repository's webhooks. It needs admin access (see Start a workflow instantly), or use the polling trigger. |
401 and the connection shows Auth failed | The token expired or was revoked. Edit the connection and paste a new token, or Re-authenticate an OAuth connection. |
| Connection '…' may only be used with api.github.com | An HTTP Request node used the connection with another host. Use a relative path or an https://api.github.com/… URL. |