GitHub Integration

Follow this guide to integrate Lintify with your GitHub repository using GitHub Actions.

Configuration Steps

1. Add GitHub Actions Workflow

Create a new file in your repository at .github/workflows/lintify.yml with the following content:

name: Lintify Analysis

on:
  pull_request:
    types: [opened, synchronize] # Trigger on PR creation or updates
    branches:
      - main # Analyze PRs targeting the 'main' branch

jobs:
  lintify:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v3
        with:
          fetch-depth: 0 # Fetch full history to enable git diff

      - name: Generate git diff
        run: |
          git diff origin/${{ github.event.pull_request.base.ref }} > diff.txt

      - name: Run Lintify
        run: |
          docker run --rm \
          -e PLATFORM=github \
          -e API_TOKEN=${{ secrets.GITHUB_TOKEN }} \
          -e REPOSITORY=${{ github.repository }} \
          -e PULL_REQUEST_NUMBER=${{ github.event.pull_request.number }} \
          -v ${{ github.workspace }}/diff.txt:/app/diff.txt \
          lintify-image:latest analyze --diff /app/diff.txt
            

2. Configure GitHub Secrets

The workflow uses the following secrets that need to be configured in your GitHub repository:

  • GITHUB_TOKEN - Automatically provided by GitHub Actions

Note: The GITHUB_TOKEN is automatically available in GitHub Actions workflows. You don't need to configure it manually.

3. Customize the Configuration

You can customize the workflow by modifying:

  • Trigger events: Change which events trigger the analysis
  • Target branches: Specify which branches to analyze
  • Docker image tag: Use a specific version of Lintify

How It Works

  1. When a pull request is opened or updated, the workflow automatically triggers.
  2. The action checks out your code and generates a diff between the PR branch and the target branch.
  3. Lintify analyzes the changes and posts comments directly on your pull request.

Troubleshooting

Common issues and their solutions:

Workflow doesn't trigger

Ensure your PR is targeting the correct branch and the workflow file is in the default branch.

Permission errors

Check if the GITHUB_TOKEN has sufficient permissions to post comments.

Need More Help?

If you're experiencing issues with the GitHub integration, our support team is here to help.