Skip to content

A GitHub action for automatically evaluating the logic level impacts of Pull Requests. Multi languages support.

Notifications You must be signed in to change notification settings

williamfzc/diffctx

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

diffctx = diff context

Latest Release

A GitHub action for automatically evaluating the logic level impacts of Pull Requests.

Showcase

With a simple setup in your GitHub Action:

- name: diffctx
  uses: williamfzc/[email protected]
  with:
    lang: "golang"

Diffctx will automatically analyse the diff (and the context of diff) every new PullRequests in your repo, and leave comments for indicating which part you should care most:

image

williamfzc/srctx#52

Based on LSIF, diffctx will not only analyse the lines contained by the diff, but also the full scope of your repo, and understand it well.

Usage

diffctx can be directly used with GitHub Action.

Add to GitHub Action

name: Test PR

# triggered by pull_request
on: [ push, pull_request ]

# for creating comments
permissions:
  pull-requests: write

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          # at least
          fetch-depth: 2

      # ...

      - name: diffctx
        uses: williamfzc/[email protected]
        with:
          # see the `Supported Langs` for details
          lang: "golang"

Done!

You can create a new PullRequest for test.

Or test it with a push. You can find it in actions log.

image

Supported Languages

Overview

Language Ready? Keyword in yaml Real-world Sample
Golang golang ci.yml
Java java main.yml
Kotlin ✅🚧 kotlin build.yml
NodeJs node build.yml
Python python run-test.yml

Want more langs?

Thanks to tree-sitter and LSIF, diffctx can support nearly all the popular languages.

https://lsif.dev/

Adding a new language support is not hard. PullRequests are always welcome!

How it works

  1. Scan the repo and understand it well
  2. Extract the sub graph influenced by the diff
  3. Generate a summary from sub graph
  4. Create a comment

Contribution

Issues, PRs and suggestions are always welcome.

Roadmap

  • More languages
  • Better comment format
  • Extract more meaningful columns (like function definition) from code
  • Display graph in comment also

About

A GitHub action for automatically evaluating the logic level impacts of Pull Requests. Multi languages support.

Topics

Resources

Stars

Watchers

Forks