From d806ad5a190ac5fe818e0ee33ea142ac3c060245 Mon Sep 17 00:00:00 2001 From: Yevhenii Babichenko Date: Thu, 6 May 2021 14:36:14 +0300 Subject: [PATCH] do not override existing Cargo.lock --- src/main.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main.ts b/src/main.ts index 220486e..72fbb6e 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,5 +1,6 @@ import * as process from 'process'; import * as os from 'os'; +import * as fs from 'fs'; import * as core from '@actions/core'; import * as github from '@actions/github'; @@ -18,7 +19,9 @@ async function getData(): Promise { const cargo = await Cargo.get(); await cargo.findOrInstall('cargo-audit'); - await cargo.call(['generate-lockfile']); + if (!(await fs.exists('Cargo.lock'))) { + await cargo.call(['generate-lockfile']); + } let stdout = ''; try {