The GitHub integration enables GitOps workflows, allowing you to store stack configurations in Git and maintain a full audit trail of infrastructure changes.
Overview
Connecting GitHub to Ankra enables:- Configuration Storage: Store Helm values and manifests in your repository
- Version Control: Track all infrastructure changes with Git history
- GitOps Workflows: Sync changes between Ankra and your repository
- Audit Trail: Full history of who changed what and when
- Collaboration: Use pull requests and code review for infrastructure changes
Connecting GitHub
1
Navigate to Cluster Settings
Go to your cluster and click Settings → Repository tab.
2
Connect GitHub
Click Connect GitHub. You’ll be redirected to GitHub to authorize the Ankra GitHub App.
3
Authorize Access
Review the permissions requested:
- Read access to metadata
- Read and write access to repository contents
4
Select Repository
Choose an existing repository or create a new one. Ankra will create a
clusters/ folder in this repository to store your configuration.5
Configure Sync
Choose your sync settings:
- Branch: Which branch to sync with (default:
main) - Auto-sync: Whether to automatically sync changes
Repository Structure
When connected, Ankra creates the following structure in your repository:Files Explained
Sync Behavior
Ankra → GitHub
When you make changes in Ankra:- Changes are saved to the platform
- Configuration is exported to the connected repository
- A commit is created with the changes
- You can see the commit in GitHub history
GitHub → Ankra
When you make changes in GitHub:- Push changes to the configured branch
- Ankra detects the changes
- Configuration is imported and validated
- Changes are applied to your cluster
Using GitOps
Making Changes via Git
1
Clone the Repository
2
Edit Configuration
Modify values files or manifests:
3
Commit and Push
4
Sync in Ankra
Navigate to your cluster’s GitOps page and click Sync to pull the changes, or wait for auto-sync if enabled.
Pull Request Workflow
For production environments, use pull requests:- Create a feature branch
- Make configuration changes
- Open a pull request
- Review changes with your team
- Merge to trigger sync
Ankra AI on Pull Requests
The Ankra GitHub App can also take part in the pull requests of every repository it is installed on. The capabilities are switched on per installation under AI → Settings → Connections → Source control & AI review → GitHub, and each can be overridden for an individual repository with a repository rule. AI code review is the canonical guide to those switches: what each one does, how repository rules layer over the installation-wide defaults, which model a review runs on, what the review posts, and when one is skipped. This page covers what is specific to GitHub.Ask Ankra in a Comment
Mention@ankraai anywhere in a pull request comment or review comment, and Ankra AI replies on the pull request with the diff and the pull request’s metadata as its context:
ankra-platform[bot]. A mention always gets an answer while Mention replies is on: it is not subject to the draft, target-branch, and daily-budget rules that gate automatic reviews, and it does not start a new automatic review.
How far the answer goes depends on the integration’s AI mode:
- Ask (the default) - the reply is read-only. Ankra explains, reviews, and points out problems in the diff, but changes nothing; asked to act, it says the conversation is read-only and points you to the portal.
- Agent - when the fix is clear (a failing pipeline, a broken manifest, a small defect visible in the diff), the reply can propose a concrete, ready-to-apply fix: the root cause, the exact file changes as code blocks, and an offer to open the fix as a pull request. Ankra still does not run code or execute platform actions from the comment thread.
Only comments written by people trigger a reply. Comments from bots (including Ankra’s own review and reply comments) and comments on plain issues are ignored, and Ankra reads the first 4,000 characters of the comment.
Merge when green
Mention@ankraai merge when green in a pull request comment and Ankra records the request instead of answering it as an ordinary mention - a plain question containing the phrase, or the phrase negated (“please do not merge when green”), is left to the ordinary reply lane. The same request is also available by asking Ankra AI in chat (Agent mode, with a confirmation card) and over the API; all three converge on the same evaluation.
The pull request merges (squash) the moment every one of these holds, evaluated fresh about every 30 seconds and the instant the pipeline run concludes, whichever comes first:
- Merge when green is on for the binding, and its AI mode is Agent - in Ask mode, or with the switch off, the request is refused and says which.
- The requester’s GitHub login is linked to a member of your Ankra organisation.
- The pull request’s head is not a fork.
- The newest Ankra Pipelines run for the head concluded successfully, and its
gatestep, if the definition declares one, passed. - The run executed under plainly approved authority - one that fell back to an earlier approval, or none, is refused rather than merged under it.
- Ankra’s own AI review has not requested changes on that exact commit.
- No human reviewer’s most recent review is Changes requested - unlike the AI review’s check above, this one is not scoped to the current commit: a changes-requested left on an earlier push still blocks until the same reviewer clears it with a later review.
Turning It On
1
Open the GitHub integration
Go to AI → Settings → Connections → Source control & AI review and find the GitHub installation. Each installation has its own switches and AI mode.
2
Choose the installation-wide switches
On the All repositories row, turn on AI review, Mention replies and PR previews as needed. They apply to every repository the installation covers.
3
Add repository rules for exceptions
Add a rule for a repository to give it its own switches. A rule replaces the installation-wide switches for that repository; remove the rule and the repository follows them again.
A Mention Gets No Reply
- Mention replies is off for the installation, or a repository rule for that repository has it off. A rule overrides the installation-wide switch, so check both.
- The comment does not contain
@ankraai. Mentioning the app’s own login,@ankra-platform, is not enough. - The comment was posted by a bot, or on an issue rather than a pull request.
- Ankra reacted with 👀 but never answered: the reply failed on Ankra’s side, for example because the AI provider did not answer. Nothing is posted in that case; mention
@ankraaiagain to retry. - No 👀 appeared at all: the mention never reached Ankra, so check the switches and the wording above before retrying.
Viewing Git History
In Ankra
Navigate to your cluster’s GitOps page to see:- Last sync timestamp
- Recent commits affecting this cluster
- Sync status and any errors
In GitHub
View the full commit history in your repository to see:- All configuration changes over time
- Who made each change
- Commit messages explaining changes
Managing Access
Repository Permissions
The Ankra GitHub App requests:Contents and Pull requests are required for the application setup flow (Dockerfile, manifests, and CI/CD pipeline generation). Workflows is required only when the setup pull request commits a
.github/workflows file: GitHub treats that path as protected, so it needs the dedicated permission in addition to Contents. Grant it anyway if you may ever ask for a generated workflow.Secrets is required for Application CI/CD. Ankra writes
ANKRA_REGISTRY_USERNAME and ANKRA_REGISTRY_PASSWORD as encrypted Actions secrets so the generated workflow can publish to the organisation’s private registry. Approve it under Settings → Applications → Installed GitHub Apps → Ankra → Configure.Revoking Access
To disconnect GitHub:- Go to cluster Settings → Repository
- Click Disconnect
- Go to GitHub Settings → Applications → Installed GitHub Apps
- Find Ankra and click Configure, then Uninstall (or adjust which repositories it can access)
Troubleshooting
Sync Failures
If sync fails, check:- Repository Access: Ensure the Ankra app still has access to the repository
- Branch Exists: Verify the configured branch exists
- Valid YAML: Ensure all configuration files are valid YAML
- Conflicts: Resolve any merge conflicts in the repository
Permission Errors
If you see permission errors:- Go to GitHub Settings → Applications → Installed GitHub Apps
- Find Ankra and click Configure
- Ensure the repository is in the “Selected repositories” list
- If GitHub shows a review updated permissions prompt, approve it. New permissions added to the Ankra App (such as Pull requests or Workflows) are not granted to existing installations until an owner re-approves them.
HTTP 403 - Resource not accessible by integration on the first write of an application setup means the installation cannot write to that repository at all - it is not a Workflows problem. Either the repository is not among the repositories the installation was granted (a repository created after the App was installed is not covered unless the installation was granted all repositories), or Contents (read/write) or Pull requests (read/write) is missing, or an updated permission set is still awaiting approval. Add the repository and approve any pending permissions under Settings → Applications → Installed GitHub Apps → Ankra → Configure for a user account, or Organization settings → GitHub Apps → Ankra → Configure for an organisation, then re-run setup. Public-repository reads succeed with such a token, which is why repository analysis can complete and only the write fails.A genuinely missing Workflows (read/write) permission reads differently: GitHub answers with its own body, refusing to allow a GitHub App to create or update workflow … without 'workflows' permission (422 on the Git Data API, 403 on the Contents API), and Ankra’s message names Workflows explicitly. It can only happen when the setup pull request actually commits a .github/workflows file - which, since Ankra Pipelines, is no longer the default.Out of Sync
If Ankra and GitHub are out of sync:- Navigate to the cluster’s GitOps page
- Click Force Sync to re-sync from the repository
- Review any conflicts and resolve them
Best Practices
CI/CD Integration
Integrate with CI/CD pipelines:GitHub Actions Example
Deployment Pipeline
Still have questions? Join our Slack community and we’ll help out.