A personal access token lets InfraNest's automations act on GitHub when you can't install the InfraNest Automations app on your account or organisation.
#Overview
- Installing the app is the recommended way to connect GitHub — see Connect GitHub. Use a token only as a fallback when apps aren't allowed on your account or organisation.
- With a token, automations can still act on GitHub (open issues, run workflows, merge pull requests, set statuses, and more).
- A token cannot start automations from GitHub events like pushes, pull requests, workflow runs or releases — GitHub only sends those events to the app.
- A token reaches every repository you can access (you can't limit it to specific repositories), and it expires and must be replaced from time to time.
NoteIf you pick a GitHub trigger while only a token is connected, the automation builder will warn you, since tokens can't start automations.
#Create the token on GitHub
- On the GitHub connect screen in InfraNest, under API token, select Open the token page. GitHub opens a new classic token named InfraNest, with the repo scope already ticked. To do it by hand instead: on GitHub, open Settings → Developer settings → Personal access tokens → Tokens (classic), select Generate new token (classic), name it, and tick repo.
- Choose an expiry date.
- Select Generate token and copy it — GitHub shows it only once.
WarningIf your organisation uses single sign-on (SAML) on GitHub, you must also select Configure SSO next to the token and Authorize it for that organisation. Without this, GitHub refuses the token for the organisation's repositories.
#Connect it in InfraNest
- Go to Integrations and open GitHub.
- Select Connect (or Add account if you've already connected one).
- Under API token, paste the token into Personal access token and select Connect.
InfraNest checks the token with GitHub before saving it. The connection then appears under Accounts with your GitHub username.
#Use it in an automation
- In the automation builder, add any GitHub action under Do this.
- Choose this connection.
- Fill in the repository field — it will suggest the repositories your token can reach.
With a token, the team picker can't list your organisation's teams, so requesting a review from a team is easiest with the app installed on the organisation. Requesting reviews from people works either way.
#Replace an expiring token
GitHub emails you before a token expires. After the expiry date, the GitHub steps in your automations fail until you replace it. You replace it on the same connection, so your automations keep using it and nothing has to change in them:
- Create a new token on GitHub, as above, signed in as the same GitHub user.
- In InfraNest, open GitHub in Integrations and go to Accounts.
- Open the ⋯ menu on the token connection and select Replace the key.
- Paste the new token and select Test and replace.
- Delete the old token on GitHub.
InfraNest tries the new token first and only swaps it in when GitHub accepts it. A token from a different GitHub user is refused — connect that one as a new account instead. When GitHub has stopped accepting the token, the connection says so, with a button that opens the same Replace the key window.
#Disconnect
- Open GitHub in Integrations.
- Go to Accounts.
- Open the ⋯ menu on the token connection and select Disconnect.
Automations that use it are switched off. This removes the token from InfraNest, but it doesn't delete it on GitHub — delete it there yourself under Settings → Developer settings → Personal access tokens.
#Tips
- InfraNest works with GitHub.com. GitHub Enterprise Server (self-hosted GitHub) isn't supported.
- Your token is stored securely and never shown again.
- Anything an automation does on GitHub is done as you, so it appears under your name on GitHub.
Was this article helpful?
Thanks for your feedback!
Thanks, this goes straight to the docs team.