diff --git a/.github/workflows/add-label.yml b/.github/workflows/add-label.yml new file mode 100644 index 0000000000..0f7f6e7942 --- /dev/null +++ b/.github/workflows/add-label.yml @@ -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 }} \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a9e3f959dd..dd3035c323 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 @@ -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 @@ -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() }} @@ -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 @@ -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 }} \ No newline at end of file + run: npm run build:taro:site \ No newline at end of file