chore: update dev dependencies and workflow

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2022-03-22 21:09:00 +01:00
parent 47c365107c
commit e99ab50e6c
20 changed files with 2552 additions and 40207 deletions

View File

@ -39,14 +39,14 @@ export function getInputs(): Inputs {
}
export function getInputList(name: string, ignoreComma?: boolean): string[] {
let res: Array<string> = [];
const res: Array<string> = [];
const items = core.getInput(name);
if (items == '') {
return res;
}
for (let output of csvparse(items, {
for (const output of csvparse(items, {
columns: false,
relax: true,
comment: '#',
@ -73,6 +73,6 @@ export const asyncForEach = async (array, callback) => {
};
// FIXME: Temp fix https://github.com/actions/toolkit/issues/777
export function setOutput(name: string, value: any): void {
export function setOutput(name: string, value: unknown): void {
issueCommand('set-output', {name}, value);
}

View File

@ -43,7 +43,7 @@ async function run() {
core.warning('No Docker tag has been generated. Check tags input.');
} else {
core.startGroup(`Docker tags`);
for (let tag of tags) {
for (const tag of tags) {
core.info(tag);
}
core.endGroup();
@ -53,7 +53,7 @@ async function run() {
// Docker labels
const labels: Array<string> = meta.getLabels();
core.startGroup(`Docker labels`);
for (let label of labels) {
for (const label of labels) {
core.info(label);
}
core.endGroup();

View File

@ -138,7 +138,7 @@ export class Meta {
return version;
}
let latest: boolean = false;
let latest = false;
const sver = semver.parse(vraw, {
includePrerelease: true
});
@ -172,7 +172,7 @@ export class Meta {
return version;
}
let latest: boolean = false;
let latest = false;
const pver = pep440.explain(vraw);
if (pver.is_prerelease || pver.is_postrelease || pver.is_devrelease) {
if (Meta.isRawStatement(tag.attrs['pattern'])) {
@ -269,7 +269,7 @@ export class Meta {
return version;
}
let val = this.context.ref.replace(/^refs\/heads\//g, '').replace(/[^a-zA-Z0-9._-]+/g, '-');
const val = this.context.ref.replace(/^refs\/heads\//g, '').replace(/[^a-zA-Z0-9._-]+/g, '-');
if (tag.attrs['branch'].length == 0) {
tag.attrs['branch'] = this.repo.default_branch;
}
@ -328,12 +328,12 @@ export class Meta {
}
private setValue(val: string, tag: tcl.Tag): string {
if (tag.attrs.hasOwnProperty('prefix')) {
if (Object.prototype.hasOwnProperty.call(tag.attrs, 'prefix')) {
val = `${this.setGlobalExp(tag.attrs['prefix'])}${val}`;
} else if (this.flavor.prefix.length > 0) {
val = `${this.setGlobalExp(this.flavor.prefix)}${val}`;
}
if (tag.attrs.hasOwnProperty('suffix')) {
if (Object.prototype.hasOwnProperty.call(tag.attrs, 'suffix')) {
val = `${val}${this.setGlobalExp(tag.attrs['suffix'])}`;
} else if (this.flavor.suffix.length > 0) {
val = `${val}${this.setGlobalExp(this.flavor.suffix)}`;
@ -380,7 +380,7 @@ export class Meta {
return [];
}
let tags: Array<string> = [];
const tags: Array<string> = [];
for (const image of this.inputs.images) {
const imageLc = image.toLowerCase();
tags.push(`${imageLc}:${this.version.main}`);
@ -395,7 +395,7 @@ export class Meta {
}
public getLabels(): Array<string> {
let labels: Array<string> = [
const labels: Array<string> = [
`org.opencontainers.image.title=${this.repo.name || ''}`,
`org.opencontainers.image.description=${this.repo.description || ''}`,
`org.opencontainers.image.url=${this.repo.html_url || ''}`,
@ -409,7 +409,7 @@ export class Meta {
return labels;
}
public getJSON(): {} {
public getJSON(): unknown {
return {
tags: this.getTags(),
labels: this.getLabels().reduce((res, label) => {

View File

@ -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'])) {