Skip to content

Commit 23f9905

Browse files
committed
fixup: beef up E2E tests to ensure --force does not mess with --dry-run
1 parent e9289cc commit 23f9905

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

.github/workflows/ci-cd.yaml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,21 @@ jobs:
177177
shell: bash
178178
run: ./e2e/01-setup-package.sh "${{ steps.setup.outputs.package }}" 0.0.3
179179

180+
- id: action-publish-dry-before
181+
name: Publish a dry run before publish
182+
uses: ./
183+
with:
184+
registry: http://localhost:4873
185+
package: ${{ steps.setup.outputs.package }}/package.json
186+
token: ${{ steps.setup.outputs.token }}
187+
dry-run: true
188+
189+
- name: Check release output
190+
if: ${{ steps.action-publish-dry-before.outputs.type }}
191+
run: |
192+
echo "::error::Expected release type to be '', got '${{ steps.action-publish-dry.outputs.type }}'"
193+
exit 1
194+
180195
- id: action-publish
181196
name: Publish a new version
182197
uses: ./
@@ -191,8 +206,8 @@ jobs:
191206
echo "::error::Expected release type to be 'patch', got '${{ steps.action-publish.outputs.type }}'"
192207
exit 1
193208
194-
- id: action-publish-dry
195-
name: Publish a dry run
209+
- id: action-publish-dry-after
210+
name: Publish a dry run after publish
196211
uses: ./
197212
with:
198213
registry: http://localhost:4873
@@ -201,7 +216,7 @@ jobs:
201216
dry-run: true
202217

203218
- name: Check release output
204-
if: ${{ steps.action-publish-dry.outputs.type }}
219+
if: ${{ steps.action-publish-dry-after.outputs.type }}
205220
run: |
206221
echo "::error::Expected release type to be '', got '${{ steps.action-publish-dry.outputs.type }}'"
207222
exit 1

src/compare-and-publish/get-arguments.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,9 @@ export function getPublishArguments(
5454
}
5555

5656
if (!dryRun.isDefault && dryRun.value) {
57-
// NOTE: additional `--force` bypasses package existence check in npm >=11
58-
// because we do our own existence check separately
57+
// NOTE: `--force` does not override `--dry-run`,
58+
// but does bypass package existence check in npm >=11
59+
// because we do our own existence checks separately
5960
publishArguments.push("--dry-run", "--force");
6061
}
6162

0 commit comments

Comments
 (0)