Skip to content

Commit 2d24640

Browse files
committed
Address review comments
Signed-off-by: Varun Sharma <varunsh@stepsecurity.io>
1 parent 43530c0 commit 2d24640

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

.github/workflows/npm-publish.yml

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,30 +19,22 @@ jobs:
1919
with:
2020
ref: ${{ github.event.inputs.tag }}
2121

22+
- name: Validate semver pattern
23+
run: npx semver ${{ inputs.tag }}
24+
2225
- name: Check package version
2326
id: cpv
2427
uses: PostHog/check-package-version@v2
2528

26-
- run: npm install semver
27-
28-
- name: Validate tag
29+
- name: Validate package version
2930
uses: actions/github-script@v6
3031
with:
3132
script: |
32-
const semver = require('semver')
33-
34-
const tag = `${context.payload.inputs.tag}`;
35-
const version = tag.substring(1);
36-
37-
if (semver.valid(version)) {
38-
const isNewVersion = `${{ steps.cpv.outputs.is-new-version }}`;
39-
if (isNewVersion === 'true') {
33+
const isNewVersion = `${{ steps.cpv.outputs.is-new-version }}`;
34+
if (isNewVersion === 'true') {
4035
console.log(`Version ${context.payload.inputs.tag} has not been published yet`);
41-
} else {
42-
core.setFailed(`Version ${context.payload.inputs.tag} is already published`);
43-
}
4436
} else {
45-
core.setFailed(`Tag ${context.payload.inputs.tag} does not match semver pattern`);
37+
core.setFailed(`Version ${context.payload.inputs.tag} is already published`);
4638
}
4739
check-status:
4840
needs: check-version
@@ -105,7 +97,6 @@ jobs:
10597
egress-policy: block
10698
allowed-endpoints: >
10799
github.com:443
108-
hooks.slack.com:443
109100
nodejs.org:443
110101
prod.api.stepsecurity.io:443
111102
registry.npmjs.org:443

0 commit comments

Comments
 (0)