Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

ci: fix the problem of failed ci preview (#507)

白熱05a04cb24447
diff --git a/.github/workflows/preview-build.yml b/.github/workflows/preview-build.yml
index d02fe1289b..ddb064e7ef 100644
--- a/.github/workflows/preview-build.yml
+++ b/.github/workflows/preview-build.yml
@@ -42,9 +42,9 @@ jobs:
uses: actions/cache@v3
with:
path: ${{ env.STORE_PATH }}
- key: ${{ runner.os }}-demo-${{ hashFiles('**/pnpm-lock.yaml') }}
+ key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
- ${{ runner.os }}-demo-
+ ${{ runner.os }}-pnpm-
- name: Install dependencies
run: pnpm install
@@ -57,18 +57,18 @@ jobs:
- name: Copy demo to workspace
run: |
- mkdir .workspace
- cp -r ./examples/univer-doc-ts/local .workspace/doc
- cp -r ./examples/univer-sheet-ts/local .workspace/sheet
- cp -r ./examples/univer-slide-ts/local .workspace/slide
+ mkdir .workspace
+ cp -r ./examples/univer-doc-ts/local .workspace/doc
+ cp -r ./examples/univer-sheet-ts/local .workspace/sheet
+ cp -r ./examples/univer-slide-ts/local .workspace/slide
- name: Setup demo cache
uses: actions/cache@v3
with:
- path: .workspace
- key: ${{ runner.os }}-demo-${{ github.event.pull_request.number }}
- restore-keys: |
- ${{ runner.os }}-demo-
+ path: .workspace
+ key: ${{ runner.os }}-demo-${{ github.event.pull_request.number }}
+ restore-keys: |
+ ${{ runner.os }}-demo-
set-pr-id:
name: Set PR ID
@@ -76,7 +76,9 @@ jobs:
steps:
- name: Save PR number
if: ${{ always() }}
- run: echo ${{ github.event.pull_request.number }} > ./pr-id.txt
+ run: |
+ echo ${{ github.event.pull_request.number }} > ./pr-id.txt
+ echo ${{ github.event.ref }} > ./pr-branch-name.txt
- name: Upload PR number
if: ${{ always() }}
@@ -84,3 +86,10 @@ jobs:
with:
name: pr
path: ./pr-id.txt
+
+ - name: Upload PR branch name
+ if: ${{ always() }}
+ uses: actions/upload-artifact@v3
+ with:
+ name: pr
+ path: ./pr-branch-name.txt
diff --git a/.github/workflows/preview-deploy.yml b/.github/workflows/preview-deploy.yml
index 05c921f84d..575f4644c8 100644
--- a/.github/workflows/preview-deploy.yml
+++ b/.github/workflows/preview-deploy.yml
@@ -16,9 +16,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- - name: Checkout
- uses: actions/checkout@v3
-
# Get PR ID from artifact
- name: download pr artifact
uses: dawidd6/action-download-artifact@v2
@@ -31,8 +28,24 @@ jobs:
id: pr
run: echo "id=$(<pr-id.txt)" >> $GITHUB_OUTPUT
+ # Get PR branch name from artifact
+ - name: download pr artifact
+ uses: dawidd6/action-download-artifact@v2
+ with:
+ workflow: ${{ github.event.workflow_run.workflow_id }}
+ run_id: ${{ github.event.workflow_run.id }}
+ name: pr-branch-name
+
+ - name: save PR branch name
+ id: pr-branch-name
+ run: echo "id=$(<pr-branch-name.txt)" >> $GITHUB_OUTPUT
+
+ - name: Checkout
+ uses: actions/checkout@v3
+ with:
+ ref: ${{ steps.pr-branch-name.outputs.id }}
- - name: Setup pnpm cache
+ - name: Setup workspace cache
uses: actions/cache@v3
with:
path: .workspace