mirror of
https://github.com/docker/metadata-action.git
synced 2025-04-04 09:10:25 +02:00
Warn on invalid semver
This commit is contained in:
parent
ef12c77b87
commit
c78798ed86
4
dist/index.js
generated
vendored
4
dist/index.js
generated
vendored
@ -171,6 +171,7 @@ exports.Meta = void 0;
|
||||
const handlebars = __webpack_require__(7492);
|
||||
const moment = __webpack_require__(9623);
|
||||
const semver = __webpack_require__(1383);
|
||||
const core = __webpack_require__(2186);
|
||||
class Meta {
|
||||
constructor(inputs, context, repo) {
|
||||
this.inputs = inputs;
|
||||
@ -198,6 +199,9 @@ class Meta {
|
||||
}
|
||||
else if (/^refs\/tags\//.test(this.context.ref)) {
|
||||
version.main = this.context.ref.replace(/^refs\/tags\//g, '').replace(/\//g, '-');
|
||||
if (this.inputs.tagSemver.length > 0 && !semver.valid(version.main)) {
|
||||
core.warning(`${version.main} is not a valid semver. More info: https://semver.org/`);
|
||||
}
|
||||
if (this.inputs.tagSemver.length > 0 && semver.valid(version.main)) {
|
||||
const sver = semver.parse(version.main, {
|
||||
includePrerelease: true
|
||||
|
@ -2,6 +2,7 @@ import * as handlebars from 'handlebars';
|
||||
import * as moment from 'moment';
|
||||
import * as semver from 'semver';
|
||||
import {Inputs} from './context';
|
||||
import * as core from '@actions/core';
|
||||
import {Context} from '@actions/github/lib/context';
|
||||
import {ReposGetResponseData} from '@octokit/types';
|
||||
|
||||
@ -46,6 +47,9 @@ export class Meta {
|
||||
});
|
||||
} else if (/^refs\/tags\//.test(this.context.ref)) {
|
||||
version.main = this.context.ref.replace(/^refs\/tags\//g, '').replace(/\//g, '-');
|
||||
if (this.inputs.tagSemver.length > 0 && !semver.valid(version.main)) {
|
||||
core.warning(`${version.main} is not a valid semver. More info: https://semver.org/`);
|
||||
}
|
||||
if (this.inputs.tagSemver.length > 0 && semver.valid(version.main)) {
|
||||
const sver = semver.parse(version.main, {
|
||||
includePrerelease: true
|
||||
|
Loading…
x
Reference in New Issue
Block a user