From 0ddb7164684ae75f9dcf2cc314de6ec3dc8e7788 Mon Sep 17 00:00:00 2001 From: Artem Zakharchenko Date: Sun, 27 Oct 2024 12:00:13 +0100 Subject: [PATCH 1/7] chore: add lock-closed-issues workflow --- .github/workflows/lock-closed-issues.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/workflows/lock-closed-issues.yml diff --git a/.github/workflows/lock-closed-issues.yml b/.github/workflows/lock-closed-issues.yml new file mode 100644 index 000000000..0f50a7b50 --- /dev/null +++ b/.github/workflows/lock-closed-issues.yml @@ -0,0 +1,19 @@ +name: locked-closed-issues + +on: + schedule: + - cron: '0 0 * * *' + +permissions: + issues: write + +jobs: + action: + runs-on: macos-latest + steps: + - uses: dessant/lock-threads@v5 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + issue-inactive-days: '14' + issue-lock-reason: '' + process-only: 'issues' From f14bab5c5502173614175b5f148703ba2460f673 Mon Sep 17 00:00:00 2001 From: Artem Zakharchenko Date: Sun, 27 Oct 2024 12:04:30 +0100 Subject: [PATCH 2/7] chore: add release-preview workflow --- .github/workflows/release-preview.yml | 43 +++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/release-preview.yml diff --git a/.github/workflows/release-preview.yml b/.github/workflows/release-preview.yml new file mode 100644 index 000000000..197f2ff00 --- /dev/null +++ b/.github/workflows/release-preview.yml @@ -0,0 +1,43 @@ +name: release + +on: + pull_request_review: + types: [submitted] + workflow_dispatch: + +jobs: + preview: + # Publish previews only for approved pull requests. + if: github.event.review.state == 'APPROVED' + runs-on: macos-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: 18 + + - name: Set up pnpm + uses: pnpm/action-setup@v4 + with: + version: 8.15.6 + + - name: Install dependencies + run: pnpm install + + - name: Install Playwright browsers + run: pnpm exec playwright install + + - name: Lint + run: pnpm lint + + - name: Build + run: pnpm build + + - name: Tests + run: pnpm test + + - name: Publish preview + run: pnpm dlx pkg-pr-new@0.0 publish --compact --pnpm From 154c6e23e84eac2777ac168e8e6ae5ba8cf7c7c2 Mon Sep 17 00:00:00 2001 From: Artem Zakharchenko Date: Sun, 27 Oct 2024 12:04:43 +0100 Subject: [PATCH 3/7] chore: update actions versions in workflows --- .github/workflows/auto.yml | 2 ++ .github/workflows/ci.yml | 4 ++-- .github/workflows/compat.yml | 4 ++-- .github/workflows/release.yml | 9 +++++---- .github/workflows/smoke-test.yml | 6 +++--- .github/workflows/typescript-nightly.yml | 6 +++--- 6 files changed, 17 insertions(+), 14 deletions(-) diff --git a/.github/workflows/auto.yml b/.github/workflows/auto.yml index 41dcf1438..72f2ba2a1 100644 --- a/.github/workflows/auto.yml +++ b/.github/workflows/auto.yml @@ -1,5 +1,7 @@ name: auto + on: [push] + jobs: cancel-previous-workflows: runs-on: macos-latest diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d0fa59640..312b5e3b4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,10 +14,10 @@ jobs: runs-on: macos-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 18 diff --git a/.github/workflows/compat.yml b/.github/workflows/compat.yml index c331792d5..25ccd9296 100644 --- a/.github/workflows/compat.yml +++ b/.github/workflows/compat.yml @@ -12,10 +12,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 18 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e90648388..6a0bbfccb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,19 +13,20 @@ jobs: id-token: write steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 token: ${{ secrets.GH_ADMIN_TOKEN }} - - name: Setup Node.js - uses: actions/setup-node@v3 + - name: Set up Node.js + uses: actions/setup-node@v4 with: node-version: 18 always-auth: true registry-url: https://registry.npmjs.org - - uses: pnpm/action-setup@v4 + - name: Set up pnpm + uses: pnpm/action-setup@v4 with: version: 8.15.6 diff --git a/.github/workflows/smoke-test.yml b/.github/workflows/smoke-test.yml index 18b124ffa..e98d4acad 100644 --- a/.github/workflows/smoke-test.yml +++ b/.github/workflows/smoke-test.yml @@ -15,14 +15,14 @@ jobs: runs-on: macos-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 18 - - name: Set up PNPM + - name: Set up pnpm uses: pnpm/action-setup@v4 with: version: 8.15.6 diff --git a/.github/workflows/typescript-nightly.yml b/.github/workflows/typescript-nightly.yml index 9449cd3ba..a292f12bb 100644 --- a/.github/workflows/typescript-nightly.yml +++ b/.github/workflows/typescript-nightly.yml @@ -11,7 +11,7 @@ jobs: runs-on: macos-latest steps: - name: Set up Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 18 @@ -37,10 +37,10 @@ jobs: if: ${{ needs.compare.outputs.latest_version != needs.compare.outputs.rc_version }} steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 18 From 14aa5b95f57004acebb3379ddbed2f51e0f049e2 Mon Sep 17 00:00:00 2001 From: Artem Zakharchenko Date: Sun, 27 Oct 2024 12:20:33 +0100 Subject: [PATCH 4/7] chore: use "--comment=update" for package previews --- .github/workflows/release-preview.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-preview.yml b/.github/workflows/release-preview.yml index 197f2ff00..586fffe53 100644 --- a/.github/workflows/release-preview.yml +++ b/.github/workflows/release-preview.yml @@ -40,4 +40,4 @@ jobs: run: pnpm test - name: Publish preview - run: pnpm dlx pkg-pr-new@0.0 publish --compact --pnpm + run: pnpm dlx pkg-pr-new@0.0 publish --compact --pnpm --comment=update From dff3ec4e81bff18bb639b318284f276a726215c1 Mon Sep 17 00:00:00 2001 From: Artem Zakharchenko Date: Sun, 27 Oct 2024 12:30:19 +0100 Subject: [PATCH 5/7] docs: add preview publish to decisions log --- decisions/releases.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/decisions/releases.md b/decisions/releases.md index 42dc3ead2..8a7a0d813 100644 --- a/decisions/releases.md +++ b/decisions/releases.md @@ -4,9 +4,13 @@ MSW uses the [Release](https://github.com/ossjs/release) library to automate its ## Release schedule -The next version of the library releases automatically **every 3 days**. +The next version of **the library releases automatically every day**. We do our best to choose the optimal release window to accumulate multiple changes under a single release. We do deviate from the release schedule in emergency cases, like when a critical issue has been fixed and needs an immediate release. > [!IMPORTANT] > Please do not ping the library maintainers to release a new version of MSW. Be patient and wait for the automated release to happen. Subscribe to any issue or pull request you are interested in, and you will be notified whenever it gets released. + +## Preview releases + +This repository is configured to **release work-in-progress pull requests** using [okg.pr.new](https://github.com/stackblitz-labs/pkg.pr.new). Once the pull request in question is approved, it will automatically be published to a temporary registry. Follow the instructions in the automated comment to install the work-in-progress version of the package. From 87e711adb6f119296484afdb06d98b521ffb2a25 Mon Sep 17 00:00:00 2001 From: Artem Zakharchenko Date: Sun, 27 Oct 2024 13:20:25 +0100 Subject: [PATCH 6/7] chore: add permission check for the reviewer --- .github/workflows/release-preview.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release-preview.yml b/.github/workflows/release-preview.yml index 586fffe53..16aa9e5c5 100644 --- a/.github/workflows/release-preview.yml +++ b/.github/workflows/release-preview.yml @@ -8,7 +8,8 @@ on: jobs: preview: # Publish previews only for approved pull requests. - if: github.event.review.state == 'APPROVED' + # The reviewer must have push persmissions to trigger this job. + if: github.event.review.state == 'approved' && github.event.review.user.permissions.push == true runs-on: macos-latest steps: - name: Checkout From 50edf37a84a696846e9c0fe953da120a07dca282 Mon Sep 17 00:00:00 2001 From: Artem Zakharchenko Date: Sun, 27 Oct 2024 14:47:16 +0100 Subject: [PATCH 7/7] chore: use `actions-cool/check-user-permission` for permissions check --- .github/workflows/release-preview.yml | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release-preview.yml b/.github/workflows/release-preview.yml index 16aa9e5c5..6fa1d8dc8 100644 --- a/.github/workflows/release-preview.yml +++ b/.github/workflows/release-preview.yml @@ -6,10 +6,26 @@ on: workflow_dispatch: jobs: + check: + # Trigger the permissions check whenever someone approves a pull request. + # They must have the write permissions to the repo in order to + # trigger preview package publishing. + if: github.event.review.state == 'approved' + runs-on: ubuntu-latest + outputs: + has-permissions: ${{ steps.checkPermissions.outputs.require-result }} + steps: + - name: Check permissions + id: checkPermissions + uses: actions-cool/check-user-permission@v2 + with: + require: 'write' + preview: - # Publish previews only for approved pull requests. - # The reviewer must have push persmissions to trigger this job. - if: github.event.review.state == 'approved' && github.event.review.user.permissions.push == true + # The approving user must pass the permissions check + # to trigger the preview publish. + needs: check + if: needs.check.outputs.has-permissions == 'true' runs-on: macos-latest steps: - name: Checkout