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.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
ci: harden GitHub Actions token handling
白熱33799973daa4
diff --git a/.github/workflows/build.yml b/.github/workflows/build.ymlindex be460d55d9..a76c246540 100644--- a/.github/workflows/build.yml+++ b/.github/workflows/build.yml@@ -30,6 +30,7 @@ jobs:with:repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}ref: ${{ github.event.pull_request.head.sha || github.sha }}+ persist-credentials: false- name: Setup Node.jsuses: ./.github/actions/setup-nodediff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.ymlindex 6d986bcbf6..64e19c12a5 100644--- a/.github/workflows/ci-test.yml+++ b/.github/workflows/ci-test.yml@@ -23,6 +23,8 @@ jobs:steps:- name: Checkoutuses: actions/checkout@v4+ with:+ persist-credentials: false- name: Setup Node.jsuses: ./.github/actions/setup-node@@ -41,6 +43,8 @@ jobs:steps:- name: Checkoutuses: actions/checkout@v4+ with:+ persist-credentials: false- name: Setup Node.jsuses: ./.github/actions/setup-node@@ -54,6 +58,8 @@ jobs:steps:- name: Checkoutuses: actions/checkout@v4+ with:+ persist-credentials: false- name: Setup Node.jsuses: ./.github/actions/setup-nodediff --git a/.github/workflows/dev-performance-log.yml b/.github/workflows/dev-performance-log.ymlindex 547692f319..782fe535fe 100644--- a/.github/workflows/dev-performance-log.yml+++ b/.github/workflows/dev-performance-log.yml@@ -23,6 +23,8 @@ jobs:steps:- name: Checkoutuses: actions/checkout@v4+ with:+ persist-credentials: false- name: Set Envrun: |diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.ymlindex 9f40a5eec8..a5a35180ea 100644--- a/.github/workflows/e2e.yml+++ b/.github/workflows/e2e.yml@@ -24,6 +24,8 @@ jobs:steps:- name: Checkoutuses: actions/checkout@v4+ with:+ persist-credentials: false- name: Setup Node.jsuses: ./.github/actions/setup-nodediff --git a/.github/workflows/preview-deploy.yml b/.github/workflows/preview-deploy.ymlindex eb5419e48c..0deafb04c0 100644--- a/.github/workflows/preview-deploy.yml+++ b/.github/workflows/preview-deploy.yml@@ -110,6 +110,7 @@ jobs:with:repository: ${{ needs.setup.outputs.repo }}ref: ${{ needs.setup.outputs.ref }}+ persist-credentials: false- name: Setup pnpmuses: pnpm/action-setup@v4@@ -180,6 +181,7 @@ jobs:with:repository: ${{ needs.setup.outputs.repo }}ref: ${{ needs.setup.outputs.ref }}+ persist-credentials: false- name: Setup pnpmuses: pnpm/action-setup@v4diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex a0e322bfc4..bf90bc489d 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -13,7 +13,7 @@ concurrency:cancel-in-progress: truepermissions:- contents: write+ contents: readjobs:prepare:@@ -26,7 +26,7 @@ jobs:- name: Checkoutuses: actions/checkout@v4with:- token: ${{ secrets.GH_TOKEN }}+ persist-credentials: false- name: Setup Node.jsuses: ./.github/actions/setup-node@@ -51,6 +51,7 @@ jobs:uses: actions/checkout@v4with:ref: ${{ github.ref_name }}+ persist-credentials: false- name: Install pnpmuses: pnpm/action-setup@v4@@ -88,6 +89,8 @@ jobs:steps:- name: Checkoutuses: actions/checkout@v4+ with:+ persist-credentials: false- name: Setup Node.jsuses: ./.github/actions/setup-node@@ -119,6 +122,8 @@ jobs:steps:- name: Checkoutuses: actions/checkout@v4+ with:+ persist-credentials: false- name: Setup Node.jsuses: ./.github/actions/setup-nodediff --git a/.github/workflows/setup.yml b/.github/workflows/setup.ymlindex 0341e0f735..b506f4f9fb 100644--- a/.github/workflows/setup.yml+++ b/.github/workflows/setup.yml@@ -20,10 +20,14 @@ jobs:runs-on: ubuntu-lateststeps:- name: Save PR info+ env:+ PR_ID: ${{ github.event.pull_request.number || '' }}+ PR_REF: ${{ github.head_ref || github.ref_name }}+ PR_REPO: ${{ github.event.pull_request.head.repo.full_name || github.repository }}run: |- echo ${{ github.event.pull_request.number || '' }} > ./pr-id.txt- echo ${{ github.head_ref || github.ref_name }} >> ./pr-ref.txt- echo ${{ github.event.pull_request.head.repo.full_name || github.repository }} >> ./pr-repo.txt+ printf '%s\n' "$PR_ID" > ./pr-id.txt+ printf '%s\n' "$PR_REF" > ./pr-ref.txt+ printf '%s\n' "$PR_REPO" > ./pr-repo.txt- name: Upload PR numberuses: actions/upload-artifact@v4diff --git a/.github/workflows/sync-pro.yml b/.github/workflows/sync-pro.ymlindex 6fec468086..0ac08c6ab1 100644--- a/.github/workflows/sync-pro.yml+++ b/.github/workflows/sync-pro.yml@@ -12,7 +12,7 @@ jobs:steps:- name: Dispatch sync event to univer-pro- uses: peter-evans/repository-dispatch@v2+ uses: peter-evans/repository-dispatch@v4with:repository: dream-num/univer-protoken: ${{ secrets.GH_TOKEN }}@@ -22,14 +22,3 @@ jobs:"ref": "${{ github.ref_name }}","sha": "${{ github.sha }}"}- - name: Dispatch sync event to univer-labs- uses: peter-evans/repository-dispatch@v2- with:- repository: dream-num/univer-labs- token: ${{ secrets.GH_TOKEN }}- event-type: sync-univer- client-payload: >- {- "ref": "${{ github.ref_name }}",- "sha": "${{ github.sha }}"- }diff --git a/.github/workflows/update-snapshots-manually.yml b/.github/workflows/update-snapshots-manually.ymlindex 40b6d3ced6..965e5b60cc 100644--- a/.github/workflows/update-snapshots-manually.yml+++ b/.github/workflows/update-snapshots-manually.yml@@ -4,6 +4,9 @@ name: 📸 Manually Update Snapshotson:workflow_dispatch:+permissions:+ contents: read+jobs:update-snapshots:runs-on: ubuntu-latest@@ -14,7 +17,7 @@ jobs:- name: Checkoutuses: actions/checkout@v4with:- token: ${{ secrets.GH_TOKEN }}+ persist-credentials: false- name: Setup Node.jsuses: ./.github/actions/setup-node@@ -24,11 +27,14 @@ jobs:- name: Commit Updated Snapshotsshell: bash+ env:+ PUSH_TOKEN: ${{ secrets.GH_TOKEN }}run: |git config --global user.email "[email protected]"git config --global user.name "GitHub Actions"+ git remote set-url origin "https://x-access-token:${PUSH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"git statusgit add -Agit commit -m "chore(snapshots): update snapshots" || exit 0- git push+ git push origin "HEAD:${GITHUB_REF_NAME}"diff --git a/package.json b/package.jsonindex 9ced6dd85c..1476a5fa7f 100644--- a/package.json+++ b/package.json@@ -89,15 +89,13 @@"vitest": "^4.1.1"},"pnpm": {- "onlyBuiltDependencies": [- "esbuild"- ]- },- "resolutions": {- "@types/react": "19.2.14",- "@types/react-dom": "19.2.3",- "react": "19.2.4",- "react-dom": "19.2.4"+ "overrides": {+ "@types/react": "19.2.14",+ "@types/react-dom": "19.2.3",+ "basic-ftp": "5.2.0",+ "react": "19.2.4",+ "react-dom": "19.2.4"+ }},"lint-staged": {"*": "eslint --fix"diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex e09cf6b263..d0ffd947ce 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -7,6 +7,7 @@ settings:overrides:'@types/react': 19.2.14'@types/react-dom': 19.2.3+ basic-ftp: 5.2.0react: 19.2.4react-dom: 19.2.4@@ -6258,8 +6259,8 @@ packages:resolution: {integrity: sha512-ZCQ9GEWl73BVm8bu5Fts8nt7MHdbt5vY9bP6WGnUh+r3l8M7CgfyTlwsgCbMC66BNxPr6Xoce3j66Ms5YUQTNA==}hasBin: true- resolution: {integrity: sha512-RkaJzeJKDbaDWTIPiJwubyljaEPwpVWkm9Rt5h9Nd6h7tEXTJ3VB4qxdZBioV7JO5yLUaOKwz7vDOzlncUsegw==}+ resolution: {integrity: sha512-VoMINM2rqJwJgfdHq6RiUudKt2BV+FY5ZFezP/ypmwayk68+NzzAQy4XXLlqsGD4MCzq3DrmNFD/uUmBJuGoXw==}engines: {node: '>=10.0.0'}@@ -14195,7 +14196,7 @@ snapshots:- [email protected]: {}+ [email protected]: {}@@ -15847,7 +15848,7 @@ snapshots:dependencies:- basic-ftp: 5.1.0+ basic-ftp: 5.2.0data-uri-to-buffer: 6.0.2debug: 4.4.3transitivePeerDependencies: