From 94933b026796ea50a0563af0d4ce217721defa14 Mon Sep 17 00:00:00 2001 From: baked Date: Thu, 4 Jul 2024 19:09:26 +0200 Subject: [PATCH] fix(action): pack action (#104) --- .github/workflows/pull.yml | 29 ++++--------------- .github/workflows/release.yml | 7 +++-- package.json | 2 +- packages/action/out/767.index.js | 9 +++++- .../template/.github/workflows/pull.yml | 18 +++--------- .../template/.github/workflows/release.yml | 10 +++---- 6 files changed, 27 insertions(+), 48 deletions(-) diff --git a/.github/workflows/pull.yml b/.github/workflows/pull.yml index 70e2884..4822e2c 100644 --- a/.github/workflows/pull.yml +++ b/.github/workflows/pull.yml @@ -15,24 +15,12 @@ concurrency: cancel-in-progress: true jobs: - unimported: - name: Check unimported - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: whopio/unimported-action@v0.0.1 - with: - token: ${{ github.token }} - projects: "packages/action,packages/create-turbo-module,packages/turbo-module" - install: name: Install node modules runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: pnpm/action-setup@v2 - with: - version: 8.15.5 + - uses: pnpm/action-setup@v4 - name: Setup node uses: actions/setup-node@v3 with: @@ -41,16 +29,14 @@ jobs: cache: pnpm - name: Install all packages run: pnpm install - + lint: name: Lint repository needs: install runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: pnpm/action-setup@v2 - with: - version: 8.15.5 + - uses: pnpm/action-setup@v4 - name: Setup node uses: actions/setup-node@v3 with: @@ -68,9 +54,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: pnpm/action-setup@v2 - with: - version: 8.15.5 + - uses: pnpm/action-setup@v4 - name: Setup node uses: actions/setup-node@v3 with: @@ -88,9 +72,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: pnpm/action-setup@v2 - with: - version: 8.15.5 + - uses: pnpm/action-setup@v4 - name: Setup node uses: actions/setup-node@v3 with: @@ -101,4 +83,3 @@ jobs: run: pnpm install - name: Build packages run: pnpm turbo test - diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fb88ecb..486b9ce 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,6 +13,9 @@ concurrency: group: "release" cancel-in-progress: false +permissions: + pull-requests: write + jobs: release: name: Publish to npm and release on github @@ -25,9 +28,7 @@ jobs: with: action: check token: ${{ github.token }} - - uses: pnpm/action-setup@v2 - with: - version: 8.15.5 + - uses: pnpm/action-setup@v4 if: steps.check.outputs.can-publish == 'true' - name: Setup node uses: actions/setup-node@v3 diff --git a/package.json b/package.json index 0738a5b..03d0bd4 100644 --- a/package.json +++ b/package.json @@ -20,5 +20,5 @@ "node": ">=18.0.0" }, "dependencies": {}, - "packageManager": "pnpm@8.5.15" + "packageManager": "pnpm@8.15.8" } diff --git a/packages/action/out/767.index.js b/packages/action/out/767.index.js index bda9e29..2ca64ea 100644 --- a/packages/action/out/767.index.js +++ b/packages/action/out/767.index.js @@ -1318,8 +1318,11 @@ var capitalise = function(str) { var _str_at; return "".concat(((_str_at = str.at(0)) === null || _str_at === void 0 ? void 0 : _str_at.toUpperCase()) || "").concat(str.slice(1)); }; +// GitHub enforces a max length of 65536 characters for a pull request body +var maxLength = 65536; +var lengthBuffer = 1000; var makeGithubReleaseMessage = function(stats) { - return "\n".concat(Object.entries(stats.pulls).map(function(param) { + var message = "\n".concat(Object.entries(stats.pulls).map(function(param) { var _param = get_message_slicedToArray(param, 2), key = _param[0], pulls = _param[1]; return "\n### ".concat(capitalise(key), " Changes\n\n").concat(pulls.map(function(param) { var title = param.title; @@ -1328,6 +1331,10 @@ var makeGithubReleaseMessage = function(stats) { }).join(""), "\n### Credits\n").concat(Array.from(stats.authors).map(function(author) { return "@".concat(author); }).join(", "), "\n").trim(); + if (message.length >= maxLength - lengthBuffer) { + return "".concat(message.slice(0, maxLength - lengthBuffer), "...\nThis message has been truncated to avoid exceeding the GitHub API's body limit."); + } + return message; }; var getReleaseMessage = function() { var _ref = get_message_asyncToGenerator(function(prerelease) { diff --git a/packages/create-turbo-module/template/.github/workflows/pull.yml b/packages/create-turbo-module/template/.github/workflows/pull.yml index 87bb517..4aa5d41 100644 --- a/packages/create-turbo-module/template/.github/workflows/pull.yml +++ b/packages/create-turbo-module/template/.github/workflows/pull.yml @@ -11,22 +11,12 @@ concurrency: cancel-in-progress: true jobs: - unimported: - name: Check unimported - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: whopio/unimported-action@v0.0.1 - with: - token: ${{ github.token }} - projects: "packages/$$NAME" - install: name: Install node modules runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: pnpm/action-setup@v2 + - uses: pnpm/action-setup@v4 with: version: 7.13.6 - name: Setup node @@ -44,7 +34,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: pnpm/action-setup@v2 + - uses: pnpm/action-setup@v4 with: version: 7.13.6 - name: Setup node @@ -64,7 +54,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: pnpm/action-setup@v2 + - uses: pnpm/action-setup@v4 with: version: 7.13.6 - name: Setup node @@ -84,7 +74,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: pnpm/action-setup@v2 + - uses: pnpm/action-setup@v4 with: version: 7.13.6 - name: Setup node diff --git a/packages/create-turbo-module/template/.github/workflows/release.yml b/packages/create-turbo-module/template/.github/workflows/release.yml index b86a614..0b045dd 100644 --- a/packages/create-turbo-module/template/.github/workflows/release.yml +++ b/packages/create-turbo-module/template/.github/workflows/release.yml @@ -6,7 +6,7 @@ on: name: Build, test, release concurrency: - group: "release" + group: 'release' cancel-in-progress: false jobs: @@ -20,12 +20,12 @@ jobs: - name: Check package.json for version increase id: check uses: whopio/turbo-module@v$$VERSION - with: + with: action: check token: ${{ github.token }} - uses: actions/checkout@v3 if: steps.check.outputs.can-publish == 'true' - - uses: pnpm/action-setup@v2 + - uses: pnpm/action-setup@v4 with: version: 7.13.6 if: steps.check.outputs.can-publish == 'true' @@ -49,14 +49,14 @@ jobs: - name: Github Release id: release uses: whopio/turbo-module@v$$VERSION - with: + with: action: release token: ${{ github.token }} version: ${{ steps.check.outputs.version }} if: steps.check.outputs.can-publish == 'true' - name: Sync auto-release PRs uses: whopio/turbo-module@v$$VERSION - with: + with: action: sync token: ${{ github.token }} published: ${{ steps.release.outputs.published }}