From a58e24d82b5a490c38a35a75ecaf48366ab51f4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Richard=20Sol=C3=A1r?= Date: Fri, 30 Oct 2026 11:00:47 +0100 Subject: [PATCH 1/2] ci: publish per-PR preview builds to pkg.pr.new Opt-in via the `cli-preview` label. Phase 1 of #1357. Co-Authored-By: Claude Opus 5 --- .github/workflows/pr_preview.yaml | 42 +++++++++++++++++++++++++++++++ package.json | 1 + pnpm-lock.yaml | 18 ++++++++----- 3 files changed, 55 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/pr_preview.yaml diff --git a/.github/workflows/pr_preview.yaml b/.github/workflows/pr_preview.yaml new file mode 100644 index 000000000..3011ee539 --- /dev/null +++ b/.github/workflows/pr_preview.yaml @@ -0,0 +1,42 @@ +# This workflow publishes a preview build of a pull request to pkg.pr.new, so that +# reviewers can install the CLI from the pull request without a local checkout. +# Previews are opt-in: add the `cli-preview` label to the pull request. + +name: PR preview + +on: + pull_request: + types: [labeled, synchronize] + +permissions: {} + +env: + LATEST_NODE_VERSION: 24 + APIFY_CLI_DISABLE_TELEMETRY: 1 + +concurrency: + cancel-in-progress: true + group: pr-preview-${{ github.ref }} + +jobs: + publish: + if: ${{ contains(github.event.pull_request.labels.*.name, 'cli-preview') && github.event.pull_request.head.repo.full_name == github.repository }} + + name: Publish preview + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + + - name: Use Node.js ${{ env.LATEST_NODE_VERSION }} + uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 + with: + node-version: ${{ env.LATEST_NODE_VERSION }} + + - name: Install pnpm and dependencies + uses: apify/actions/pnpm-install@v1.6.2 + + # `pnpm pack` runs the `prepack` script, which builds the CLI. + - name: Publish to pkg.pr.new + run: pnpm exec pkg-pr-new publish --pnpm --bin --comment=update diff --git a/package.json b/package.json index f2f277140..5457bdad3 100644 --- a/package.json +++ b/package.json @@ -136,6 +136,7 @@ "oxfmt": "0.73.0", "oxlint": "1.89.0", "oxlint-tsgolint": "0.22.1", + "pkg-pr-new": "0.0.91", "rimraf": "~6.1.3", "tsdown": "^0.23.0", "tsx": "^4.23.13", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 85793e2c4..f5ae8ebdd 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -374,6 +374,9 @@ importers: oxlint-tsgolint: specifier: 0.22.1 version: 0.22.1 + pkg-pr-new: + specifier: 0.0.91 + version: 0.0.91 rimraf: specifier: ~6.1.3 version: 6.1.3 @@ -7313,6 +7316,10 @@ packages: resolution: {integrity: sha512-Ie9z/WINcxxLp27BKOCHGde4ITq9UklYKDzVo1nhk5sqGEXU3FpkwP5GM2voTGJkGd9B3Otl+Q4uwSOeSUtOBA==} engines: {node: '>=14.16'} + pkg-pr-new@0.0.91: + resolution: {integrity: sha512-FQPmjspKRKYV4MlHQnun9snJqlYm6Yhmo12x1O3pgE2Akim/y/BZjMOppK//BFdh222WOj6WGqlmeZfrtUtfgQ==} + hasBin: true + pkijs@3.4.1: resolution: {integrity: sha512-Oo/NZcSWccq8KyoG7gLE9fnltgHns+pNCjCAp/WmjsUySi+sX7y4z4Xqu4fVb42CDHzRPl33fjzT15V1wvcyhA==} engines: {node: '>=16.0.0'} @@ -8620,13 +8627,10 @@ packages: resolution: {integrity: sha512-drKKsqvDBxVRn4ySU67iQ5nQBuo/1xyYeBfdhDde112PkqrS3+95KPnpDs5hFRcmrW+q6+gbyywYYYR14oWFtw==} engines: {node: '>= 16'} peerDependencies: - css-to-react-native: '>= 3.2.0' react: '>= 16.8.0' react-dom: '>= 16.8.0' react-native: '>= 0.68.0' peerDependenciesMeta: - css-to-react-native: - optional: true react-dom: optional: true react-native: @@ -14419,8 +14423,8 @@ snapshots: clean-stack: 2.2.0 indent-string: 4.0.0 - ajv-formats@3.0.1: - dependencies: + ajv-formats@3.0.1(ajv@8.20.0): + optionalDependencies: ajv: 8.20.0 ajv-keywords@3.5.2(ajv@6.15.0): @@ -17811,6 +17815,8 @@ snapshots: dependencies: find-up: 6.3.0 + pkg-pr-new@0.0.91: {} + pkijs@3.4.1: dependencies: '@noble/hashes': 1.8.0 @@ -19060,7 +19066,7 @@ snapshots: dependencies: '@types/json-schema': 7.0.15 ajv: 8.20.0 - ajv-formats: 3.0.1 + ajv-formats: 3.0.1(ajv@8.20.0) ajv-keywords: 5.1.0(ajv@8.20.0) optionalDependencies: webpack: 5.112.0(@swc/core@1.16.18)(@swc/html@1.16.18)(clean-css@5.3.3)(cssnano@6.1.2(postcss@8.5.31))(csso@5.0.5)(esbuild@0.28.2)(html-minifier-terser@7.2.0)(lightningcss@1.33.0)(postcss@8.5.31)(svgo@3.3.5)(uglify-js@3.19.3) From 36c5551de4ede3b71dbf415675b07a72d05bff70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Richard=20Sol=C3=A1r?= Date: Fri, 30 Oct 2026 11:20:56 +0100 Subject: [PATCH 2/2] ci: publish previews on all non-bot PRs Drops the `cli-preview` label gate. Forks and bot authors stay excluded. Co-Authored-By: Claude Opus 5 --- .github/workflows/pr_preview.yaml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pr_preview.yaml b/.github/workflows/pr_preview.yaml index 3011ee539..b9c82b193 100644 --- a/.github/workflows/pr_preview.yaml +++ b/.github/workflows/pr_preview.yaml @@ -1,12 +1,10 @@ -# This workflow publishes a preview build of a pull request to pkg.pr.new, so that -# reviewers can install the CLI from the pull request without a local checkout. -# Previews are opt-in: add the `cli-preview` label to the pull request. +# This workflow publishes a preview build of every pull request to pkg.pr.new, so that +# reviewers can install the CLI from a pull request without a local checkout. name: PR preview on: pull_request: - types: [labeled, synchronize] permissions: {} @@ -20,7 +18,8 @@ concurrency: jobs: publish: - if: ${{ contains(github.event.pull_request.labels.*.name, 'cli-preview') && github.event.pull_request.head.repo.full_name == github.repository }} + # No previews from forks, and a dependency bump never needs one. + if: ${{ github.event.pull_request.head.repo.full_name == github.repository && github.event.pull_request.user.type != 'Bot' }} name: Publish preview