Skip to content

GitHub

Run Lunos on issues and pull requests from a GitHub Actions workflow, with your own token.

Lunos can work on GitHub issues and pull requests. Mention /lunos or /oc in a comment, and a GitHub Actions workflow runs Lunos on the repository and answers in the thread. If Lunos changes code, it opens a pull request, or pushes to the pull request it was asked about.

The workflow runs with a GitHub token you control. There is no Lunos GitHub App to install, and nothing is sent to a token-exchange service.

Set it up

Run this from the repository:

Terminal window
lunos github install

It asks for a model provider and a model, then writes .github/workflows/lunos.yml. Next:

  1. Commit the workflow file and push it.
  2. Add your model provider’s API key to the repository or organisation secrets, under the names the command printed (for example MISTRAL_API_KEY).
  3. Comment /oc summarize on an issue to try it.

The generated workflow looks like this:

name: lunos
on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
jobs:
lunos:
if: |
contains(github.event.comment.body, ' /oc') ||
startsWith(github.event.comment.body, '/oc') ||
contains(github.event.comment.body, ' /lunos') ||
startsWith(github.event.comment.body, '/lunos')
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
issues: write
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
persist-credentials: false
- name: Run Lunos
uses: AxsionDev/Lunos/github@vX.Y.Z # your Lunos version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MISTRAL_API_KEY: ${{ secrets.MISTRAL_API_KEY }}
with:
model: mistral/devstral-latest
version: X.Y.Z
use_github_token: true

The action and the version it installs are pinned to the Lunos version that wrote the workflow. The action installs lunos-ai from npm and runs lunos github run. Lunos pushes with the token in GITHUB_TOKEN, so checkout doesn’t keep its own credentials.

The token

By default the workflow uses the repository’s own GITHUB_TOKEN, which GitHub creates for each run. The permissions block gives it what Lunos needs:

PermissionWhy
contents: writepush commits and branches
pull-requests: writeopen pull requests and comment on them
issues: writecomment on issues and add a reaction to the triggering comment

Lunos then acts as github-actions[bot]. One GitHub limit applies: pushes and pull requests made with GITHUB_TOKEN don’t start other workflows, so your CI won’t run on a pull request Lunos opens.

To act as a different account, or to have CI run on Lunos’s pull requests, use a fine-grained personal access token instead:

  1. Create the token for this repository only, with Contents, Pull requests and Issues set to read and write.
  2. Store it as a repository secret, for example LUNOS_GITHUB_TOKEN.
  3. In the workflow, set GITHUB_TOKEN: ${{ secrets.LUNOS_GITHUB_TOKEN }}.

Action inputs

InputDefaultWhat it does
model(required)provider/model to run
versionlatestlunos-ai version to install
agentthe config’s default agenta primary agent to use
promptthe commentreplaces the prompt
mentions/lunos,/occomma-separated trigger phrases
variantnoneprovider-specific reasoning effort
shareofftrue shares the session; sharing must also be enabled in your Lunos config, with an organisation console or enterprise.url to share to. Without one the run logs why and carries on
use_github_tokentrueuse the GITHUB_TOKEN env var
oidc_base_urlnoneonly with use_github_token: false: a GitHub App token-exchange service you run

A Lunos GitHub App, which would remove the token step, is planned with Lunos Cloud.