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 }}
|
valColorRange: ${{ env.ANSWER }}
|
||||||
maxColorRange: 100
|
maxColorRange: 100
|
||||||
minColorRange: 0
|
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.
|
`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)
|
### Shields.io Parameters (optional)
|
||||||
|
|
||||||
All these parameters are optional.
|
All these parameters are optional.
|
||||||
@@ -86,7 +93,6 @@ Parameter | Description
|
|||||||
`logoPosition` | The position of the logo.
|
`logoPosition` | The position of the logo.
|
||||||
`style` | The style like "flat" or "social".
|
`style` | The style like "flat" or "social".
|
||||||
`cacheSeconds` | The cache lifetime in seconds (must be greater than 300).
|
`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)
|
### Color Range Parameters (optional)
|
||||||
|
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ inputs:
|
|||||||
message:
|
message:
|
||||||
description: 'The right text of the badge'
|
description: 'The right text of the badge'
|
||||||
required: true
|
required: true
|
||||||
updateIfChanged:
|
forceUpdate:
|
||||||
description: 'If true will update the gist only if content changed'
|
description: 'If set to true, the gist will be updated even if the content did not change'
|
||||||
default: 'false'
|
default: 'false'
|
||||||
required: false
|
required: false
|
||||||
labelColor:
|
labelColor:
|
||||||
|
|||||||
9
index.js
9
index.js
@@ -64,8 +64,6 @@ try {
|
|||||||
message: core.getInput('message')
|
message: core.getInput('message')
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateIfChanged = core.getInput('updateIfChanged');
|
|
||||||
|
|
||||||
// Compute the message color based on the given inputs.
|
// Compute the message color based on the given inputs.
|
||||||
const color = core.getInput('color');
|
const color = core.getInput('color');
|
||||||
const valColorRange = core.getInput('valColorRange');
|
const valColorRange = core.getInput('valColorRange');
|
||||||
@@ -162,7 +160,9 @@ try {
|
|||||||
const request =
|
const request =
|
||||||
JSON.stringify({files: {[filename]: {content: JSON.stringify(content)}}});
|
JSON.stringify({files: {[filename]: {content: JSON.stringify(content)}}});
|
||||||
|
|
||||||
if (updateIfChanged == 'true') {
|
if (core.getInput('forceUpdate')) {
|
||||||
|
updateGist(request);
|
||||||
|
} else {
|
||||||
const getGistOptions = {
|
const getGistOptions = {
|
||||||
host: 'api.github.com',
|
host: 'api.github.com',
|
||||||
path: '/gists/' + core.getInput('gistID'),
|
path: '/gists/' + core.getInput('gistID'),
|
||||||
@@ -203,9 +203,6 @@ try {
|
|||||||
updateGist(request);
|
updateGist(request);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
|
||||||
updateGist(request);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user