chore: update dev dependencies and workflow
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
30
src/tag.ts
30
src/tag.ts
@@ -33,7 +33,7 @@ export class Tag {
|
||||
|
||||
public toString(): string {
|
||||
const out: string[] = [`type=${this.type}`];
|
||||
for (let attr in this.attrs) {
|
||||
for (const attr in this.attrs) {
|
||||
out.push(`${attr}=${this.attrs[attr]}`);
|
||||
}
|
||||
return out.join(',');
|
||||
@@ -124,44 +124,44 @@ export function Parse(s: string): Tag {
|
||||
|
||||
switch (tag.type) {
|
||||
case Type.Schedule: {
|
||||
if (!tag.attrs.hasOwnProperty('pattern')) {
|
||||
if (!Object.prototype.hasOwnProperty.call(tag.attrs, 'pattern')) {
|
||||
tag.attrs['pattern'] = 'nightly';
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Type.Semver:
|
||||
case Type.Pep440: {
|
||||
if (!tag.attrs.hasOwnProperty('pattern')) {
|
||||
if (!Object.prototype.hasOwnProperty.call(tag.attrs, 'pattern')) {
|
||||
throw new Error(`Missing pattern attribute for ${s}`);
|
||||
}
|
||||
if (!tag.attrs.hasOwnProperty('value')) {
|
||||
if (!Object.prototype.hasOwnProperty.call(tag.attrs, 'value')) {
|
||||
tag.attrs['value'] = '';
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Type.Match: {
|
||||
if (!tag.attrs.hasOwnProperty('pattern')) {
|
||||
if (!Object.prototype.hasOwnProperty.call(tag.attrs, 'pattern')) {
|
||||
throw new Error(`Missing pattern attribute for ${s}`);
|
||||
}
|
||||
if (!tag.attrs.hasOwnProperty('group')) {
|
||||
if (!Object.prototype.hasOwnProperty.call(tag.attrs, 'group')) {
|
||||
tag.attrs['group'] = '0';
|
||||
}
|
||||
if (isNaN(+tag.attrs['group'])) {
|
||||
throw new Error(`Invalid match group for ${s}`);
|
||||
}
|
||||
if (!tag.attrs.hasOwnProperty('value')) {
|
||||
if (!Object.prototype.hasOwnProperty.call(tag.attrs, 'value')) {
|
||||
tag.attrs['value'] = '';
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Type.Edge: {
|
||||
if (!tag.attrs.hasOwnProperty('branch')) {
|
||||
if (!Object.prototype.hasOwnProperty.call(tag.attrs, 'branch')) {
|
||||
tag.attrs['branch'] = '';
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Type.Ref: {
|
||||
if (!tag.attrs.hasOwnProperty('event')) {
|
||||
if (!Object.prototype.hasOwnProperty.call(tag.attrs, 'event')) {
|
||||
throw new Error(`Missing event attribute for ${s}`);
|
||||
}
|
||||
if (
|
||||
@@ -171,22 +171,22 @@ export function Parse(s: string): Tag {
|
||||
) {
|
||||
throw new Error(`Invalid event for ${s}`);
|
||||
}
|
||||
if (tag.attrs['event'] == RefEvent.PR && !tag.attrs.hasOwnProperty('prefix')) {
|
||||
if (tag.attrs['event'] == RefEvent.PR && !Object.prototype.hasOwnProperty.call(tag.attrs, 'prefix')) {
|
||||
tag.attrs['prefix'] = 'pr-';
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Type.Raw: {
|
||||
if (!tag.attrs.hasOwnProperty('value')) {
|
||||
if (!Object.prototype.hasOwnProperty.call(tag.attrs, 'value')) {
|
||||
throw new Error(`Missing value attribute for ${s}`);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Type.Sha: {
|
||||
if (!tag.attrs.hasOwnProperty('prefix')) {
|
||||
if (!Object.prototype.hasOwnProperty.call(tag.attrs, 'prefix')) {
|
||||
tag.attrs['prefix'] = 'sha-';
|
||||
}
|
||||
if (!tag.attrs.hasOwnProperty('format')) {
|
||||
if (!Object.prototype.hasOwnProperty.call(tag.attrs, 'format')) {
|
||||
tag.attrs['format'] = ShaFormat.Short;
|
||||
}
|
||||
if (
|
||||
@@ -200,10 +200,10 @@ export function Parse(s: string): Tag {
|
||||
}
|
||||
}
|
||||
|
||||
if (!tag.attrs.hasOwnProperty('enable')) {
|
||||
if (!Object.prototype.hasOwnProperty.call(tag.attrs, 'enable')) {
|
||||
tag.attrs['enable'] = 'true';
|
||||
}
|
||||
if (!tag.attrs.hasOwnProperty('priority')) {
|
||||
if (!Object.prototype.hasOwnProperty.call(tag.attrs, 'priority')) {
|
||||
tag.attrs['priority'] = DefaultPriorities[tag.type];
|
||||
}
|
||||
if (!['true', 'false'].includes(tag.attrs['enable'])) {
|
||||
|
Reference in New Issue
Block a user