Skip to content

Commit

Permalink
Merge pull request #2 from steffendietz/tests-and-upgrades
Browse files Browse the repository at this point in the history
updated packages
  • Loading branch information
steffendietz authored Oct 3, 2022
2 parents cbd9a7b + e77c392 commit dc9c53b
Show file tree
Hide file tree
Showing 10 changed files with 7,023 additions and 298 deletions.
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
.devcontainer
node_modules
clover.xml
shieldsio.json
node_modules
19 changes: 14 additions & 5 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,43 @@ inputs:
required: true
default: 'shieldsio.json'
label-text:
description: 'The left text of the badge; empty to omit left side'
description: 'The left text of the badge; leave empty to omit left side'
required: false
default: 'coverage'
style:
description: 'The badge style'
required: false
default: 'flat'
bad-threshold:
description: 'Below this coverage percent, the color will be bad-color'
default: 50
required: false
default: '50'
average-threshold:
description: 'Below this coverage percent, the color will be average-color'
default: 75
required: false
default: '75'
above-average-threshold:
description: 'Below this coverage percent, the color will be above-average-color'
default: 95
required: false
default: '95'
bad-color:
description: 'The color used for bad code coverage'
required: false
default: 'red'
average-color:
description: 'The color used for average code coverage'
required: false
default: 'yellow'
above-average-color:
description: 'The color used for above average code coverage'
required: false
default: 'green'
good-color:
description: 'The color used for good code coverage'
required: false
default: 'brightgreen'
runs:
using: 'node12'
using: 'node16'
main: 'dist/index.js'
branding:
icon: 'umbrella'
Expand Down
4 changes: 2 additions & 2 deletions dist/index.js

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions dist/licenses.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,19 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.


uuid
MIT
The MIT License (MIT)

Copyright (c) 2010-2020 Robert Kieffer and other contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


xml-js
MIT
The MIT License (MIT)
Expand Down
7 changes: 3 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,13 @@ try {
schemaVersion: 1,
label: labelText,
message: codeCoveragePercent + '%',
"color": color,
color,
// this is here so that the color can not be overridden
isError: true,
style: style
style
}

storeData(shieldsIoBadge, preparePath(pathToShieldsIoJson))

console.log(shieldsIoBadge);
} catch (error) {
core.setFailed(error.message);
}
18 changes: 18 additions & 0 deletions index.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const ghrun = require('github-action-ts-run-api');
const fs = require('fs');

test('test creation of sieldsio.json', async () => {
// RunTarget.preJsScript() and RunTarget.postJsScript() are also available
const target = ghrun.RunTarget.jsFile('index.js', 'action.yml');
const options = ghrun.RunOptions.create()
// Internally, runner will fake a json file to be picked by @actions/github
.setGithubContext({ payload: { pull_request: { number: 123 } } })
.setWorkspaceDir('tests');

const res = await target.run(options);

let rawdata = fs.readFileSync('tests/shieldsio.json');
let shieldsio = JSON.parse(rawdata);

expect(shieldsio).toHaveProperty('message', '91.23%');
});
Loading

0 comments on commit dc9c53b

Please sign in to comment.