Diffctx
A GitHub action for automatically evaluating the logic level impacts of Pull Requests. Multi languages support.
Install / Use
/learn @williamfzc/DiffctxREADME
diffctx = diff context
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/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:
<img width="912" alt="image" src="https://github.com/williamfzc/srctx/assets/13421694/46de1eaa-efd2-496e-ba85-838e3da1063c">https://github.com/williamfzc/srctx/pull/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/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.
<img width="1046" alt="image" src="https://github.com/williamfzc/diffctx/assets/13421694/bd6370d5-c7d0-4530-949f-94a66770923a">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
- Scan the repo and understand it well
- Extract the sub graph influenced by the diff
- Generate a summary from sub graph
- 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
