mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-01-20 20:38:03 -05:00
add line changes diff bot to CI (#1863)
This commit is contained in:
51
.github/workflows/szdiff.yml
vendored
Normal file
51
.github/workflows/szdiff.yml
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
name: Check Line Counts
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
# Cancel the workflow in progress in newer build is about to start.
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
szdiff:
|
||||
name: Core Library Line Difference
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code from pr
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.ref }}
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
path: pr
|
||||
- name: Checkout code from base
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.base.sha }}
|
||||
path: base
|
||||
- name: Set up Python 3.10
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.10'
|
||||
- name: Count Lines Of Code
|
||||
run: |
|
||||
pip install tabulate
|
||||
BASE="$GITHUB_WORKSPACE/base"
|
||||
PR="$GITHUB_WORKSPACE/pr"
|
||||
cp "$PR/sz.py" .
|
||||
echo "loc_content<<EOF" >> "$GITHUB_ENV"
|
||||
python sz.py "$BASE" "$PR" >> "$GITHUB_ENV"
|
||||
echo "EOF" >> "$GITHUB_ENV"
|
||||
- name: Comment Code Lines
|
||||
continue-on-error: false
|
||||
uses: marocchino/sticky-pull-request-comment@v2
|
||||
with:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
header: LOC
|
||||
ignore_empty: true
|
||||
skip_unchanged: true
|
||||
recreate: true
|
||||
message: ${{ env.loc_content }}
|
||||
Reference in New Issue
Block a user