You've already forked dynamic-badges-action
🔧 Rename updateIfChanged to forceUpdate
This commit is contained in:
1
.github/workflows/badges.yml
vendored
1
.github/workflows/badges.yml
vendored
@@ -20,5 +20,4 @@ jobs:
|
||||
valColorRange: ${{ env.ANSWER }}
|
||||
maxColorRange: 100
|
||||
minColorRange: 0
|
||||
updateIfChanged: true
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
9
index.js
9
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) {
|
||||
|
||||
Reference in New Issue
Block a user