Merge pull request #21 from dawidd6/remove-container

Remove container
This commit is contained in:
Dawid Dziurla 2020-12-09 23:11:59 +01:00 committed by GitHub
commit 27df2d7538
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 0 deletions

View file

@ -15,3 +15,4 @@ inputs:
runs:
using: node12
main: main.js
post: post.js

View file

@ -78,6 +78,7 @@ async function main() {
image,
"sleep", "inf"
])
core.saveState("container", container)
core.endGroup()
core.startGroup("Start container")

21
post.js Normal file
View file

@ -0,0 +1,21 @@
const core = require("@actions/core")
const exec = require("@actions/exec")
async function main() {
try {
const container = core.getState("container")
core.saveState("container", "")
if (container) {
await exec.exec("docker", [
"rm",
"--force",
container
])
}
} catch (error) {
core.setFailed(error.message)
}
}
main()