From 3260d45f4e543e44f3be59b02427cbd9c334915b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E7=86=B1?= Date: Sat, 25 Jul 2026 11:25:07 +0800 Subject: [PATCH] ci: remove useless workflows --- .github/workflows/deploy-github-pages.yml | 119 ---------- .github/workflows/deploy-pr-preview.yml | 222 ------------------ .../workflows/dispatch-sync-univer-pro.yml | 2 +- .github/workflows/security-semgrep.yml | 14 +- 4 files changed, 3 insertions(+), 354 deletions(-) delete mode 100644 .github/workflows/deploy-github-pages.yml delete mode 100644 .github/workflows/deploy-pr-preview.yml diff --git a/.github/workflows/deploy-github-pages.yml b/.github/workflows/deploy-github-pages.yml deleted file mode 100644 index 11a1e72346..0000000000 --- a/.github/workflows/deploy-github-pages.yml +++ /dev/null @@ -1,119 +0,0 @@ -name: ๐ŸŒ Deploy to GitHub Pages - -on: - push: - branches: - - dev - tags: - - 'v*.*.*' - - 'v*.*.*-alpha.*' - - 'v*.*.*-beta.*' - - 'v*.*.*-rc.*' - -concurrency: - group: github-pages - cancel-in-progress: false - -permissions: - contents: write - pull-requests: read - -jobs: - deploy: - if: github.repository == 'dream-num/univer' - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v7 - with: - persist-credentials: false - - - name: Setup Node.js - uses: ./.github/actions/setup-node - - # ================= Deploy Demo ================= - - name: ๐Ÿ“ฆ Build demo - run: pnpm build:demo - - - name: Copy demo to workspace - run: | - mkdir -p dist - cp -r ./examples/local/* dist - - - name: ๐Ÿ“ฆ Build react16 demo - run: | - pnpm use:react16 - pnpm build:demo - - - name: Copy react16 demo - run: | - mkdir -p dist/react16 - cp -r ./examples/local/* dist/react16 - - # ================= Deploy Storybook ================= - - name: ๐Ÿ“ฆ Build storybook - run: pnpm storybook:build - - - name: Copy storybook - run: | - mkdir -p dist/storybook - cp -r ./common/storybook/storybook-static/* dist/storybook - - - name: Checkout existing Pages branch - uses: actions/checkout@v7 - continue-on-error: true - with: - ref: gh-pages - path: gh-pages-current - persist-credentials: false - - - name: Preserve recent PR previews - env: - GH_TOKEN: ${{ github.token }} - run: | - if [ ! -d gh-pages-current/pr-preview ]; then - exit 0 - fi - - mkdir -p dist/pr-preview - cutoff_epoch=$(date -u -d '30 days ago' +%s) - shopt -s nullglob - - for preview_dir in gh-pages-current/pr-preview/pr-*; do - pr_number="${preview_dir##*/pr-}" - if [[ ! "$pr_number" =~ ^[0-9]+$ ]]; then - echo "Prune unexpected preview directory: ${preview_dir}" - continue - fi - - if ! pr_info=$(gh api "repos/${GITHUB_REPOSITORY}/pulls/${pr_number}" --jq '[.state, (.closed_at // "")] | @tsv' 2>/dev/null); then - echo "Prune preview for missing PR #${pr_number}" - continue - fi - - IFS=$'\t' read -r state closed_at <<< "$pr_info" - if [ "$state" = "open" ]; then - echo "Keep preview for open PR #${pr_number}" - cp -a "$preview_dir" "dist/pr-preview/" - continue - fi - - if [ -n "$closed_at" ]; then - closed_epoch=$(date -u -d "$closed_at" +%s) - if [ "$closed_epoch" -ge "$cutoff_epoch" ]; then - echo "Keep preview for recently closed PR #${pr_number}" - cp -a "$preview_dir" "dist/pr-preview/" - continue - fi - fi - - echo "Prune preview for PR #${pr_number}" - done - - # ================= Deploy to GitHub Pages ================= - - name: ๐Ÿš€ Deploy to GitHub Pages - uses: peaceiris/actions-gh-pages@v4 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./dist diff --git a/.github/workflows/deploy-pr-preview.yml b/.github/workflows/deploy-pr-preview.yml deleted file mode 100644 index a82a2c5f34..0000000000 --- a/.github/workflows/deploy-pr-preview.yml +++ /dev/null @@ -1,222 +0,0 @@ -name: ๐Ÿ“ค Preview Deploy - -on: - workflow_run: - workflows: - - ๐ŸŽฌ Setup - types: - - completed - -concurrency: - group: ${{ github.workflow }}-${{ github.event.workflow_run.head_branch || github.ref }} - cancel-in-progress: true - -permissions: - contents: write - pull-requests: write - actions: read - -env: - TURBO_TELEMETRY_DISABLED: '1' - -jobs: - setup: - if: ${{ github.repository == 'dream-num/univer' && github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_repository.full_name == github.repository }} - runs-on: ubuntu-latest - - outputs: - id: ${{ steps.pr.outputs.value }} - ref: ${{ steps.ref.outputs.value }} - repo: ${{ steps.repo.outputs.value }} - state: ${{ steps.state.outputs.value }} - - steps: - # Get PR id from artifact - - name: download pr artifact - uses: dawidd6/action-download-artifact@v21 - with: - workflow: ${{ github.event.workflow_run.workflow_id }} - run_id: ${{ github.event.workflow_run.id }} - name: pr-id - - - name: get PR id - id: pr - run: echo "value=$(> $GITHUB_OUTPUT - - # Get PR ref from artifact - - name: download pr artifact - uses: dawidd6/action-download-artifact@v21 - with: - workflow: ${{ github.event.workflow_run.workflow_id }} - run_id: ${{ github.event.workflow_run.id }} - name: pr-ref - - - name: get PR ref - id: ref - run: echo "value=$(> $GITHUB_OUTPUT - - # Get PR repo from artifact - - name: download pr artifact - uses: dawidd6/action-download-artifact@v21 - with: - workflow: ${{ github.event.workflow_run.workflow_id }} - run_id: ${{ github.event.workflow_run.id }} - name: pr-repo - - - name: get PR repo - id: repo - run: echo "value=$(> $GITHUB_OUTPUT - - # Get PR state from artifact - - name: download pr state artifact - uses: dawidd6/action-download-artifact@v21 - with: - workflow: ${{ github.event.workflow_run.workflow_id }} - run_id: ${{ github.event.workflow_run.id }} - name: pr-state - - - name: get PR state - id: state - run: echo "value=$(> $GITHUB_OUTPUT - - prepare: - runs-on: ubuntu-latest - needs: [setup] - if: ${{ github.repository == 'dream-num/univer' && needs.setup.outputs.id != '' && needs.setup.outputs.state != 'closed' }} - - steps: - # ================= Create Comment ================= - - name: ๐Ÿงฝ Find And Delete Comment - uses: peter-evans/find-comment@v4 - if: ${{ needs.setup.outputs.id != '' }} - id: fc - with: - issue-number: ${{ needs.setup.outputs.id }} - comment-author: 'github-actions[bot]' - body-includes: View Deployment - - - name: ๐Ÿ“ Create or update comment - uses: peter-evans/create-or-update-comment@v5 - if: ${{ needs.setup.outputs.id != '' }} - with: - comment-id: ${{ steps.fc.outputs.comment-id }} - issue-number: ${{ needs.setup.outputs.id }} - body: | - ## View Deployment - - ```txt - status : provisioning preview - target : pr-${{ needs.setup.outputs.id }} - ref : ${{ needs.setup.outputs.ref }} - run : #${{ github.run_id }} - ``` - - Preview assets are building. This comment will update with deployment links when the preview is ready. - - [Open workflow run](https://github.com/dream-num/univer/actions/runs/${{ github.run_id }}) - edit-mode: replace - - build-and-deploy: - runs-on: ubuntu-latest - needs: [setup] - if: ${{ github.repository == 'dream-num/univer' && needs.setup.outputs.id != '' }} - - steps: - - name: Checkout - uses: actions/checkout@v7 - with: - repository: ${{ needs.setup.outputs.repo }} - ref: ${{ needs.setup.outputs.ref }} - persist-credentials: false - - - name: Setup pnpm - uses: pnpm/action-setup@v6 - with: - run_install: false - - - name: Setup Node.js - uses: actions/setup-node@v6 - with: - node-version: 24.3.0 - cache: pnpm - - - name: Install dependencies - run: pnpm install - - - name: Get commit message - id: commit-message - run: echo "value=$(git log -1 --pretty=%s)" >> $GITHUB_OUTPUT - - - name: Prepare dist directory - run: mkdir -p dist - - # ================= Deploy Demo ================= - - name: ๐Ÿ“ฆ Build demo - if: ${{ needs.setup.outputs.state != 'closed' }} - run: pnpm build:demo - - - name: Copy demo to workspace - if: ${{ needs.setup.outputs.state != 'closed' }} - run: cp -r ./examples/local/* dist - - - name: ๐Ÿ“ฆ Build react16 demo - if: ${{ needs.setup.outputs.state != 'closed' }} - run: | - pnpm use:react16 - pnpm build:demo - - - name: Copy react16 demo - if: ${{ needs.setup.outputs.state != 'closed' }} - run: | - mkdir -p dist/react16 - cp -r ./examples/local/* dist/react16 - - # ================= Deploy Storybook ================= - - name: ๐Ÿ“ฆ Build storybook - if: ${{ needs.setup.outputs.state != 'closed' }} - run: pnpm storybook:build - - - name: Copy storybook - if: ${{ needs.setup.outputs.state != 'closed' }} - run: | - mkdir -p dist/storybook - cp -r ./common/storybook/storybook-static/* dist/storybook - - # ================= Deploy PR Preview ================= - - name: ๐Ÿš€ Deploy to GitHub Pages (preview) - id: preview_deploy - uses: rossjrw/pr-preview-action@v1 - with: - source-dir: ./dist - preview-branch: gh-pages - umbrella-dir: pr-preview - pr-number: ${{ needs.setup.outputs.id }} - comment: false - action: ${{ needs.setup.outputs.state == 'closed' && 'remove' || 'deploy' }} - - - name: ๐Ÿงฝ Find deployment comment - uses: peter-evans/find-comment@v4 - if: ${{ needs.setup.outputs.state != 'closed' && steps.preview_deploy.outputs['deployment-action'] == 'deploy' }} - id: preview-comment - with: - issue-number: ${{ needs.setup.outputs.id }} - comment-author: 'github-actions[bot]' - body-includes: View Deployment - - - name: ๐Ÿ“ Update deployment comment - uses: peter-evans/create-or-update-comment@v5 - if: ${{ needs.setup.outputs.state != 'closed' && steps.preview_deploy.outputs['deployment-action'] == 'deploy' }} - with: - comment-id: ${{ steps.preview-comment.outputs.comment-id }} - issue-number: ${{ needs.setup.outputs.id }} - body: | - ## View Deployment - - [Preview](${{ steps.preview_deploy.outputs['preview-url'] }}) ยท [#${{ github.run_id }}](https://github.com/dream-num/univer/actions/runs/${{ github.run_id }}) - - | Entry | Link | - | --- | --- | - | Demo | ${{ steps.preview_deploy.outputs['preview-url'] }} | - | React 16 Demo | ${{ steps.preview_deploy.outputs['preview-url'] }}react16/ | - | Storybook | ${{ steps.preview_deploy.outputs['preview-url'] }}storybook/ | - edit-mode: replace diff --git a/.github/workflows/dispatch-sync-univer-pro.yml b/.github/workflows/dispatch-sync-univer-pro.yml index 0ac08c6ab1..d52e5cfc34 100644 --- a/.github/workflows/dispatch-sync-univer-pro.yml +++ b/.github/workflows/dispatch-sync-univer-pro.yml @@ -8,7 +8,7 @@ on: jobs: dispatch-sync: if: github.repository == 'dream-num/univer' - runs-on: ubuntu-latest + runs-on: minimum-runner steps: - name: Dispatch sync event to univer-pro diff --git a/.github/workflows/security-semgrep.yml b/.github/workflows/security-semgrep.yml index 2b24a1fb57..0b042e3185 100644 --- a/.github/workflows/security-semgrep.yml +++ b/.github/workflows/security-semgrep.yml @@ -4,16 +4,6 @@ on: push: branches: - main - - dev - pull_request: - branches: - - main - - dev - types: - - opened - - synchronize - - reopened - - ready_for_review workflow_dispatch: concurrency: @@ -27,7 +17,7 @@ permissions: jobs: semgrep: - if: github.repository == 'dream-num/univer' && (github.event_name != 'pull_request' || !github.event.pull_request.draft) + if: github.repository == 'dream-num/univer' runs-on: ubuntu-latest timeout-minutes: 20 @@ -104,7 +94,7 @@ jobs: - name: Upload Semgrep SARIF to GitHub id: upload-sarif - if: ${{ always() && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }} + if: ${{ always() }} continue-on-error: true uses: github/codeql-action/upload-sarif@v4 with: