🔧 Rename updateIfChanged to forceUpdate

This commit is contained in:
Simon Schneegans
2022-10-09 05:48:42 +02:00
parent 8de5789faf
commit 6e5aa605f7
4 changed files with 12 additions and 10 deletions

View File

@@ -20,5 +20,4 @@ jobs:
valColorRange: ${{ env.ANSWER }}
maxColorRange: 100
minColorRange: 0
updateIfChanged: true

View File

@@ -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)

View File

@@ -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:

View File

@@ -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) {