Skip to content

Keep GitHub or GitLab as your main repository, and deploy on every push (2026)

Your code stays on GitHub or GitLab. A push to the default branch updates production, every merge request opens a preview whose address arrives as a comment, and every commit gets its status.

By Aloïs Oddon, co-founder of Nextmap. Facts checked on November 19, 2026.

View as Markdown

Keep GitHub or GitLab as your main repository and deploy on every push with while: continuous deployment from GitHub or GitLab, a preview per merge request, the status of each commit, hosted in France

The short version. Create a token limited to your repository on GitHub or GitLab, then link the repository in the app’s settings, or ask your AI to. A push to the default branch updates production, every merge request opens a preview, and every commit gets its status.

Prerequisites

  • An app on while.
  • Its repository on GitHub or GitLab, and the right to create an access token there.

Step 1: Create an access token

On GitHub, create a fine-grained token limited to this repository1. Give it Contents read access, and Webhooks, Commit statuses and Pull requests write access.

On GitLab, create a token with the api scope2. Your account must have the Maintainer role on the project.

In while, open the app’s settings, in the Code and budget section, then click Link a repository. Choose GitHub or GitLab, paste the repository and the token. The repository is written atelier/boutique, or pasted as you copy it from GitHub or GitLab.

Your AI can also link it, with the link_git_repo tool:

You, to your AI: Link the app to our GitHub repository atelier/boutique.

It links it with the token you give it. With ChatGPT and Codex, the token does not go through the AI: it gives you the link to while’s form, where you paste it.

What happens on every push

A push to the repository’s default branch, main most often, updates production. Another branch does not touch it.

A merge request opens a preview, pr-12 on GitHub or mr-12 on GitLab, built from its latest commit. Its address arrives as a comment on the request as soon as it answers, and the preview is removed when the request is closed or merged.

Every commit gets its status on GitHub or GitLab: building, in production or failed, with the link to the app.

Continuous deployment from GitHub or GitLab to while: the status of each commit, building, in production or failed, the preview address as a comment on the merge request, a release waiting for a person's approval and a fork request authorized by hand
Every commit has its status, every merge request its preview.

When a release must be approved by a person, the commit status says so, with the link to the request. Once approved, it goes out on its own.

A merge request from a fork is not built on its own. A person on the project who can deploy authorizes each commit in while, and the preview receives none of the project’s secrets.

In the app’s settings, Unlink removes the webhook on GitHub or GitLab and erases the token from while. A push no longer deploys the app.

You, to your AI: Unlink the app’s GitHub repository.

The other way: push from GitHub Actions

If you prefer to keep deployment in your CI, your workflow pushes the code to the app’s git repository at while, with a token limited to this app.

In while, click Create a token for a CI. Choose the app, the right to deploy and read, and production as the only place it acts. Copy it: it is shown only once.

In GitHub, add it to the repository’s secrets as WHILE_TOKEN, then add this workflow:

.github/workflows/while.yml
name: while
on:
  push:
    branches: [main]
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - run: git push "https://while:${WHILE_TOKEN}@app.while.sh/git/boutique.git" HEAD:main
        env:
          WHILE_TOKEN: ${{ secrets.WHILE_TOKEN }}

Replace the address with your app’s, given in its settings on the Git repository line. A push to main at while updates production. The workflow fetches the whole repository history: git refuses to push a clone without its history to another repository.

In the docs: Git repository, Previews, Versions and rollback and Variables and secrets.

Next steps

Sources

  1. GitHub, Managing your personal access tokens, accessed November 19, 2026
  2. GitLab, Personal access tokens, accessed November 19, 2026

Questions

Do I still need to push to while’s git repository?

No. Once the repository is linked, a push to GitHub or GitLab is enough.

What happens to the token?

It is kept in while’s vault. It can never be read back, neither in while nor by your AI.

I link another repository. What happens to the first one?

It is unlinked, and its webhook is removed. Only the new repository deploys the app.

My GitLab is self-hosted. Does it work?

Yes, like a GitHub Enterprise. Paste the repository’s address, and the forge is recognized from it.

Does a release that needs approval still go out?

It waits. The commit status says so, with the link to the request, and once approved, it goes out on its own.

What about a merge request from a fork?

It is not built on its own. A person on the project authorizes each commit in while, and the preview receives none of the project’s secrets.

Give your AI the message, and it takes care of the rest

Give this to your AI

Read while.sh/agents and help me get started with while.

Copy the message

In 3 minutes, with no sign-up, the tool has its own address. To keep it, create your account.

For a company project, write to the while team: hello@while.sh