Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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/add-label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Add Label

on:
pull_request_target:
types: [opened, synchronize, reopened]
workflow_dispatch:

jobs:
add-label:
runs-on: ubuntu-latest

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Determine label based on target branch
id: determine-label
run: |
echo "${{github.event_name}}"
if [[ "${{ github.event.pull_request.base.ref }}" == "next" ]]; then
echo "label=2.x" >> $GITHUB_ENV
elif [[ "${{ github.event.pull_request.base.ref }}" == "V3.0" ]]; then
echo "label=3.x" >> $GITHUB_ENV
else
echo "label=" >> $GITHUB_ENV
fi

- name: Add label to Pull Request
if: env.label != ''
uses: actions-ecosystem/action-add-labels@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
labels: ${{ env.label }}
43 changes: 6 additions & 37 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@ on:
- V3.0
pull_request:
types: [opened, synchronize, reopened]
pull_request_target:
types: [opened, synchronize, reopened]
workflow_dispatch:

jobs:
lint:
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -30,10 +27,9 @@ jobs:
run: pnpm install

- name: Run linter
run: pnpm lint
run: npm run lint

test:
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -50,7 +46,7 @@ jobs:
run: pnpm install

- name: Run test
run: pnpm test
run: npm run test

- name: Upload coverage reports to Codecov
if: ${{ always() }}
Expand All @@ -59,7 +55,6 @@ jobs:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

build:
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -76,40 +71,14 @@ jobs:
run: pnpm install

- name: Build NutUI-React
run: pnpm build
run: npm run build

- name: Build NutUI-React-Taro
run: pnpm build:taro
run: npm run build:taro

- name: Build NutUI-React Demo
run: pnpm build:site
run: npm run build:site

- name: Build NutUI-React Taro H5 Demo
if: github.ref == 'refs/heads/next'
run: pnpm build:taro:site
add-label:
if: ${{ github.event_name == 'pull_request_target' }}
runs-on: ubuntu-latest

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Determine label based on target branch
id: determine-label
run: |
echo "${{github.event_name}}"
if [[ "${{ github.event.pull_request.base.ref }}" == "next" ]]; then
echo "label=2.x" >> $GITHUB_ENV
elif [[ "${{ github.event.pull_request.base.ref }}" == "V3.0" ]]; then
echo "label=3.x" >> $GITHUB_ENV
else
echo "label=" >> $GITHUB_ENV
fi

- name: Add label to Pull Request
if: env.label != ''
uses: actions-ecosystem/action-add-labels@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
labels: ${{ env.label }}
run: npm run build:taro:site