From 6e5aa605f7aad08ca273dd783c663db0b43c5795 Mon Sep 17 00:00:00 2001 From: Simon Schneegans Date: Sun, 9 Oct 2022 05:48:42 +0200 Subject: [PATCH] :wrench: Rename updateIfChanged to forceUpdate --- .github/workflows/badges.yml | 1 - README.md | 8 +++++++- action.yml | 4 ++-- index.js | 9 +++------ 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.github/workflows/badges.yml b/.github/workflows/badges.yml index 30e49ff..697a4b5 100644 --- a/.github/workflows/badges.yml +++ b/.github/workflows/badges.yml @@ -20,5 +20,4 @@ jobs: valColorRange: ${{ env.ANSWER }} maxColorRange: 100 minColorRange: 0 - updateIfChanged: true diff --git a/README.md b/README.md index 1f52652..21a8145 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,13 @@ Parameter | Description `filename` | The target filename - each gist may contain several files. This should have the `.json` extension. +### Optional Input Parameters + +Parameter | Description +----------|------------ +`forceUpdate` | Default is `false`. If set to `true`, the gist will be updated even if the content did not change. + + ### Shields.io Parameters (optional) All these parameters are optional. @@ -86,7 +93,6 @@ Parameter | Description `logoPosition` | The position of the logo. `style` | The style like "flat" or "social". `cacheSeconds` | The cache lifetime in seconds (must be greater than 300). -`updateIfChanged` | Default is `false`. If `true` will update the gist only if content changed. ### Color Range Parameters (optional) diff --git a/action.yml b/action.yml index 44bb212..61fb1e2 100644 --- a/action.yml +++ b/action.yml @@ -19,8 +19,8 @@ inputs: message: description: 'The right text of the badge' required: true - updateIfChanged: - description: 'If true will update the gist only if content changed' + forceUpdate: + description: 'If set to true, the gist will be updated even if the content did not change' default: 'false' required: false labelColor: diff --git a/index.js b/index.js index 3317b02..a879755 100644 --- a/index.js +++ b/index.js @@ -64,8 +64,6 @@ try { message: core.getInput('message') }; - const updateIfChanged = core.getInput('updateIfChanged'); - // Compute the message color based on the given inputs. const color = core.getInput('color'); const valColorRange = core.getInput('valColorRange'); @@ -162,7 +160,9 @@ try { const request = JSON.stringify({files: {[filename]: {content: JSON.stringify(content)}}}); - if (updateIfChanged == 'true') { + if (core.getInput('forceUpdate')) { + updateGist(request); + } else { const getGistOptions = { host: 'api.github.com', path: '/gists/' + core.getInput('gistID'), @@ -203,9 +203,6 @@ try { updateGist(request); } }); - - } else { - updateGist(request); } } catch (error) {