Skip to content

Reduce release asset uploads and bump to v0.1.8 #15

Reduce release asset uploads and bump to v0.1.8

Reduce release asset uploads and bump to v0.1.8 #15

Workflow file for this run

name: LOC Guard
on:
pull_request:
paths:
- 'src/**'
- 'packages/dram-plugin/src/**'
- 'scripts/check-file-loc.cjs'
- 'package.json'
- '.github/workflows/loc-guard.yml'
push:
branches:
- main
- master
paths:
- 'src/**'
- 'packages/dram-plugin/src/**'
- 'scripts/check-file-loc.cjs'
- 'package.json'
- '.github/workflows/loc-guard.yml'
jobs:
check-file-loc:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Build Changed File List
shell: bash
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
BASE_SHA="${{ github.event.pull_request.base.sha }}"
else
BASE_SHA="${{ github.event.before }}"
fi
HEAD_SHA="${{ github.sha }}"
if [[ "$BASE_SHA" == "0000000000000000000000000000000000000000" || -z "$BASE_SHA" ]]; then
git diff-tree --no-commit-id --name-only -r "$HEAD_SHA" > changed-files.txt
else
if ! git cat-file -e "$BASE_SHA^{commit}" 2>/dev/null; then
git fetch --no-tags --depth=1 origin "$BASE_SHA"
fi
git diff --name-only "$BASE_SHA" "$HEAD_SHA" > changed-files.txt
fi
echo "Changed files:"
cat changed-files.txt || true
- name: Enforce LOC policy
run: |
node scripts/check-file-loc.cjs \
--root src \
--root packages/dram-plugin/src \
--warn 500 \
--fail 700 \
--files-from changed-files.txt