From a5e4f16365f8d34aafe6be30debf7c4a720de672 Mon Sep 17 00:00:00 2001 From: chbg Date: Thu, 26 Sep 2024 22:50:22 -0400 Subject: [PATCH 1/9] Fix: Run pkg.pr.new only if there are changes --- .github/workflows/pkg.pr.new.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pkg.pr.new.yml b/.github/workflows/pkg.pr.new.yml index 94d45c799..ebcedbd89 100644 --- a/.github/workflows/pkg.pr.new.yml +++ b/.github/workflows/pkg.pr.new.yml @@ -12,6 +12,12 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 + - name: Check for changes to nuqs package + run: | + if git diff --quiet HEAD^ HEAD ./packages/nuqs; then + echo "No changes to nuqs package, skipping preview deployment." + exit 0 + fi - uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 - uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b with: @@ -25,4 +31,4 @@ jobs: run: pnpm pkg set version=0.0.0-preview.${{ github.event.pull_request.head.sha }} working-directory: packages/nuqs - name: Publish to pkg.pr.new - run: pnpx pkg-pr-new publish --compact './packages/nuqs' + run: pnpx pkg-pr-new publish --compact './packages/nuqs' \ No newline at end of file From 801832e3d68a99d0862992676b8bcd2bdcec3e38 Mon Sep 17 00:00:00 2001 From: Houston Barnett-Gearhart Date: Fri, 27 Sep 2024 08:58:51 -0400 Subject: [PATCH 2/9] Update .github/workflows/pkg.pr.new.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Modified the check for changes to the nuqs package by adding an output variable skip=true when no changes are detected. This allows the workflow to continue without failing while enabling subsequent steps to conditionally execute based on this output. Additionally, adjusted the Git diff command to evaluate the entire commit range from base to HEAD, ensuring a more comprehensive check for any changes. Co-authored-by: François Best --- .github/workflows/pkg.pr.new.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pkg.pr.new.yml b/.github/workflows/pkg.pr.new.yml index ebcedbd89..80fad1ba1 100644 --- a/.github/workflows/pkg.pr.new.yml +++ b/.github/workflows/pkg.pr.new.yml @@ -13,10 +13,11 @@ jobs: steps: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 - name: Check for changes to nuqs package + id: check-for-changes run: | if git diff --quiet HEAD^ HEAD ./packages/nuqs; then echo "No changes to nuqs package, skipping preview deployment." - exit 0 + echo "skip=true" >> $GITHUB_OUTPUT fi - uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 - uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b From df7d250ae27488ae02e62b76d454fab4818cb7a9 Mon Sep 17 00:00:00 2001 From: Houston Barnett-Gearhart Date: Fri, 27 Sep 2024 09:02:25 -0400 Subject: [PATCH 3/9] Update .github/workflows/pkg.pr.new.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implemented a condition for the ‘Publish to pkg.pr.new’ step to execute only if changes were detected in the nuqs package. By adding if: steps.check-for-changes.outputs.skip != 'true', the workflow prevents unnecessary publishing actions when there are no changes, optimizing the deployment process and reducing potential errors. Co-authored-by: François Best --- .github/workflows/pkg.pr.new.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pkg.pr.new.yml b/.github/workflows/pkg.pr.new.yml index 80fad1ba1..8b6357840 100644 --- a/.github/workflows/pkg.pr.new.yml +++ b/.github/workflows/pkg.pr.new.yml @@ -32,4 +32,5 @@ jobs: run: pnpm pkg set version=0.0.0-preview.${{ github.event.pull_request.head.sha }} working-directory: packages/nuqs - name: Publish to pkg.pr.new + - if: steps.check-for-changes.outputs.skip != 'true' run: pnpx pkg-pr-new publish --compact './packages/nuqs' \ No newline at end of file From d6e01c4e0544b7407566e3dfaf58bb701c218217 Mon Sep 17 00:00:00 2001 From: Houston Barnett-Gearhart Date: Fri, 27 Sep 2024 09:24:19 -0400 Subject: [PATCH 4/9] Add newline before publish step for readability This commit adds a newline between the 'Install dependencies' step and the 'Publish to pkg.pr.new' step in the workflow file to improve readability and maintainability of the code. --- .github/workflows/pkg.pr.new.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pkg.pr.new.yml b/.github/workflows/pkg.pr.new.yml index 8b6357840..48b45f79b 100644 --- a/.github/workflows/pkg.pr.new.yml +++ b/.github/workflows/pkg.pr.new.yml @@ -33,4 +33,5 @@ jobs: working-directory: packages/nuqs - name: Publish to pkg.pr.new - if: steps.check-for-changes.outputs.skip != 'true' + run: pnpx pkg-pr-new publish --compact './packages/nuqs' \ No newline at end of file From 25ea7cd9c2fc9a71a5cf0c9d45124ed8e58357ab Mon Sep 17 00:00:00 2001 From: Houston Barnett-Gearhart Date: Fri, 27 Sep 2024 09:30:49 -0400 Subject: [PATCH 5/9] Update .github/workflows/pkg.pr.new.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: François Best --- .github/workflows/pkg.pr.new.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/pkg.pr.new.yml b/.github/workflows/pkg.pr.new.yml index 48b45f79b..0574a9684 100644 --- a/.github/workflows/pkg.pr.new.yml +++ b/.github/workflows/pkg.pr.new.yml @@ -33,5 +33,4 @@ jobs: working-directory: packages/nuqs - name: Publish to pkg.pr.new - if: steps.check-for-changes.outputs.skip != 'true' - - run: pnpx pkg-pr-new publish --compact './packages/nuqs' \ No newline at end of file + run: pnpx pkg-pr-new publish --compact './packages/nuqs' From 86c3ea38e42a778507c86339da0f60604e9666f1 Mon Sep 17 00:00:00 2001 From: Houston Barnett-Gearhart Date: Fri, 27 Sep 2024 09:30:59 -0400 Subject: [PATCH 6/9] Update .github/workflows/pkg.pr.new.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: François Best --- .github/workflows/pkg.pr.new.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pkg.pr.new.yml b/.github/workflows/pkg.pr.new.yml index 0574a9684..0495a5398 100644 --- a/.github/workflows/pkg.pr.new.yml +++ b/.github/workflows/pkg.pr.new.yml @@ -32,5 +32,5 @@ jobs: run: pnpm pkg set version=0.0.0-preview.${{ github.event.pull_request.head.sha }} working-directory: packages/nuqs - name: Publish to pkg.pr.new - - if: steps.check-for-changes.outputs.skip != 'true' + if: steps.check-for-changes.outputs.skip != 'true' run: pnpx pkg-pr-new publish --compact './packages/nuqs' From 81b140ddf16a67f8609e01cd332a33eb58ab73b9 Mon Sep 17 00:00:00 2001 From: Houston Barnett-Gearhart Date: Fri, 27 Sep 2024 09:38:37 -0400 Subject: [PATCH 7/9] Update pkg.pr.new.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: François Best --- .github/workflows/pkg.pr.new.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pkg.pr.new.yml b/.github/workflows/pkg.pr.new.yml index 0495a5398..95fbcc703 100644 --- a/.github/workflows/pkg.pr.new.yml +++ b/.github/workflows/pkg.pr.new.yml @@ -15,7 +15,7 @@ jobs: - name: Check for changes to nuqs package id: check-for-changes run: | - if git diff --quiet HEAD^ HEAD ./packages/nuqs; then + if git diff --quiet ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} ./packages/nuqs; then echo "No changes to nuqs package, skipping preview deployment." echo "skip=true" >> $GITHUB_OUTPUT fi From eaa6178ee6277b8d0f768f9f216d7c12d7ddce76 Mon Sep 17 00:00:00 2001 From: Houston Barnett-Gearhart Date: Fri, 27 Sep 2024 10:52:50 -0400 Subject: [PATCH 8/9] Update pkg.pr.new.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: François Best --- .github/workflows/pkg.pr.new.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pkg.pr.new.yml b/.github/workflows/pkg.pr.new.yml index 95fbcc703..9568aa023 100644 --- a/.github/workflows/pkg.pr.new.yml +++ b/.github/workflows/pkg.pr.new.yml @@ -12,6 +12,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 + with: + fetch-depth: 2 - name: Check for changes to nuqs package id: check-for-changes run: | From bb75964e40971ee22d7e44ad9bdeff90e9797311 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Best?= Date: Fri, 27 Sep 2024 17:07:15 +0200 Subject: [PATCH 9/9] chore: Update .github/workflows/pkg.pr.new.yml --- .github/workflows/pkg.pr.new.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pkg.pr.new.yml b/.github/workflows/pkg.pr.new.yml index 9568aa023..376660190 100644 --- a/.github/workflows/pkg.pr.new.yml +++ b/.github/workflows/pkg.pr.new.yml @@ -17,7 +17,7 @@ jobs: - name: Check for changes to nuqs package id: check-for-changes run: | - if git diff --quiet ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} ./packages/nuqs; then + if git diff --quiet HEAD^ HEAD ./packages/nuqs; then echo "No changes to nuqs package, skipping preview deployment." echo "skip=true" >> $GITHUB_OUTPUT fi