File tree Expand file tree Collapse file tree 1 file changed +7
-16
lines changed Expand file tree Collapse file tree 1 file changed +7
-16
lines changed Original file line number Diff line number Diff line change @@ -19,30 +19,22 @@ jobs:
19
19
with :
20
20
ref : ${{ github.event.inputs.tag }}
21
21
22
+ - name : Validate semver pattern
23
+ run : npx semver ${{ inputs.tag }}
24
+
22
25
- name : Check package version
23
26
id : cpv
24
27
uses : PostHog/check-package-version@v2
25
28
26
- - run : npm install semver
27
-
28
- - name : Validate tag
29
+ - name : Validate package version
29
30
uses : actions/github-script@v6
30
31
with :
31
32
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') {
40
35
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
- }
44
36
} 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 `);
46
38
}
47
39
check-status :
48
40
needs : check-version
105
97
egress-policy : block
106
98
allowed-endpoints : >
107
99
github.com:443
108
- hooks.slack.com:443
109
100
nodejs.org:443
110
101
prod.api.stepsecurity.io:443
111
102
registry.npmjs.org:443
You can’t perform that action at this time.
0 commit comments