chore: remove .github folder
Signed-off-by: Boos4721 <boos4721@icloud.com>
This commit is contained in:
@@ -1,162 +0,0 @@
|
||||
name: Bug Report / Bug 反馈
|
||||
description: Report a bug to help us improve / 报告 bug 帮助我们改进
|
||||
title: "[Bug]: "
|
||||
labels: ["bug"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thanks for taking the time to fill out this bug report. Even a brief description helps us understand what went wrong. If you can share the details below, it usually helps us reproduce the issue without asking you to repeat yourself.
|
||||
|
||||
感谢您愿意告诉我们这个问题。哪怕只是简要描述,也能帮助我们理解发生了什么。如果方便的话,补充下面这些信息,通常能帮助我们更快复现问题,也尽量减少反复向您确认。
|
||||
|
||||
- type: checkboxes
|
||||
id: pre-submission
|
||||
attributes:
|
||||
label: Pre-submission Checklist / 提交前检查清单
|
||||
description: Please confirm the following before submitting / 提交前请确认以下内容
|
||||
options:
|
||||
- label: I searched existing issues to avoid creating a duplicate / 我已检索现有 issue,确认这不是重复问题
|
||||
required: true
|
||||
- label: I tested on the latest release or current main branch / 我已在最新 release 或 main 分支版本中复现
|
||||
required: true
|
||||
|
||||
- type: dropdown
|
||||
id: deployment
|
||||
attributes:
|
||||
label: Deployment Type / 部署方式
|
||||
description: Where did you reproduce the problem? / 您是在什么运行方式下复现这个问题的?
|
||||
options:
|
||||
- Docker Compose / Docker Compose 部署
|
||||
- Docker run / Docker 命令部署
|
||||
- Desktop app / 桌面端
|
||||
- Local development / 本地源码开发
|
||||
- Zeabur deployment / Zeabur 部署
|
||||
- Render deployment / Render 部署
|
||||
- Other / 其他
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: dropdown
|
||||
id: problem-area
|
||||
attributes:
|
||||
label: Problem Area / 问题模块
|
||||
description: Which part of Metapi seems related? Optional, but helpful. / 您觉得问题和 Metapi 的哪个模块有关?选填,但有助于排查。
|
||||
options:
|
||||
- Site / Account Management / 站点与账号管理
|
||||
- Token Management / 令牌管理
|
||||
- Routing / 路由
|
||||
- Proxy API (/v1/*) / 代理接口
|
||||
- Model Marketplace / 模型广场
|
||||
- Check-in / 签到
|
||||
- Notifications / 通知
|
||||
- Desktop App / 桌面端
|
||||
- Deployment / Database / 部署或数据库
|
||||
- Other / 其他
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: textarea
|
||||
id: app-version
|
||||
attributes:
|
||||
label: Metapi Version / Metapi 版本
|
||||
description: Tell us the version, image tag, or commit if you know it. / 如果您知道,请填写版本号、镜像标签或 commit。
|
||||
placeholder: |
|
||||
e.g. v1.2.2 / latest / commit SHA
|
||||
例如 v1.2.2 / latest / commit SHA
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: dropdown
|
||||
id: database
|
||||
attributes:
|
||||
label: Database Type / 数据库类型
|
||||
description: Which runtime database are you using? / 您当前运行时使用的是哪种数据库?
|
||||
options:
|
||||
- SQLite
|
||||
- MySQL
|
||||
- PostgreSQL
|
||||
- Not sure / 不确定
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: textarea
|
||||
id: bug-description
|
||||
attributes:
|
||||
label: Bug Description / Bug 描述
|
||||
description: A clear and concise description of what the bug is / 清晰简洁地描述这个 bug 是什么
|
||||
placeholder: |
|
||||
Describe the problem you observed.
|
||||
请描述您实际遇到的问题。
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: steps-to-reproduce
|
||||
attributes:
|
||||
label: Steps To Reproduce / 复现步骤
|
||||
description: Steps to reproduce the behavior / 请尽量提供稳定复现的步骤
|
||||
placeholder: |
|
||||
1. Go to ... / 打开 ...
|
||||
2. Configure ... / 配置 ...
|
||||
3. Click or send request ... / 点击或发送请求 ...
|
||||
4. Observe the result ... / 观察结果 ...
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: expected-behavior
|
||||
attributes:
|
||||
label: Expected Behavior / 预期行为
|
||||
description: What did you expect to happen? / 您原本期望发生什么?
|
||||
placeholder: |
|
||||
Describe the expected behavior.
|
||||
请描述您期望的正确行为。
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: actual-behavior
|
||||
attributes:
|
||||
label: Actual Behavior / 实际行为
|
||||
description: What actually happened? / 实际发生了什么?
|
||||
placeholder: |
|
||||
Describe the actual result.
|
||||
请描述实际发生的结果。
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: logs
|
||||
attributes:
|
||||
label: Logs Or Error Output / 日志或错误输出
|
||||
description: Paste relevant logs, stack traces, request/response snippets, or screenshots of error output. / 请粘贴相关日志、报错堆栈、请求/响应片段,或错误输出截图。
|
||||
render: shell
|
||||
|
||||
- type: textarea
|
||||
id: screenshots
|
||||
attributes:
|
||||
label: Screenshots / 截图
|
||||
description: If applicable, add screenshots to help explain the problem. / 如果方便,请附上截图帮助说明问题。
|
||||
|
||||
- type: textarea
|
||||
id: environment
|
||||
attributes:
|
||||
label: Environment Details / 环境信息
|
||||
description: Include OS, host platform, reverse proxy, client tool, browser version if relevant, and anything else that might matter. / 请补充系统、宿主环境、反向代理、客户端工具,以及在相关时补充浏览器版本等信息。
|
||||
placeholder: |
|
||||
OS:
|
||||
Deployment:
|
||||
Host platform:
|
||||
Reverse proxy:
|
||||
Client tool:
|
||||
Metapi version:
|
||||
Database:
|
||||
|
||||
操作系统:
|
||||
部署方式:
|
||||
宿主环境:
|
||||
反向代理:
|
||||
客户端工具:
|
||||
Metapi 版本:
|
||||
数据库:
|
||||
@@ -1,5 +0,0 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: Metapi README
|
||||
url: https://github.com/cita-777/metapi#readme
|
||||
about: Start with the README for setup, usage, and deployment details.
|
||||
@@ -1,65 +0,0 @@
|
||||
name: Documentation Update / 文档反馈
|
||||
description: Report missing, incorrect, or unclear documentation / 反馈文档缺失、错误或不清晰的问题
|
||||
title: "[Docs]: "
|
||||
labels: ["docs"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Use this template when documentation is missing, incorrect, outdated, or hard to follow.
|
||||
|
||||
如果文档存在缺失、错误、过时或难以理解的问题,请使用这个模板。
|
||||
|
||||
- type: checkboxes
|
||||
id: checks
|
||||
attributes:
|
||||
label: Before submitting / 提交前确认
|
||||
options:
|
||||
- label: I searched existing issues to avoid creating a duplicate / 我已搜索现有 issue,确认这不是重复反馈
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
id: location
|
||||
attributes:
|
||||
label: Documentation Location / 文档位置
|
||||
description: Link the page or file that needs attention. / 请填写需要修改的页面、章节或文件路径。
|
||||
placeholder: e.g. README.md or docs/getting-started.md / 例如 README.md 或 docs/getting-started.md
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: dropdown
|
||||
id: doc-area
|
||||
attributes:
|
||||
label: Documentation Area / 文档类型
|
||||
description: Which documentation area is affected? / 受影响的是哪一类文档?
|
||||
options:
|
||||
- README / 项目首页说明
|
||||
- Getting Started / 快速开始
|
||||
- Deployment / 部署
|
||||
- Configuration / 配置
|
||||
- Client Integration / 客户端接入
|
||||
- FAQ / 常见问题
|
||||
- Operations / 运维
|
||||
- Other / 其他
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: textarea
|
||||
id: issue
|
||||
attributes:
|
||||
label: What Is Wrong Or Missing? / 哪里有问题或缺失?
|
||||
description: Describe the missing, inaccurate, outdated, or confusing part. / 请描述缺失、不准确、过时或不清晰的内容。
|
||||
placeholder: |
|
||||
Describe the missing, inaccurate, or confusing part.
|
||||
请说明哪一部分有问题,以及为什么会造成困惑。
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: fix
|
||||
attributes:
|
||||
label: Suggested Improvement / 建议修改方式
|
||||
description: Describe how the documentation could be improved. / 请描述您建议的修改方式或理想写法。
|
||||
placeholder: |
|
||||
Describe how the documentation could be improved.
|
||||
请尽量给出建议内容、结构或示例。
|
||||
@@ -1,78 +0,0 @@
|
||||
name: Feature Request / 功能请求
|
||||
description: Suggest a new feature or enhancement / 建议新功能或改进
|
||||
title: "[Feature]: "
|
||||
labels: ["enhancement"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thanks for taking the time to suggest a new feature. A focused request with enough context helps us evaluate the idea much faster.
|
||||
|
||||
感谢您提出功能建议。一个聚焦、信息完整的功能请求,通常能让我们更快判断需求价值和实现方向。
|
||||
|
||||
- type: checkboxes
|
||||
id: pre-submission
|
||||
attributes:
|
||||
label: Pre-submission Checklist / 提交前检查清单
|
||||
description: Please confirm the following before submitting / 提交前请确认以下内容
|
||||
options:
|
||||
- label: I searched existing issues to avoid creating a duplicate / 我已检索现有 issue,确认这不是重复需求
|
||||
required: true
|
||||
- label: I confirmed this feature is not already available in the latest release or main branch / 我已确认该功能尚未在最新 release 或 main 分支中提供
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: problem
|
||||
attributes:
|
||||
label: Problem Or Use Case / 使用场景或问题背景
|
||||
description: What problem are you trying to solve? What is inconvenient today? / 您想解决什么问题?当前使用上哪里不方便?
|
||||
placeholder: |
|
||||
Explain the workflow or pain point behind this request.
|
||||
请描述当前流程、痛点或为什么需要这个功能。
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: dropdown
|
||||
id: area
|
||||
attributes:
|
||||
label: Related Area / 相关模块
|
||||
description: Which part of Metapi is this feature mainly about? / 这个功能主要涉及 Metapi 的哪个模块?
|
||||
options:
|
||||
- Site / Account Management / 站点与账号管理
|
||||
- Token Management / 令牌管理
|
||||
- Routing / 路由
|
||||
- Proxy API (/v1/*) / 代理接口
|
||||
- Model Marketplace / 模型广场
|
||||
- Check-in / 签到
|
||||
- Notifications / 通知
|
||||
- Desktop App / 桌面端
|
||||
- Deployment / Database / 部署或数据库
|
||||
- Other / 其他
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: textarea
|
||||
id: proposal
|
||||
attributes:
|
||||
label: Proposed Solution / 建议的解决方案
|
||||
description: Describe the change you want to see. / 请描述您希望增加的功能或行为变化。
|
||||
placeholder: |
|
||||
Explain the feature or behavior you want added.
|
||||
请尽量具体描述您希望如何实现。
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: alternatives
|
||||
attributes:
|
||||
label: Alternatives Considered / 考虑过的替代方案
|
||||
description: Describe any workaround or alternative approach you considered. / 请描述您考虑过的替代方案、当前 workaround,或为什么现有方式不够好。
|
||||
|
||||
- type: textarea
|
||||
id: context
|
||||
attributes:
|
||||
label: Additional Context / 其他信息
|
||||
description: Add screenshots, examples, related issues, or links if they help explain the request. / 如果截图、示例、关联 issue 或参考链接有帮助,请补充在这里。
|
||||
placeholder: |
|
||||
You can include route examples, API paths, screenshots, upstream platform names, or migration concerns.
|
||||
可以补充路由示例、API 路径、截图、上游平台名称,或兼容性/迁移方面的考虑。
|
||||
@@ -1,72 +0,0 @@
|
||||
name: Question / 使用问题
|
||||
description: Ask for clarification or usage guidance / 询问使用方法、配置方式或行为解释
|
||||
title: "[Question]: "
|
||||
labels: ["question"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Use this template for support or clarification questions that are not bug reports or feature requests. The more context you share, the easier it is for us to give a direct answer.
|
||||
|
||||
如果这是使用方式、配置方法或行为解释相关的问题,请使用这个模板。您提供的上下文越完整,我们越容易直接给出准确答案。
|
||||
|
||||
- type: checkboxes
|
||||
id: checks
|
||||
attributes:
|
||||
label: Before submitting / 提交前确认
|
||||
options:
|
||||
- label: I searched existing issues and the README for an answer / 我已搜索现有 issue 和 README,但还没有找到答案
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: question
|
||||
attributes:
|
||||
label: Question / 问题描述
|
||||
description: What do you need help understanding? / 您具体想确认什么问题?
|
||||
placeholder: |
|
||||
Ask one clear question and include the relevant context.
|
||||
请尽量用一句话先说清楚您想问什么。
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: dropdown
|
||||
id: scenario
|
||||
attributes:
|
||||
label: Question Type / 问题类型
|
||||
description: What kind of question is this? / 这是哪一类使用问题?
|
||||
options:
|
||||
- Deployment / 部署
|
||||
- Configuration / 配置
|
||||
- Client Integration / 客户端接入
|
||||
- Routing / 路由
|
||||
- Site / Account / Token / 站点、账号或令牌
|
||||
- Desktop App / 桌面端
|
||||
- Proxy API (/v1/*) / 代理接口
|
||||
- Other / 其他
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: textarea
|
||||
id: tried
|
||||
attributes:
|
||||
label: What Have You Tried? / 您已经尝试过什么?
|
||||
description: Include commands, config, screenshots, or investigation you already attempted. / 请补充您已经尝试过的命令、配置、截图或排查过程。
|
||||
|
||||
- type: textarea
|
||||
id: environment
|
||||
attributes:
|
||||
label: Relevant Environment Or Config / 相关环境或配置
|
||||
description: Paste config snippets, request examples, deployment details, or environment information if needed. / 如有需要,请补充配置片段、请求示例、部署方式或环境信息。
|
||||
placeholder: |
|
||||
Deployment:
|
||||
Base URL:
|
||||
Client:
|
||||
Database:
|
||||
Related config:
|
||||
|
||||
部署方式:
|
||||
Base URL:
|
||||
客户端:
|
||||
数据库:
|
||||
相关配置:
|
||||
render: shell
|
||||
@@ -1,130 +0,0 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: npm
|
||||
directory: /
|
||||
schedule:
|
||||
interval: weekly
|
||||
day: monday
|
||||
time: "03:00"
|
||||
timezone: Asia/Shanghai
|
||||
open-pull-requests-limit: 6
|
||||
ignore:
|
||||
- dependency-name: "vite"
|
||||
update-types:
|
||||
- "version-update:semver-major"
|
||||
- dependency-name: "@vitejs/plugin-react"
|
||||
update-types:
|
||||
- "version-update:semver-major"
|
||||
- dependency-name: "vitest"
|
||||
update-types:
|
||||
- "version-update:semver-major"
|
||||
- dependency-name: "react-router-dom"
|
||||
update-types:
|
||||
- "version-update:semver-major"
|
||||
- dependency-name: "undici"
|
||||
update-types:
|
||||
- "version-update:semver-major"
|
||||
- dependency-name: "cross-env"
|
||||
update-types:
|
||||
- "version-update:semver-major"
|
||||
- dependency-name: "drizzle-orm"
|
||||
update-types:
|
||||
- "version-update:semver-major"
|
||||
- dependency-name: "drizzle-kit"
|
||||
update-types:
|
||||
- "version-update:semver-major"
|
||||
groups:
|
||||
drizzle-risk:
|
||||
patterns:
|
||||
- "drizzle-orm"
|
||||
- "drizzle-kit"
|
||||
update-types:
|
||||
- minor
|
||||
- patch
|
||||
build-tooling:
|
||||
patterns:
|
||||
- "vite"
|
||||
- "@vitejs/plugin-react"
|
||||
- "vitest"
|
||||
- "tsx"
|
||||
- "typescript"
|
||||
update-types:
|
||||
- minor
|
||||
- patch
|
||||
routing:
|
||||
patterns:
|
||||
- "react-router-dom"
|
||||
update-types:
|
||||
- minor
|
||||
- patch
|
||||
runtime-http:
|
||||
patterns:
|
||||
- "undici"
|
||||
update-types:
|
||||
- minor
|
||||
- patch
|
||||
node-runtime-sensitive:
|
||||
patterns:
|
||||
- "cross-env"
|
||||
update-types:
|
||||
- minor
|
||||
- patch
|
||||
minor-and-patch:
|
||||
patterns:
|
||||
- "*"
|
||||
exclude-patterns:
|
||||
- "drizzle-orm"
|
||||
- "drizzle-kit"
|
||||
- "vite"
|
||||
- "@vitejs/plugin-react"
|
||||
- "vitest"
|
||||
- "tsx"
|
||||
- "typescript"
|
||||
- "react-router-dom"
|
||||
- "undici"
|
||||
- "cross-env"
|
||||
update-types:
|
||||
- minor
|
||||
- patch
|
||||
dev-dependencies:
|
||||
dependency-type: development
|
||||
patterns:
|
||||
- "*"
|
||||
update-types:
|
||||
- minor
|
||||
- patch
|
||||
exclude-patterns:
|
||||
- "drizzle-kit"
|
||||
- "vite"
|
||||
- "@vitejs/plugin-react"
|
||||
- "vitest"
|
||||
- "tsx"
|
||||
- "typescript"
|
||||
- "react-router-dom"
|
||||
- "cross-env"
|
||||
|
||||
- package-ecosystem: github-actions
|
||||
directory: /
|
||||
schedule:
|
||||
interval: weekly
|
||||
day: monday
|
||||
time: "03:00"
|
||||
timezone: Asia/Shanghai
|
||||
open-pull-requests-limit: 5
|
||||
groups:
|
||||
github-actions:
|
||||
patterns:
|
||||
- "*"
|
||||
|
||||
- package-ecosystem: docker
|
||||
directory: /docker
|
||||
schedule:
|
||||
interval: weekly
|
||||
day: monday
|
||||
time: "03:00"
|
||||
timezone: Asia/Shanghai
|
||||
open-pull-requests-limit: 5
|
||||
groups:
|
||||
docker:
|
||||
patterns:
|
||||
- "*"
|
||||
@@ -1,45 +0,0 @@
|
||||
"area: db":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "src/server/db/**"
|
||||
- "drizzle/**"
|
||||
|
||||
"area: server":
|
||||
- all:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "src/server/**"
|
||||
- all-globs-to-all-files:
|
||||
- "!src/server/db/**"
|
||||
|
||||
"area: web":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "src/web/**"
|
||||
|
||||
"area: desktop":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "src/desktop/**"
|
||||
- "electron-builder.yml"
|
||||
- "tsconfig.desktop.json"
|
||||
|
||||
"area: docs":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "docs/**"
|
||||
- "README.md"
|
||||
- "README_EN.md"
|
||||
|
||||
"area: scripts":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "scripts/**"
|
||||
|
||||
"area: ci":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- ".github/**"
|
||||
- "docker/**"
|
||||
- "render.yaml"
|
||||
- "zeabur-template.yaml"
|
||||
@@ -1,176 +0,0 @@
|
||||
name: Backfill PR Labels
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
state:
|
||||
description: Pull request state to scan
|
||||
required: true
|
||||
default: all
|
||||
type: choice
|
||||
options:
|
||||
- open
|
||||
- closed
|
||||
- all
|
||||
limit:
|
||||
description: Maximum number of pull requests to inspect
|
||||
required: true
|
||||
default: "100"
|
||||
type: string
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
backfill:
|
||||
name: Backfill missing PR labels
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Backfill PR labels
|
||||
uses: actions/github-script@v8
|
||||
with:
|
||||
script: |
|
||||
const owner = context.repo.owner;
|
||||
const repo = context.repo.repo;
|
||||
const inputs = context.payload.inputs || {};
|
||||
const requestedState = inputs.state || 'all';
|
||||
const limit = Number.parseInt(inputs.limit || '100', 10);
|
||||
const sizeLabels = ['size: XS', 'size: S', 'size: M', 'size: L', 'size: XL', 'size: XXL'];
|
||||
const areaRules = [
|
||||
{ label: 'area: db', include: ['src/server/db/', 'drizzle/'] },
|
||||
{ label: 'area: server', include: ['src/server/'], exclude: ['src/server/db/'] },
|
||||
{ label: 'area: web', include: ['src/web/'] },
|
||||
{ label: 'area: desktop', include: ['src/desktop/', 'electron-builder.yml', 'tsconfig.desktop.json'] },
|
||||
{ label: 'area: docs', include: ['docs/', 'README.md', 'README_EN.md'] },
|
||||
{ label: 'area: scripts', include: ['scripts/'] },
|
||||
{ label: 'area: ci', include: ['.github/', 'docker/', 'render.yaml', 'zeabur-template.yaml'] },
|
||||
];
|
||||
|
||||
if (!Number.isFinite(limit) || limit <= 0) {
|
||||
core.setFailed('The limit input must be a positive integer.');
|
||||
return;
|
||||
}
|
||||
|
||||
function matchesRule(filename, rule) {
|
||||
const included = rule.include.some((prefix) => filename === prefix || filename.startsWith(prefix));
|
||||
if (!included) return false;
|
||||
if (!rule.exclude) return true;
|
||||
return !rule.exclude.some((prefix) => filename === prefix || filename.startsWith(prefix));
|
||||
}
|
||||
|
||||
function computeAreaLabels(files) {
|
||||
return areaRules
|
||||
.filter((rule) => files.some((file) => matchesRule(file.filename, rule)))
|
||||
.map((rule) => rule.label);
|
||||
}
|
||||
|
||||
function computeSizeLabel(totalChanges) {
|
||||
if (totalChanges < 50) return 'size: XS';
|
||||
if (totalChanges < 200) return 'size: S';
|
||||
if (totalChanges < 500) return 'size: M';
|
||||
if (totalChanges < 1000) return 'size: L';
|
||||
if (totalChanges < 2000) return 'size: XL';
|
||||
return 'size: XXL';
|
||||
}
|
||||
|
||||
const state = requestedState === 'all' ? 'all' : requestedState;
|
||||
const pulls = await github.paginate(github.rest.pulls.list, {
|
||||
owner,
|
||||
repo,
|
||||
state,
|
||||
per_page: 100,
|
||||
});
|
||||
|
||||
let inspected = 0;
|
||||
let updated = 0;
|
||||
let skipped = 0;
|
||||
let warned = 0;
|
||||
|
||||
for (const pull of pulls) {
|
||||
if (inspected >= limit) {
|
||||
break;
|
||||
}
|
||||
|
||||
inspected += 1;
|
||||
|
||||
const { data: fullPull } = await github.rest.pulls.get({
|
||||
owner,
|
||||
repo,
|
||||
pull_number: pull.number,
|
||||
});
|
||||
|
||||
const files = await github.paginate(github.rest.pulls.listFiles, {
|
||||
owner,
|
||||
repo,
|
||||
pull_number: pull.number,
|
||||
per_page: 100,
|
||||
});
|
||||
|
||||
const desiredAreaLabels = computeAreaLabels(files);
|
||||
const totalChanges = fullPull.additions + fullPull.deletions;
|
||||
const hasValidSizeData = Number.isFinite(totalChanges) && totalChanges >= 0;
|
||||
const currentLabels = pull.labels.map((label) => label.name);
|
||||
const missingAreaLabels = desiredAreaLabels.filter((label) => !currentLabels.includes(label));
|
||||
const currentSizeLabels = currentLabels.filter((label) => sizeLabels.includes(label));
|
||||
const desiredSizeLabel = hasValidSizeData ? computeSizeLabel(totalChanges) : null;
|
||||
const sizeMatches =
|
||||
hasValidSizeData &&
|
||||
currentSizeLabels.length === 1 &&
|
||||
currentSizeLabels[0] === desiredSizeLabel;
|
||||
|
||||
if (!hasValidSizeData) {
|
||||
warned += 1;
|
||||
core.warning(`Skipping size label for PR #${pull.number}: invalid additions/deletions values.`);
|
||||
}
|
||||
|
||||
if (missingAreaLabels.length === 0 && (hasValidSizeData ? sizeMatches : currentSizeLabels.length === 0)) {
|
||||
skipped += 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (hasValidSizeData) {
|
||||
for (const label of currentSizeLabels) {
|
||||
if (label === desiredSizeLabel) {
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
await github.rest.issues.removeLabel({
|
||||
owner,
|
||||
repo,
|
||||
issue_number: pull.number,
|
||||
name: label,
|
||||
});
|
||||
} catch (error) {
|
||||
if (error.status !== 404) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const labelsToAdd = [...missingAreaLabels];
|
||||
if (hasValidSizeData && !sizeMatches) {
|
||||
labelsToAdd.push(desiredSizeLabel);
|
||||
}
|
||||
|
||||
if (labelsToAdd.length > 0) {
|
||||
await github.rest.issues.addLabels({
|
||||
owner,
|
||||
repo,
|
||||
issue_number: pull.number,
|
||||
labels: labelsToAdd,
|
||||
});
|
||||
}
|
||||
|
||||
updated += 1;
|
||||
}
|
||||
|
||||
core.summary
|
||||
.addHeading('Backfill summary')
|
||||
.addRaw(`Inspected PRs: ${inspected}\n`)
|
||||
.addRaw(`Updated PRs: ${updated}\n`)
|
||||
.addRaw(`Skipped PRs: ${skipped}\n`)
|
||||
.addRaw(`Warnings: ${warned}\n`)
|
||||
.write();
|
||||
@@ -1,44 +0,0 @@
|
||||
name: Harness Drift Report
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '37 17 * * 1'
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
env:
|
||||
NODE_VERSION: 25
|
||||
|
||||
jobs:
|
||||
drift-report:
|
||||
name: Generate Drift Report
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
cache: npm
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci --prefer-offline --no-audit --no-fund
|
||||
|
||||
- name: Generate repo drift report
|
||||
run: npm run repo:drift-check -- --format markdown --output tmp/repo-drift-report.md --report-only
|
||||
|
||||
- name: Publish report to step summary
|
||||
run: cat tmp/repo-drift-report.md >> "$GITHUB_STEP_SUMMARY"
|
||||
|
||||
- name: Upload report artifact
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: repo-drift-report
|
||||
path: tmp/repo-drift-report.md
|
||||
retention-days: 30
|
||||
@@ -1,71 +0,0 @@
|
||||
name: Label Pull Requests
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [opened, synchronize, reopened, ready_for_review]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
apply-labels:
|
||||
name: Apply area and size labels
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Apply area labels
|
||||
uses: actions/labeler@v6
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
sync-labels: false
|
||||
|
||||
- name: Apply size label
|
||||
uses: actions/github-script@v8
|
||||
with:
|
||||
script: |
|
||||
const owner = context.repo.owner;
|
||||
const repo = context.repo.repo;
|
||||
const pull_number = context.payload.pull_request.number;
|
||||
const sizeLabels = ['size: XS', 'size: S', 'size: M', 'size: L', 'size: XL', 'size: XXL'];
|
||||
|
||||
const { data: pull } = await github.rest.pulls.get({
|
||||
owner,
|
||||
repo,
|
||||
pull_number,
|
||||
});
|
||||
|
||||
const totalChanges = pull.additions + pull.deletions;
|
||||
let nextSize = 'size: XXL';
|
||||
if (totalChanges < 50) nextSize = 'size: XS';
|
||||
else if (totalChanges < 200) nextSize = 'size: S';
|
||||
else if (totalChanges < 500) nextSize = 'size: M';
|
||||
else if (totalChanges < 1000) nextSize = 'size: L';
|
||||
else if (totalChanges < 2000) nextSize = 'size: XL';
|
||||
|
||||
const currentLabels = pull.labels.map((label) => label.name);
|
||||
const existingSizeLabels = currentLabels.filter((label) => sizeLabels.includes(label));
|
||||
const labelsToRemove = existingSizeLabels.filter((label) => label !== nextSize);
|
||||
|
||||
for (const label of labelsToRemove) {
|
||||
try {
|
||||
await github.rest.issues.removeLabel({
|
||||
owner,
|
||||
repo,
|
||||
issue_number: pull_number,
|
||||
name: label,
|
||||
});
|
||||
} catch (error) {
|
||||
if (error.status !== 404) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!currentLabels.includes(nextSize)) {
|
||||
await github.rest.issues.addLabels({
|
||||
owner,
|
||||
repo,
|
||||
issue_number: pull_number,
|
||||
labels: [nextSize],
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user