diff --git a/index.js b/index.js index a879755..8e15a02 100644 --- a/index.js +++ b/index.js @@ -153,14 +153,12 @@ try { content.cacheSeconds = parseInt(cacheSeconds); } - let shouldUpdate = true; - // For the POST request, the above content is set as file contents for the // given filename. const request = JSON.stringify({files: {[filename]: {content: JSON.stringify(content)}}}); - if (core.getInput('forceUpdate')) { + if (core.getBooleanInput('forceUpdate')) { updateGist(request); } else { const getGistOptions = { @@ -182,6 +180,8 @@ try { ', status message: ' + oldGist.statusMessage); } + let shouldUpdate = true; + if (oldGist && oldGist.body && oldGist.body.files && oldGist.body.files[filename]) { const oldContent = oldGist.body.files[filename].content;