Skip to content

Commit 34b5151

Browse files
chbgfranky47
andauthored
chore: Run pkg.pr.new only if there are changes (#656)
* Fix: Run pkg.pr.new only if there are changes * Update .github/workflows/pkg.pr.new.yml 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@francoisbest.com> * Update .github/workflows/pkg.pr.new.yml 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@francoisbest.com> * 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. * Update .github/workflows/pkg.pr.new.yml Co-authored-by: François Best <github@francoisbest.com> * Update .github/workflows/pkg.pr.new.yml Co-authored-by: François Best <github@francoisbest.com> * Update pkg.pr.new.yml Co-authored-by: François Best <github@francoisbest.com> * Update pkg.pr.new.yml Co-authored-by: François Best <github@francoisbest.com> * chore: Update .github/workflows/pkg.pr.new.yml --------- Co-authored-by: François Best <github@francoisbest.com>
1 parent 0e7395e commit 34b5151

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Diff for: .github/workflows/pkg.pr.new.yml

+10
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
15+
with:
16+
fetch-depth: 2
17+
- name: Check for changes to nuqs package
18+
id: check-for-changes
19+
run: |
20+
if git diff --quiet HEAD^ HEAD ./packages/nuqs; then
21+
echo "No changes to nuqs package, skipping preview deployment."
22+
echo "skip=true" >> $GITHUB_OUTPUT
23+
fi
1524
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2
1625
- uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b
1726
with:
@@ -25,4 +34,5 @@ jobs:
2534
run: pnpm pkg set version=0.0.0-preview.${{ github.event.pull_request.head.sha }}
2635
working-directory: packages/nuqs
2736
- name: Publish to pkg.pr.new
37+
if: steps.check-for-changes.outputs.skip != 'true'
2838
run: pnpx pkg-pr-new publish --compact './packages/nuqs'

0 commit comments

Comments
 (0)