Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
bb25eb8
feat(ci): add PR size label pipeline
williamfzc Mar 31, 2026
ebd65ed
chore(ci): make PR label sync non-blocking
williamfzc Mar 31, 2026
b1599d4
feat(ci): add dry-run mode for PR label sync
williamfzc Mar 31, 2026
04351c7
feat(ci): add PR label dry-run samples
williamfzc Mar 31, 2026
05c50a7
test(ci): update PR label samples with real historical merged PRs
williamfzc Mar 31, 2026
91ce441
feat(ci): add high-level area tags for PRs
williamfzc Mar 31, 2026
5a841dc
refactor(ci): extract pr-label-sync logic to a dedicated directory
williamfzc Mar 31, 2026
8e0c997
refactor(ci): rename pr label script directory for simplicity
williamfzc Mar 31, 2026
de656ee
ci: add GitHub Actions workflow to check skill format
williamfzc Mar 31, 2026
7b4657e
test(ci): update sample json to include expected_areas
williamfzc Mar 31, 2026
c781307
refactor(scripts): move skill format check to isolated directory and …
williamfzc Mar 31, 2026
117cb8e
test(scripts): add positive and negative tests for skill format check
williamfzc Mar 31, 2026
701160c
fix(scripts): revert skill changes and downgrade version/metadata che…
williamfzc Mar 31, 2026
cc58e06
fix(scripts): completely remove version check and skip lark-shared
williamfzc Mar 31, 2026
4df331f
refactor(ci): improve pr-labels script readability and maintainability
williamfzc Mar 31, 2026
d0fe4cf
Merge remote-tracking branch 'origin/codex/pr-label-pipeline'
williamfzc Mar 31, 2026
1ecb2f2
Merge remote-tracking branch 'origin/feature/skill-format-check'
williamfzc Mar 31, 2026
c9de60f
ci: fix setup-node version in pr-labels workflow
williamfzc Mar 31, 2026
d8c7a07
docs: add dummy comment to test CI pipeline
williamfzc Mar 31, 2026
0374f08
docs: add dummy change in base shortcut to trigger CI
williamfzc Mar 31, 2026
b409aa4
chore: test Skill Format Check action
williamfzc Mar 31, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/pr-labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: PR Labels

on:
pull_request_target:
types:
- opened
- reopened
- synchronize
- ready_for_review

permissions:
contents: read
pull-requests: read
# PR labels are managed through the issues API.
issues: write

jobs:
sync-pr-labels:
if: ${{ github.event.pull_request.state == 'open' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: '20'

- name: Sync managed PR labels
# Labeling is best-effort and must not block PR merges.
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: node scripts/pr-labels/index.js
32 changes: 32 additions & 0 deletions .github/workflows/skill-format-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Skill Format Check

on:
push:
branches: [main]
paths:
- "skills/**"
- "scripts/skill-format-check/**"
- ".github/workflows/skill-format-check.yml"
pull_request:
branches: [main]
paths:
- "skills/**"
- "scripts/skill-format-check/**"
- ".github/workflows/skill-format-check.yml"

permissions:
contents: read

jobs:
check-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Run Skill Format Check
run: node scripts/skill-format-check/index.js
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -285,3 +285,4 @@ When running, it calls Lark/Feishu Open Platform APIs. To use these APIs, you mu
- [Feishu Open Platform App Service Provider Security Management Specifications](https://open.feishu.cn/document/uAjLw4CM/uMzNwEjLzcDMx4yM3ATM/management-practice/app-service-provider-security-management-specifications)
- [Lark User Terms of Service](https://www.larksuite.com/user-terms-of-service)
- [Lark Privacy Policy](https://www.larksuite.com/privacy-policy)
\n<!-- dummy change to test pr labels trigger -->
47 changes: 47 additions & 0 deletions scripts/pr-labels/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# PR Label Sync

This directory contains scripts and sample data for automatically classifying and labeling GitHub Pull Requests based on the files they modify.

## Files

- `index.js`: The main Node.js script. It fetches PR files, evaluates their risk level, calculates business impact, and uses GitHub APIs to add appropriate `size/*` and `area/*` labels.
- `samples.json`: A collection of historical PRs used as test cases to verify the labeling logic (especially for regression testing the S/M/L thresholds).

## Features

### Size Labels (`size/*`)
The script evaluates the "effective" lines of code changed (ignoring tests, docs, and ci files) to classify the PR:
- **`size/S`**: Low-risk changes involving only docs, tests, CI workflows, or chores.
- **`size/M`**: Small-to-medium changes affecting a single business domain, with effective lines under 300.
- **`size/L`**: Large features (>= 300 lines), cross-domain changes, or any changes touching core architecture paths (like `cmd/`).
- **`size/XL`**: Architectural overhauls, extremely large PRs (>1200 lines), or sensitive refactors.

### Area Tags (`area/*`)
The script also identifies which high-level architectural modules a PR touches to give reviewers an immediate sense of the impact scope. Currently tracked important areas include:
- `area/cmd`
- `area/shortcuts`
- `area/skills`

Minor modules like docs and tests are omitted to keep PR tags clean and focused on structural changes.

## Usage

### In GitHub Actions
This script is designed to run in CI workflows. It automatically reads the `GITHUB_EVENT_PATH` payload to get the PR context.

```bash
node scripts/pr-labels/index.js
```

### Local Dry Run
You can test the labeling logic against an existing GitHub PR without actually applying labels by using the `--dry-run` flag.

```bash
# Requires GITHUB_TOKEN environment variable or passing --token
node scripts/pr-labels/index.js --dry-run --repo larksuite/cli --pr-number 123
```

To see the raw JSON output for programmatic use:
```bash
node scripts/pr-labels/index.js --dry-run --repo larksuite/cli --pr-number 123 --json
```
Loading
Loading