https://github.com/williamfzc/diffctx
A GitHub action for automatically evaluating the logic level impacts of Pull Requests. Multi languages support.
https://github.com/williamfzc/diffctx
codereview github-actions pullrequest
Last synced: 5 months ago
JSON representation
A GitHub action for automatically evaluating the logic level impacts of Pull Requests. Multi languages support.
- Host: GitHub
- URL: https://github.com/williamfzc/diffctx
- Owner: williamfzc
- Created: 2023-04-13T14:57:50.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-08-14T13:02:39.000Z (over 2 years ago)
- Last Synced: 2025-08-31T02:41:22.031Z (5 months ago)
- Topics: codereview, github-actions, pullrequest
- Language: Python
- Homepage:
- Size: 73.2 KB
- Stars: 36
- Watchers: 2
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# diffctx = diff context
[](https://github.com/williamfzc/diffctx/releases/latest)
A GitHub action for automatically evaluating the logic level impacts of Pull Requests.
## Showcase
With a simple setup in your GitHub Action:
```yaml
- name: diffctx
uses: williamfzc/diffctx@v0.3.13
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:

> https://github.com/williamfzc/srctx/pull/52
Based on [LSIF](https://microsoft.github.io/language-server-protocol/overviews/lsif/overview/), 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
```yaml
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/diffctx@v0.3.13
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.

## Supported Languages
### Overview
| Language | Ready? | Keyword in yaml | Real-world Sample |
|----------|--------|-----------------|-------------------------------------------------------------------------------------------------------------------|
| Golang | ✅ | `golang` | [ci.yml](https://github.com/williamfzc/srctx/blob/test_diffctx/.github/workflows/ci.yml) |
| Java | ✅ | `java` | [main.yml](https://github.com/williamfzc/java-diffctx-sample/blob/main/.github/workflows/main.yml) |
| Kotlin | ✅🚧 | `kotlin` | [build.yml](https://github.com/williamfzc/kt-diffctx-sample/blob/main/.github/workflows/build.yml) |
| NodeJs | ✅ | `node` | [build.yml](https://github.com/williamfzc/node-diffctx-sample/blob/master/.github/workflows/grpc-tools-build.yml) |
| Python | ✅ | `python` | [run-test.yml](https://github.com/williamfzc/py-diffctx-sample/blob/main/.github/workflows/run-tests.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.
- [diffctx](https://github.com/williamfzc/diffctx): for the whole workflow
- [srctx](https://github.com/williamfzc/srctx): the core analyzer
## Roadmap
- [ ] More languages
- [ ] Better comment format
- [ ] Extract more meaningful columns (like function definition) from code
- [ ] Display graph in comment also