Skip to content

Commit 65ac596

Browse files
committed
fix set
1 parent 668f459 commit 65ac596

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/ImageDetector.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
import exec from 'actions-exec-listener'
22

33
export class ImageDetector {
4-
alreadyExistedImages: Set<string> = new Set()
5-
existingImages: Set<string> = new Set()
4+
alreadyExistedImages: Set<string> = new Set([])
5+
existingImages: Set<string> = new Set([])
66
registerAlreadyExistedImages(images: string[]) {
7-
images.forEach(this.alreadyExistedImages.add)
7+
images.forEach(image => this.alreadyExistedImages.add(image))
88
}
99

1010
async getExistingImages(): Promise<string[]> {
1111
const ids = (await exec.exec(`docker image ls -q`, [], { silent: true })).stdoutStr.split(`\n`).filter(id => id !== ``)
1212
const repotags = (await exec.exec(`sh -c "docker image ls --all --format '{{ .Repository }}:{{ .Tag }}'"`, [], { silent: false })).stdoutStr.split(`\n`).filter(id => id !== `` || !id.includes(`<node>`));
13-
([...ids, ...repotags]).forEach(this.existingImages.add)
13+
([...ids, ...repotags]).forEach(image => this.existingImages.add(image))
1414
return Array.from(this.existingImages)
1515
}
1616

1717
getImagesShouldSave(): string[] {
1818
const resultSet = new Set(this.existingImages.values())
19-
this.alreadyExistedImages.forEach(resultSet.delete)
19+
this.alreadyExistedImages.forEach(image => resultSet.delete(image))
2020
return Array.from(resultSet)
2121
}
22-
}
22+
}

0 commit comments

Comments
 (0)