mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-04-07 03:00:26 -04:00
52 lines
1.6 KiB
YAML
52 lines
1.6 KiB
YAML
name: Check Line Counts
|
|
on:
|
|
pull_request_target:
|
|
|
|
# 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 branch
|
|
uses: actions/checkout@v4
|
|
with:
|
|
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
|
path: pr
|
|
# the base default to tinygrad master and cannot be other fork branch for security purpose
|
|
- name: Checkout code from tinygrad master
|
|
uses: actions/checkout@v4
|
|
with:
|
|
path: base
|
|
- name: Set up Python 3.10
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '3.10'
|
|
- name: Count Line Diff
|
|
run: |
|
|
pip install tabulate
|
|
BASE="$GITHUB_WORKSPACE/base"
|
|
PR="$GITHUB_WORKSPACE/pr"
|
|
cp "$BASE/sz.py" .
|
|
echo "loc_content<<EOF" >> "$GITHUB_ENV"
|
|
python sz.py "$BASE" "$PR" >> "$GITHUB_ENV"
|
|
echo "EOF" >> "$GITHUB_ENV"
|
|
- name: Comment Code Line Diff
|
|
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 }}
|