Skip to content

Commit c1e5197

Browse files
authored
Merge pull request #537 from crazy-max/pep440-match
allow to match part of the git tag or value for pep440 type
2 parents e0542a6 + 89dd65a commit c1e5197

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/meta.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ export class Meta {
169169
if (!tmatch) {
170170
core.warning(`${tag.attrs['match']} does not match ${vraw}.`);
171171
} else {
172-
vraw = this.setValue(tmatch[1], tag);
172+
vraw = tmatch[1];
173173
}
174174
}
175175

@@ -207,8 +207,20 @@ export class Meta {
207207
if (tag.attrs['value'].length > 0) {
208208
vraw = this.setGlobalExp(tag.attrs['value']);
209209
} else {
210-
vraw = this.context.ref.replace(/^refs\/tags\//g, '').replace(/\//g, '-');
210+
vraw = this.context.ref.replace(/^refs\/tags\//g, '');
211+
}
212+
213+
if (tag.attrs['match'].length > 0) {
214+
const tmatch = vraw.match(tag.attrs['match']);
215+
if (!tmatch) {
216+
core.warning(`${tag.attrs['match']} does not match ${vraw}.`);
217+
} else {
218+
vraw = tmatch[1];
219+
}
211220
}
221+
222+
vraw = vraw.replace(/\//g, '-');
223+
212224
if (!pep440.valid(vraw)) {
213225
core.warning(`${vraw} does not conform to PEP 440. More info: https://www.python.org/dev/peps/pep-0440`);
214226
return version;

0 commit comments

Comments
 (0)