-
Notifications
You must be signed in to change notification settings - Fork 272
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feat_v3.x' into refactor_input
- Loading branch information
Showing
228 changed files
with
4,187 additions
and
1,172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,80 @@ | ||
name: PR Review Labels | ||
|
||
on: | ||
schedule: | ||
- cron: '0 */3 * * *' | ||
|
||
pull_request_target: | ||
types: [opened, reopened, synchronize, ready_for_review] | ||
pull_request_review: | ||
types: [submitted, edited, dismissed] | ||
types: | ||
- opened | ||
- reopened | ||
- synchronize | ||
|
||
permissions: | ||
contents: read | ||
pull-requests: write | ||
issues: write | ||
|
||
jobs: | ||
update-labels: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Update PR labels based on reviews | ||
- name: Update PR labels | ||
uses: actions/github-script@v6 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
const { owner, repo } = context.repo; | ||
const pr_number = context.payload.pull_request.number; | ||
try { | ||
const { owner, repo } = context.repo; | ||
// 获取 PR 的所有 reviews | ||
const reviews = await github.rest.pulls.listReviews({ | ||
owner, | ||
repo, | ||
pull_number: pr_number | ||
}); | ||
// 获取所有开放的 PRs | ||
const { data: prs } = await github.rest.pulls.list({ | ||
owner, | ||
repo, | ||
state: 'open' | ||
}); | ||
// 计算 approved 的数量 | ||
const approvedCount = reviews.data.filter( | ||
review => review.state === 'APPROVED' | ||
).length; | ||
for (const pr of prs) { | ||
// 获取 PR 的所有 reviews | ||
const { data: reviews } = await github.rest.pulls.listReviews({ | ||
owner, | ||
repo, | ||
pull_number: pr.number | ||
}); | ||
// 获取当前 PR 的标签 | ||
const { data: currentLabels } = await github.rest.issues.listLabelsOnIssue({ | ||
owner, | ||
repo, | ||
issue_number: pr_number | ||
}); | ||
// 计算最新的 approved 数量 | ||
const latestReviews = new Map(); | ||
reviews.forEach(review => { | ||
latestReviews.set(review.user.id, review); | ||
}); | ||
// 移除已有的 action 标签 | ||
const labelsToRemove = currentLabels | ||
.filter(label => label.name === 'action:merge' || label.name === 'action:review') | ||
.map(label => label.name); | ||
const approvedCount = Array.from(latestReviews.values()) | ||
.filter(review => review.state === 'APPROVED') | ||
.length; | ||
for (const label of labelsToRemove) { | ||
await github.rest.issues.removeLabel({ | ||
owner, | ||
repo, | ||
issue_number: pr_number, | ||
name: label | ||
}); | ||
} | ||
console.log(`PR #${pr.number} - Approved count:`, approvedCount); | ||
// 获取当前标签 | ||
const { data: currentLabels } = await github.rest.issues.listLabelsOnIssue({ | ||
owner, | ||
repo, | ||
issue_number: pr.number | ||
}); | ||
// 根据 approved 数量添加对应标签 | ||
const newLabel = approvedCount >= 2 ? 'action:merge' : 'action:review'; | ||
await github.rest.issues.addLabels({ | ||
owner, | ||
repo, | ||
issue_number: pr_number, | ||
labels: [newLabel] | ||
}); | ||
// 保留非 action 标签 | ||
const labelsToKeep = currentLabels | ||
.filter(label => label.name !== 'action:merge' && label.name !== 'action:review') | ||
.map(label => label.name); | ||
// 添加新标签 | ||
const newLabel = approvedCount >= 2 ? 'action:merge' : 'action:review'; | ||
await github.rest.issues.setLabels({ | ||
owner, | ||
repo, | ||
issue_number: pr.number, | ||
labels: [...labelsToKeep, newLabel] | ||
}); | ||
} | ||
} catch (error) { | ||
console.error('Error:', error); | ||
throw error; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: Release 3x Beta | ||
|
||
on: | ||
# pull_request: | ||
push: | ||
branches: | ||
- feat_v3.x | ||
workflow_dispatch: | ||
|
||
jobs: | ||
release-3x-beta: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
id-token: write | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
# ref: ${{ github.event.pull_request.head.sha }} | ||
|
||
- name: Get commit message | ||
run: | | ||
COMMIT_MESSAGE=$(git log --format=%s -n 1) | ||
FILTERED_MESSAGE="${COMMIT_MESSAGE//[^a-zA-Z0-9.()_:, -]/}" | ||
echo "COMMIT_MESSAGE=${FILTERED_MESSAGE}" >> $GITHUB_ENV | ||
- name: Show commit message | ||
run: echo "$COMMIT_MESSAGE" | ||
|
||
- name: Commit message compliance verification | ||
if: | | ||
!startsWith( env.COMMIT_MESSAGE , 'chore(release):' ) || | ||
!contains( env.COMMIT_MESSAGE , '-beta' ) | ||
run: echo "ABORT=true" >> $GITHUB_ENV | ||
|
||
- name: Get Tag message | ||
if: contains( env.COMMIT_MESSAGE , '-beta') | ||
run: echo "RELEASE_TAG=beta" >> $GITHUB_ENV | ||
# | ||
- name: Install pnpm | ||
run: npm i -g pnpm@10 | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
registry-url: 'https://registry.npmjs.org' | ||
node-version: '20' | ||
cache: 'pnpm' | ||
|
||
- name: Install dependencies | ||
if: env.ABORT != 'true' | ||
run: pnpm install --frozen-lockfile | ||
|
||
- name: Run Build | ||
if: env.ABORT != 'true' | ||
run: | | ||
if ! pnpm build; then | ||
echo "构建 nutui-react 失败" | ||
exit 1 | ||
fi | ||
if ! pnpm build:taro; then | ||
echo "构建 nutui-react-taro 失败" | ||
exit 1 | ||
fi | ||
- name: Run Release @nutui/nutui-react | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
if: env.ABORT != 'true' | ||
run: pnpm --dir ./release/h5 publish:beta | ||
|
||
- name: Run Releases @nutui/nutui-react-taro | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
if: env.ABORT != 'true' | ||
run: pnpm --dir ./release/taro publish:beta |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: Release 3.x | ||
|
||
on: | ||
push: | ||
tags: | ||
- v3.* | ||
workflow_dispatch: | ||
|
||
jobs: | ||
release-3x: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
id-token: write | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Install pnpm | ||
run: npm i -g pnpm@10 | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
registry-url: 'https://registry.npmjs.org' | ||
node-version: '20' | ||
cache: 'pnpm' | ||
|
||
- name: Install dependencies | ||
run: pnpm install --frozen-lockfile | ||
|
||
- name: Run Build | ||
if: env.ABORT != 'true' | ||
run: | | ||
if ! pnpm build; then | ||
echo "构建 nutui-react 失败" | ||
exit 1 | ||
fi | ||
if ! pnpm build:taro; then | ||
echo "构建 nutui-react-taro 失败" | ||
exit 1 | ||
fi | ||
- name: Run Release @nutui/nutui-react | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
if: env.ABORT != 'true' | ||
run: pnpm --dir ./release/h5 publish | ||
|
||
- name: Run Releases @nutui/nutui-react-taro | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
if: env.ABORT != 'true' | ||
run: pnpm --dir ./release/taro publish |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ node_modules | |
.npmrc | ||
/dist | ||
/dist-demo | ||
/release | ||
/libs | ||
/jd/upload.js | ||
# yarn.lock | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.