Git AI

CI Workflows

Automate authorship tracking in your CI/CD pipeline with git-ai's continuous integration workflows

CI Workflows

The GitHub, GitLab and BitBucket GUIs have "Squash and Merge" and "Rebase and Merge". Since the SCM tools aren't running Git AI on their servers, authorship information is not preserved through these operations the way it would be locally.

Git AI has a Cloud + Self-Hosted SCM App that will automatically rewrite authorship information when PRs to any repository are merged. It is under development and will be available soon, if you want to get early access schedule a call.

Alternatively there are CI Scripts in the Open Source repository that can run in your CI/CD pipeline to update the Authorship Logs after a PR is "Squash|Rebase and Merged". You will have to set them up in the CI pipeline for each repository you want to track authorship in.

GitHub Actions

The GitHub Actions workflow automatically runs when pull requests are merged, detecting squash and rebase merges and rewriting authorship accordingly.

Installation

Install the GitHub Actions workflow in your repository:

git-ai ci github install

This creates .github/workflows/git-ai.yaml in your repository with the following configuration:

  • Trigger: Runs on pull request close events
  • Permissions: Requires contents: write to push authorship notes
  • Actions:
    1. Installs git-ai from the official install script
    2. Configures git user as github-actions[bot]
    3. Runs git-ai ci github run to process the merge
.github/workflows/git-ai.yaml
name: Git AI

on:
  pull_request:
    types: [closed]

jobs:
  git-ai:
    if: github.event.pull_request.merged == true
    runs-on: ubuntu-latest
    permissions:
      contents: write

    steps:
      - name: Install git-ai
        run: |
          curl -fsSL https://usegitai.com/install.sh | bash
          echo "$HOME/.git-ai/bin" >> $GITHUB_PATH
      - name: Run git-ai
        id: run-git-ai
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          git config --global user.name "github-actions[bot]"
          git config --global user.email "github-actions[bot]@users.noreply.github.com"
          git-ai ci github run

GitLab CI

The GitLab CI job automatically runs when commits are pushed to your default branch, detecting squash and rebase merges and rewriting authorship accordingly.

Setup

Run the following command to generate the YAML snippet top copy into your .gitlab-ci.yml file.

git-ai ci gitlab install

Add the following job to your .gitlab-ci.yml file.

The default CI_JOB_TOKEN often lacks API query permissions. You'll need to create a dedicated access token.

Create an access token:

  1. Go to Settings → Access tokens → Add new token

    • Name: git-ai
    • Role: Maintainer
    • Scopes: api, write_repository (both required)
  2. Go to Settings → CI/CD → Variables → Add variable

    • Key: GITLAB_TOKEN
    • Value: paste your token
    • Check Masked

Configuration:

  • Trigger: Runs on push events to the default branch
  • Permissions: Requires api and write_repository scopes
  • Actions:
    1. Installs git-ai from the official install script
    2. Configures git user as gitlab-ci[bot]
    3. Runs git-ai ci gitlab run to process the merge
.gitlab-ci.yml
git-ai:
  stage: build
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "push"
      when: always
  script:
    - curl -fsSL https://usegitai.com/install.sh | bash
    - export PATH="$HOME/.git-ai/bin:$PATH"
    - git config --global user.name "gitlab-ci[bot]"
    - git config --global user.email "gitlab-ci[bot]@users.noreply.gitlab.com"
    - git-ai ci gitlab run

BitBucket Pipelines

Not currently supported. PRs welcome on GitHub.

Azure Repos

Not currently supported. PRs welcome on GitHub.