├── .gitignore ├── LICENSE.md ├── README.md ├── action.yml ├── comment.png ├── dist ├── index.js └── licenses.txt ├── docs └── ember.md ├── package-lock.json ├── package.json └── src ├── badge.js ├── branch.js ├── comment.js ├── diff.js ├── git.js ├── index.js └── math.js /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules/ 2 | /*.log 3 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2022 Guillaume Gérard 4 | 5 | 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: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | 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. 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GitHub Action: Coverage Diff 2 | 3 | [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) 4 | [![Liberapay](https://img.shields.io/liberapay/patrons/GreatWizard.svg?logo=liberapay)](https://liberapay.com/GreatWizard/) 5 | 6 | ## Presentation 7 | 8 | Publish diff coverage report as PR comment, and create a coverage badge to display on the readme. 9 | 10 | ![Comment screenshot](https://raw.githubusercontent.com/GreatWizard/coverage-diff-action/master/comment.png) 11 | 12 | This action operates on a json-summary report file as generated by most coverage tools. 13 | 14 | It has two main modes of operation: 15 | 16 | ### PR mode 17 | 18 | If acting on a PR, it will analyze the json-summary report file (`coverage/coverage-summary.json`), and produce a diff coverage report with the json-summary file from repository's default branch. 19 | Then it will publish the diff coverage report as comment to the PR. 20 | If a comment had already previously be written, it will be updated. 21 | The comment contains information on the evolution of coverage rate attributed to this PR, as well as the rate of coverage for lines that this PR introduces. 22 | 23 | ### Default branch mode 24 | 25 | If acting on the repository's default branch (by convention `master` or `main`), it will extract the global threshold and create a small Badge JSON file. 26 | The json-summary report file and the Badge JSON file will be stored on the repository's wiki. 27 | This file will then have a stable URL, which means you can create a [shields.io](https://shields.io/endpoint) badge from it. 28 | 29 | ## Usage 30 | 31 | ### Setup 32 | 33 | Please ensure that the **repository wiki has been initialized** with at least a single page created. 34 | Once it's done, you can disable the wiki for the repository. 35 | 36 | ### Minimal usage 37 | 38 | ```yaml 39 | name: Coverage Diff 40 | 41 | on: 42 | push: 43 | branches: 44 | - master 45 | - main 46 | pull_request: {} 47 | 48 | jobs: 49 | test: 50 | name: Coverage Diff 51 | runs-on: ubuntu-latest 52 | 53 | steps: 54 | - uses: actions/checkout@v2 55 | - uses: actions/setup-node@v2 56 | with: 57 | node-version: 16 58 | cache: npm 59 | - run: npm install 60 | - run: npm run test 61 | - name: Coverage Diff 62 | uses: greatwizard/coverage-diff-action@v1 63 | with: 64 | github-token: ${{ secrets.GITHUB_TOKEN }} 65 | ``` 66 | 67 | ### Maximal usage 68 | 69 | ```yaml 70 | name: Coverage Diff 71 | 72 | on: 73 | push: 74 | branches: 75 | - master 76 | - main 77 | pull_request: {} 78 | 79 | jobs: 80 | test: 81 | name: Coverage Diff 82 | runs-on: ubuntu-latest 83 | 84 | steps: 85 | - uses: actions/checkout@v2 86 | - uses: actions/setup-node@v2 87 | with: 88 | node-version: 16 89 | cache: npm 90 | - run: npm install 91 | - run: npm run test 92 | - name: Coverage Diff 93 | uses: greatwizard/coverage-diff-action@v1 94 | with: 95 | github-token: ${{ secrets.GITHUB_TOKEN }} 96 | 97 | # Path of the json-summary file to analyze. 98 | coverage-filename: coverage/coverage-summary.json 99 | 100 | # Name of the json file containing the repository's default branch json-summary stored in the repo wiki. 101 | base-summary-filename: base-summary.json 102 | 103 | # If true, it will not fail even if the current branch's coverage is lower than the default branch's coverage. 104 | allowed-to-fail: false 105 | 106 | # Whether or not a badge will be generated and stored. 107 | badge-enabled: true 108 | 109 | # Name of the json file containing badge informations stored in the repo wiki. 110 | badge-filename: coverage-diff-badge.json 111 | 112 | # If the coverage percentage is above or equal to this value, the badge will be green. 113 | badge-threshold-green: 100 114 | 115 | # If the coverage percentage is not green and above or equal to this value, the badge will be orange. Otherwise it will be red. 116 | badge-threshold-orange: 70 117 | ``` 118 | 119 | ### Pinning 120 | 121 | On the examples above, the version was set to `v1` (a branch). 122 | You can also pin a specific version such as `v1.0.0` (a tag). 123 | 124 | ### What about external pull requests 125 | 126 | Currently this action fails for external pull requests. 127 | The problem is described [here](https://github.blog/changelog/2021-02-19-github-actions-workflows-triggered-by-dependabot-prs-will-run-with-read-only-permissions/) 128 | and [here](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/). 129 | 130 | ### Note on the state of this action 131 | 132 | There is no automated test so it's possible that it fails at some point if a dependency breaks compatibility. 133 | If this happens, we'll fix it and put better checks in place. 134 | 135 | It's probably usable as-is, but you're welcome to offer feedback and, if you want, contributions. 136 | 137 | ## Integration in major frameworks 138 | 139 | `coverage-diff-action` operates on a report file. This report file is supposed to have been generated by a coverage tool launched in the Github workflow. In other words, using `coverage-diff-action` implies that you already have a functional coverage generation present in your workflow. 140 | 141 | If you don't have this yet, this section will provide you some guidance depending on the framework you use. 142 | 143 | Set up code coverage with: 144 | - [Ember](/docs/ember.md) 145 | 146 | ## Contributing 147 | 148 | If you want to help, please get in touch (open an issue or something). 149 | 150 | ## License 151 | 152 | This project is licensed under the [MIT License](LICENSE.md). 153 | 154 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: Coverage Diff 2 | branding: 3 | icon: umbrella 4 | color: green 5 | description: Publish diff coverage report as PR comment, and create a coverage badge to display on the readme. 6 | inputs: 7 | github-token: 8 | description: A GitHub token to write comments and write the badge to the wiki. 9 | required: true 10 | coverage-filename: 11 | description: Path of the json-summary file to analyze. 12 | default: coverage/coverage-summary.json 13 | required: false 14 | base-summary-filename: 15 | description: Name of the json file containing the repository's default branch json-summary stored in the repo wiki. 16 | default: base-summary.json 17 | required: false 18 | allowed-to-fail: 19 | description: If true, it will not fail even if the current branch's coverage is lower than the default branch's coverage. 20 | default: "false" 21 | required: false 22 | badge-enabled: 23 | description: Whether or not a badge will be generated and stored. 24 | default: "true" 25 | required: false 26 | badge-filename: 27 | description: Name of the json file containing badge informations stored in the repo wiki. 28 | default: coverage-diff-badge.json 29 | required: false 30 | badge-threshold-green: 31 | description: If the coverage percentage is above or equal to this value, the badge will be green. 32 | default: "100" 33 | required: false 34 | badge-threshold-orange: 35 | description: If the coverage percentage is not green and above or equal to this value, the badge will be orange. Otherwise it will be red. 36 | default: "70" 37 | required: false 38 | runs: 39 | using: node16 40 | main: dist/index.js 41 | -------------------------------------------------------------------------------- /comment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreatWizard/coverage-diff-action/dfefb6335458e4936d7a688a51ff7d34bf7b97e4/comment.png -------------------------------------------------------------------------------- /dist/licenses.txt: -------------------------------------------------------------------------------- 1 | @actions/core 2 | MIT 3 | The MIT License (MIT) 4 | 5 | Copyright 2019 GitHub 6 | 7 | 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: 8 | 9 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 10 | 11 | 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. 12 | 13 | @actions/github 14 | MIT 15 | The MIT License (MIT) 16 | 17 | Copyright 2019 GitHub 18 | 19 | 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: 20 | 21 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 22 | 23 | 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. 24 | 25 | @actions/http-client 26 | MIT 27 | Actions Http Client for Node.js 28 | 29 | Copyright (c) GitHub, Inc. 30 | 31 | All rights reserved. 32 | 33 | MIT License 34 | 35 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and 36 | associated documentation files (the "Software"), to deal in the Software without restriction, 37 | including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 38 | and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 39 | subject to the following conditions: 40 | 41 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 42 | 43 | THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT 44 | LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 45 | NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 46 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 47 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 48 | 49 | 50 | @kwsites/file-exists 51 | MIT 52 | The MIT License (MIT) 53 | 54 | Copyright (c) 2015 Steve King 55 | 56 | Permission is hereby granted, free of charge, to any person obtaining a copy of 57 | this software and associated documentation files (the "Software"), to deal in 58 | the Software without restriction, including without limitation the rights to 59 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 60 | the Software, and to permit persons to whom the Software is furnished to do so, 61 | subject to the following conditions: 62 | 63 | The above copyright notice and this permission notice shall be included in all 64 | copies or substantial portions of the Software. 65 | 66 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 67 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 68 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 69 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 70 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 71 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 72 | 73 | 74 | @kwsites/promise-deferred 75 | MIT 76 | MIT License 77 | 78 | Copyright (c) 2018 kwsites 79 | 80 | Permission is hereby granted, free of charge, to any person obtaining a copy 81 | of this software and associated documentation files (the "Software"), to deal 82 | in the Software without restriction, including without limitation the rights 83 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 84 | copies of the Software, and to permit persons to whom the Software is 85 | furnished to do so, subject to the following conditions: 86 | 87 | The above copyright notice and this permission notice shall be included in all 88 | copies or substantial portions of the Software. 89 | 90 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 91 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 92 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 93 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 94 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 95 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 96 | SOFTWARE. 97 | 98 | 99 | @octokit/auth-token 100 | MIT 101 | The MIT License 102 | 103 | Copyright (c) 2019 Octokit contributors 104 | 105 | Permission is hereby granted, free of charge, to any person obtaining a copy 106 | of this software and associated documentation files (the "Software"), to deal 107 | in the Software without restriction, including without limitation the rights 108 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 109 | copies of the Software, and to permit persons to whom the Software is 110 | furnished to do so, subject to the following conditions: 111 | 112 | The above copyright notice and this permission notice shall be included in 113 | all copies or substantial portions of the Software. 114 | 115 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 116 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 117 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 118 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 119 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 120 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 121 | THE SOFTWARE. 122 | 123 | 124 | @octokit/core 125 | MIT 126 | The MIT License 127 | 128 | Copyright (c) 2019 Octokit contributors 129 | 130 | Permission is hereby granted, free of charge, to any person obtaining a copy 131 | of this software and associated documentation files (the "Software"), to deal 132 | in the Software without restriction, including without limitation the rights 133 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 134 | copies of the Software, and to permit persons to whom the Software is 135 | furnished to do so, subject to the following conditions: 136 | 137 | The above copyright notice and this permission notice shall be included in 138 | all copies or substantial portions of the Software. 139 | 140 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 141 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 142 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 143 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 144 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 145 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 146 | THE SOFTWARE. 147 | 148 | 149 | @octokit/endpoint 150 | MIT 151 | The MIT License 152 | 153 | Copyright (c) 2018 Octokit contributors 154 | 155 | Permission is hereby granted, free of charge, to any person obtaining a copy 156 | of this software and associated documentation files (the "Software"), to deal 157 | in the Software without restriction, including without limitation the rights 158 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 159 | copies of the Software, and to permit persons to whom the Software is 160 | furnished to do so, subject to the following conditions: 161 | 162 | The above copyright notice and this permission notice shall be included in 163 | all copies or substantial portions of the Software. 164 | 165 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 166 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 167 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 168 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 169 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 170 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 171 | THE SOFTWARE. 172 | 173 | 174 | @octokit/graphql 175 | MIT 176 | The MIT License 177 | 178 | Copyright (c) 2018 Octokit contributors 179 | 180 | Permission is hereby granted, free of charge, to any person obtaining a copy 181 | of this software and associated documentation files (the "Software"), to deal 182 | in the Software without restriction, including without limitation the rights 183 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 184 | copies of the Software, and to permit persons to whom the Software is 185 | furnished to do so, subject to the following conditions: 186 | 187 | The above copyright notice and this permission notice shall be included in 188 | all copies or substantial portions of the Software. 189 | 190 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 191 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 192 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 193 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 194 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 195 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 196 | THE SOFTWARE. 197 | 198 | 199 | @octokit/plugin-paginate-rest 200 | MIT 201 | MIT License Copyright (c) 2019 Octokit contributors 202 | 203 | 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: 204 | 205 | The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. 206 | 207 | 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. 208 | 209 | 210 | @octokit/plugin-rest-endpoint-methods 211 | MIT 212 | MIT License Copyright (c) 2019 Octokit contributors 213 | 214 | 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: 215 | 216 | The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. 217 | 218 | 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. 219 | 220 | 221 | @octokit/request 222 | MIT 223 | The MIT License 224 | 225 | Copyright (c) 2018 Octokit contributors 226 | 227 | Permission is hereby granted, free of charge, to any person obtaining a copy 228 | of this software and associated documentation files (the "Software"), to deal 229 | in the Software without restriction, including without limitation the rights 230 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 231 | copies of the Software, and to permit persons to whom the Software is 232 | furnished to do so, subject to the following conditions: 233 | 234 | The above copyright notice and this permission notice shall be included in 235 | all copies or substantial portions of the Software. 236 | 237 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 238 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 239 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 240 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 241 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 242 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 243 | THE SOFTWARE. 244 | 245 | 246 | @octokit/request-error 247 | MIT 248 | The MIT License 249 | 250 | Copyright (c) 2019 Octokit contributors 251 | 252 | Permission is hereby granted, free of charge, to any person obtaining a copy 253 | of this software and associated documentation files (the "Software"), to deal 254 | in the Software without restriction, including without limitation the rights 255 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 256 | copies of the Software, and to permit persons to whom the Software is 257 | furnished to do so, subject to the following conditions: 258 | 259 | The above copyright notice and this permission notice shall be included in 260 | all copies or substantial portions of the Software. 261 | 262 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 263 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 264 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 265 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 266 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 267 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 268 | THE SOFTWARE. 269 | 270 | 271 | @vercel/ncc 272 | MIT 273 | Copyright 2018 ZEIT, Inc. 274 | 275 | 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: 276 | 277 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 278 | 279 | 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. 280 | 281 | before-after-hook 282 | Apache-2.0 283 | Apache License 284 | Version 2.0, January 2004 285 | http://www.apache.org/licenses/ 286 | 287 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 288 | 289 | 1. Definitions. 290 | 291 | "License" shall mean the terms and conditions for use, reproduction, 292 | and distribution as defined by Sections 1 through 9 of this document. 293 | 294 | "Licensor" shall mean the copyright owner or entity authorized by 295 | the copyright owner that is granting the License. 296 | 297 | "Legal Entity" shall mean the union of the acting entity and all 298 | other entities that control, are controlled by, or are under common 299 | control with that entity. For the purposes of this definition, 300 | "control" means (i) the power, direct or indirect, to cause the 301 | direction or management of such entity, whether by contract or 302 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 303 | outstanding shares, or (iii) beneficial ownership of such entity. 304 | 305 | "You" (or "Your") shall mean an individual or Legal Entity 306 | exercising permissions granted by this License. 307 | 308 | "Source" form shall mean the preferred form for making modifications, 309 | including but not limited to software source code, documentation 310 | source, and configuration files. 311 | 312 | "Object" form shall mean any form resulting from mechanical 313 | transformation or translation of a Source form, including but 314 | not limited to compiled object code, generated documentation, 315 | and conversions to other media types. 316 | 317 | "Work" shall mean the work of authorship, whether in Source or 318 | Object form, made available under the License, as indicated by a 319 | copyright notice that is included in or attached to the work 320 | (an example is provided in the Appendix below). 321 | 322 | "Derivative Works" shall mean any work, whether in Source or Object 323 | form, that is based on (or derived from) the Work and for which the 324 | editorial revisions, annotations, elaborations, or other modifications 325 | represent, as a whole, an original work of authorship. For the purposes 326 | of this License, Derivative Works shall not include works that remain 327 | separable from, or merely link (or bind by name) to the interfaces of, 328 | the Work and Derivative Works thereof. 329 | 330 | "Contribution" shall mean any work of authorship, including 331 | the original version of the Work and any modifications or additions 332 | to that Work or Derivative Works thereof, that is intentionally 333 | submitted to Licensor for inclusion in the Work by the copyright owner 334 | or by an individual or Legal Entity authorized to submit on behalf of 335 | the copyright owner. For the purposes of this definition, "submitted" 336 | means any form of electronic, verbal, or written communication sent 337 | to the Licensor or its representatives, including but not limited to 338 | communication on electronic mailing lists, source code control systems, 339 | and issue tracking systems that are managed by, or on behalf of, the 340 | Licensor for the purpose of discussing and improving the Work, but 341 | excluding communication that is conspicuously marked or otherwise 342 | designated in writing by the copyright owner as "Not a Contribution." 343 | 344 | "Contributor" shall mean Licensor and any individual or Legal Entity 345 | on behalf of whom a Contribution has been received by Licensor and 346 | subsequently incorporated within the Work. 347 | 348 | 2. Grant of Copyright License. Subject to the terms and conditions of 349 | this License, each Contributor hereby grants to You a perpetual, 350 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 351 | copyright license to reproduce, prepare Derivative Works of, 352 | publicly display, publicly perform, sublicense, and distribute the 353 | Work and such Derivative Works in Source or Object form. 354 | 355 | 3. Grant of Patent License. Subject to the terms and conditions of 356 | this License, each Contributor hereby grants to You a perpetual, 357 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 358 | (except as stated in this section) patent license to make, have made, 359 | use, offer to sell, sell, import, and otherwise transfer the Work, 360 | where such license applies only to those patent claims licensable 361 | by such Contributor that are necessarily infringed by their 362 | Contribution(s) alone or by combination of their Contribution(s) 363 | with the Work to which such Contribution(s) was submitted. If You 364 | institute patent litigation against any entity (including a 365 | cross-claim or counterclaim in a lawsuit) alleging that the Work 366 | or a Contribution incorporated within the Work constitutes direct 367 | or contributory patent infringement, then any patent licenses 368 | granted to You under this License for that Work shall terminate 369 | as of the date such litigation is filed. 370 | 371 | 4. Redistribution. You may reproduce and distribute copies of the 372 | Work or Derivative Works thereof in any medium, with or without 373 | modifications, and in Source or Object form, provided that You 374 | meet the following conditions: 375 | 376 | (a) You must give any other recipients of the Work or 377 | Derivative Works a copy of this License; and 378 | 379 | (b) You must cause any modified files to carry prominent notices 380 | stating that You changed the files; and 381 | 382 | (c) You must retain, in the Source form of any Derivative Works 383 | that You distribute, all copyright, patent, trademark, and 384 | attribution notices from the Source form of the Work, 385 | excluding those notices that do not pertain to any part of 386 | the Derivative Works; and 387 | 388 | (d) If the Work includes a "NOTICE" text file as part of its 389 | distribution, then any Derivative Works that You distribute must 390 | include a readable copy of the attribution notices contained 391 | within such NOTICE file, excluding those notices that do not 392 | pertain to any part of the Derivative Works, in at least one 393 | of the following places: within a NOTICE text file distributed 394 | as part of the Derivative Works; within the Source form or 395 | documentation, if provided along with the Derivative Works; or, 396 | within a display generated by the Derivative Works, if and 397 | wherever such third-party notices normally appear. The contents 398 | of the NOTICE file are for informational purposes only and 399 | do not modify the License. You may add Your own attribution 400 | notices within Derivative Works that You distribute, alongside 401 | or as an addendum to the NOTICE text from the Work, provided 402 | that such additional attribution notices cannot be construed 403 | as modifying the License. 404 | 405 | You may add Your own copyright statement to Your modifications and 406 | may provide additional or different license terms and conditions 407 | for use, reproduction, or distribution of Your modifications, or 408 | for any such Derivative Works as a whole, provided Your use, 409 | reproduction, and distribution of the Work otherwise complies with 410 | the conditions stated in this License. 411 | 412 | 5. Submission of Contributions. Unless You explicitly state otherwise, 413 | any Contribution intentionally submitted for inclusion in the Work 414 | by You to the Licensor shall be under the terms and conditions of 415 | this License, without any additional terms or conditions. 416 | Notwithstanding the above, nothing herein shall supersede or modify 417 | the terms of any separate license agreement you may have executed 418 | with Licensor regarding such Contributions. 419 | 420 | 6. Trademarks. This License does not grant permission to use the trade 421 | names, trademarks, service marks, or product names of the Licensor, 422 | except as required for reasonable and customary use in describing the 423 | origin of the Work and reproducing the content of the NOTICE file. 424 | 425 | 7. Disclaimer of Warranty. Unless required by applicable law or 426 | agreed to in writing, Licensor provides the Work (and each 427 | Contributor provides its Contributions) on an "AS IS" BASIS, 428 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 429 | implied, including, without limitation, any warranties or conditions 430 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 431 | PARTICULAR PURPOSE. You are solely responsible for determining the 432 | appropriateness of using or redistributing the Work and assume any 433 | risks associated with Your exercise of permissions under this License. 434 | 435 | 8. Limitation of Liability. In no event and under no legal theory, 436 | whether in tort (including negligence), contract, or otherwise, 437 | unless required by applicable law (such as deliberate and grossly 438 | negligent acts) or agreed to in writing, shall any Contributor be 439 | liable to You for damages, including any direct, indirect, special, 440 | incidental, or consequential damages of any character arising as a 441 | result of this License or out of the use or inability to use the 442 | Work (including but not limited to damages for loss of goodwill, 443 | work stoppage, computer failure or malfunction, or any and all 444 | other commercial damages or losses), even if such Contributor 445 | has been advised of the possibility of such damages. 446 | 447 | 9. Accepting Warranty or Additional Liability. While redistributing 448 | the Work or Derivative Works thereof, You may choose to offer, 449 | and charge a fee for, acceptance of support, warranty, indemnity, 450 | or other liability obligations and/or rights consistent with this 451 | License. However, in accepting such obligations, You may act only 452 | on Your own behalf and on Your sole responsibility, not on behalf 453 | of any other Contributor, and only if You agree to indemnify, 454 | defend, and hold each Contributor harmless for any liability 455 | incurred by, or claims asserted against, such Contributor by reason 456 | of your accepting any such warranty or additional liability. 457 | 458 | END OF TERMS AND CONDITIONS 459 | 460 | APPENDIX: How to apply the Apache License to your work. 461 | 462 | To apply the Apache License to your work, attach the following 463 | boilerplate notice, with the fields enclosed by brackets "{}" 464 | replaced with your own identifying information. (Don't include 465 | the brackets!) The text should be enclosed in the appropriate 466 | comment syntax for the file format. We also recommend that a 467 | file or class name and description of purpose be included on the 468 | same "printed page" as the copyright notice for easier 469 | identification within third-party archives. 470 | 471 | Copyright 2018 Gregor Martynus and other contributors. 472 | 473 | Licensed under the Apache License, Version 2.0 (the "License"); 474 | you may not use this file except in compliance with the License. 475 | You may obtain a copy of the License at 476 | 477 | http://www.apache.org/licenses/LICENSE-2.0 478 | 479 | Unless required by applicable law or agreed to in writing, software 480 | distributed under the License is distributed on an "AS IS" BASIS, 481 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 482 | See the License for the specific language governing permissions and 483 | limitations under the License. 484 | 485 | 486 | coverage-diff 487 | MIT 488 | MIT License 489 | 490 | Copyright (c) 2018 Flavius Tirnacop 491 | 492 | Permission is hereby granted, free of charge, to any person obtaining a copy 493 | of this software and associated documentation files (the "Software"), to deal 494 | in the Software without restriction, including without limitation the rights 495 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 496 | copies of the Software, and to permit persons to whom the Software is 497 | furnished to do so, subject to the following conditions: 498 | 499 | The above copyright notice and this permission notice shall be included in all 500 | copies or substantial portions of the Software. 501 | 502 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 503 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 504 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 505 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 506 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 507 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 508 | SOFTWARE. 509 | 510 | 511 | debug 512 | MIT 513 | (The MIT License) 514 | 515 | Copyright (c) 2014-2017 TJ Holowaychuk 516 | Copyright (c) 2018-2021 Josh Junon 517 | 518 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software 519 | and associated documentation files (the 'Software'), to deal in the Software without restriction, 520 | including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 521 | and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 522 | subject to the following conditions: 523 | 524 | The above copyright notice and this permission notice shall be included in all copies or substantial 525 | portions of the Software. 526 | 527 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT 528 | LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 529 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 530 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 531 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 532 | 533 | 534 | 535 | deprecation 536 | ISC 537 | The ISC License 538 | 539 | Copyright (c) Gregor Martynus and contributors 540 | 541 | Permission to use, copy, modify, and/or distribute this software for any 542 | purpose with or without fee is hereby granted, provided that the above 543 | copyright notice and this permission notice appear in all copies. 544 | 545 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 546 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 547 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 548 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 549 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 550 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 551 | IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 552 | 553 | 554 | is-plain-object 555 | MIT 556 | The MIT License (MIT) 557 | 558 | Copyright (c) 2014-2017, Jon Schlinkert. 559 | 560 | Permission is hereby granted, free of charge, to any person obtaining a copy 561 | of this software and associated documentation files (the "Software"), to deal 562 | in the Software without restriction, including without limitation the rights 563 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 564 | copies of the Software, and to permit persons to whom the Software is 565 | furnished to do so, subject to the following conditions: 566 | 567 | The above copyright notice and this permission notice shall be included in 568 | all copies or substantial portions of the Software. 569 | 570 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 571 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 572 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 573 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 574 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 575 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 576 | THE SOFTWARE. 577 | 578 | 579 | markdown-table 580 | MIT 581 | (The MIT License) 582 | 583 | Copyright (c) 2014 Titus Wormer 584 | 585 | Permission is hereby granted, free of charge, to any person obtaining 586 | a copy of this software and associated documentation files (the 587 | 'Software'), to deal in the Software without restriction, including 588 | without limitation the rights to use, copy, modify, merge, publish, 589 | distribute, sublicense, and/or sell copies of the Software, and to 590 | permit persons to whom the Software is furnished to do so, subject to 591 | the following conditions: 592 | 593 | The above copyright notice and this permission notice shall be 594 | included in all copies or substantial portions of the Software. 595 | 596 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 597 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 598 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 599 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 600 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 601 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 602 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 603 | 604 | 605 | ms 606 | MIT 607 | The MIT License (MIT) 608 | 609 | Copyright (c) 2016 Zeit, Inc. 610 | 611 | Permission is hereby granted, free of charge, to any person obtaining a copy 612 | of this software and associated documentation files (the "Software"), to deal 613 | in the Software without restriction, including without limitation the rights 614 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 615 | copies of the Software, and to permit persons to whom the Software is 616 | furnished to do so, subject to the following conditions: 617 | 618 | The above copyright notice and this permission notice shall be included in all 619 | copies or substantial portions of the Software. 620 | 621 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 622 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 623 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 624 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 625 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 626 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 627 | SOFTWARE. 628 | 629 | 630 | node-fetch 631 | MIT 632 | The MIT License (MIT) 633 | 634 | Copyright (c) 2016 David Frank 635 | 636 | Permission is hereby granted, free of charge, to any person obtaining a copy 637 | of this software and associated documentation files (the "Software"), to deal 638 | in the Software without restriction, including without limitation the rights 639 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 640 | copies of the Software, and to permit persons to whom the Software is 641 | furnished to do so, subject to the following conditions: 642 | 643 | The above copyright notice and this permission notice shall be included in all 644 | copies or substantial portions of the Software. 645 | 646 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 647 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 648 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 649 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 650 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 651 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 652 | SOFTWARE. 653 | 654 | 655 | 656 | once 657 | ISC 658 | The ISC License 659 | 660 | Copyright (c) Isaac Z. Schlueter and Contributors 661 | 662 | Permission to use, copy, modify, and/or distribute this software for any 663 | purpose with or without fee is hereby granted, provided that the above 664 | copyright notice and this permission notice appear in all copies. 665 | 666 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 667 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 668 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 669 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 670 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 671 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 672 | IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 673 | 674 | 675 | simple-git 676 | MIT 677 | The MIT License (MIT) 678 | 679 | Copyright (c) 2022 Steve King 680 | 681 | Permission is hereby granted, free of charge, to any person obtaining a copy of 682 | this software and associated documentation files (the "Software"), to deal in 683 | the Software without restriction, including without limitation the rights to 684 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 685 | the Software, and to permit persons to whom the Software is furnished to do so, 686 | subject to the following conditions: 687 | 688 | The above copyright notice and this permission notice shall be included in all 689 | copies or substantial portions of the Software. 690 | 691 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 692 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 693 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 694 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 695 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 696 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 697 | 698 | 699 | tr46 700 | MIT 701 | 702 | tunnel 703 | MIT 704 | The MIT License (MIT) 705 | 706 | Copyright (c) 2012 Koichi Kobayashi 707 | 708 | Permission is hereby granted, free of charge, to any person obtaining a copy 709 | of this software and associated documentation files (the "Software"), to deal 710 | in the Software without restriction, including without limitation the rights 711 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 712 | copies of the Software, and to permit persons to whom the Software is 713 | furnished to do so, subject to the following conditions: 714 | 715 | The above copyright notice and this permission notice shall be included in 716 | all copies or substantial portions of the Software. 717 | 718 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 719 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 720 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 721 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 722 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 723 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 724 | THE SOFTWARE. 725 | 726 | 727 | universal-user-agent 728 | ISC 729 | # [ISC License](https://spdx.org/licenses/ISC) 730 | 731 | Copyright (c) 2018, Gregor Martynus (https://github.com/gr2m) 732 | 733 | Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. 734 | 735 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 736 | 737 | 738 | webidl-conversions 739 | BSD-2-Clause 740 | # The BSD 2-Clause License 741 | 742 | Copyright (c) 2014, Domenic Denicola 743 | All rights reserved. 744 | 745 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 746 | 747 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 748 | 749 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 750 | 751 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 752 | 753 | 754 | whatwg-url 755 | MIT 756 | The MIT License (MIT) 757 | 758 | Copyright (c) 2015–2016 Sebastian Mayr 759 | 760 | Permission is hereby granted, free of charge, to any person obtaining a copy 761 | of this software and associated documentation files (the "Software"), to deal 762 | in the Software without restriction, including without limitation the rights 763 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 764 | copies of the Software, and to permit persons to whom the Software is 765 | furnished to do so, subject to the following conditions: 766 | 767 | The above copyright notice and this permission notice shall be included in 768 | all copies or substantial portions of the Software. 769 | 770 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 771 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 772 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 773 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 774 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 775 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 776 | THE SOFTWARE. 777 | 778 | 779 | wrappy 780 | ISC 781 | The ISC License 782 | 783 | Copyright (c) Isaac Z. Schlueter and Contributors 784 | 785 | Permission to use, copy, modify, and/or distribute this software for any 786 | purpose with or without fee is hereby granted, provided that the above 787 | copyright notice and this permission notice appear in all copies. 788 | 789 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 790 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 791 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 792 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 793 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 794 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 795 | IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 796 | -------------------------------------------------------------------------------- /docs/ember.md: -------------------------------------------------------------------------------- 1 | # Integration with Ember JS 2 | 3 | ## Install the coverage tool 4 | 5 | Install the addon [`ember-cli-code-coverage`](https://github.com/kategengler/ember-cli-code-coverage): 6 | 7 | ``` 8 | ember install ember-cli-code-coverage 9 | ``` 10 | 11 | ### Refer to the correct README 12 | 13 | You need to follow `ember-cli-code-coverage` README to configure the Ember project. 14 | 15 | ⚠️ But be careful! 16 | 17 | The README of the default branch points to the documentation of `ember-cli-code-coverage` 2.x, which is not released on NPM yet. 2.x requires additional configuration steps that fail on 1.x, and the minimal configuration is slightly different depending on what type of application or addon you are working on. 18 | 19 | If the version you have just installed is **1.x, refer to the README of the corresponding tag**. 20 | 21 | ### Don't forget Mirage 22 | 23 | Read carefully `ember-cli-code-coverage` README. If you use Mirage, there are additional steps to implement in Mirage configuration. This is detailed in the section ["Create a passthrough when intercepting all ajax requests in tests"](https://github.com/kategengler/ember-cli-code-coverage#create-a-passthrough-when-intercepting-all-ajax-requests-in-tests) 24 | 25 | ## Update Github workflow 26 | 27 | Once the coverage is set up, make sure that COVERAGE environment variable is active in the workflow that will call `coverage-diff-action`. 28 | 29 | For instance: 30 | ```diff 31 | - - run: yarn test 32 | + - run: COVERAGE=true yarn test 33 | - name: Coverage Diff 34 | uses: greatwizard/coverage-diff-action@v1 35 | with: 36 | github-token: ${{ secrets.GITHUB_TOKEN }} 37 | ``` -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "coverage-diff-action", 3 | "version": "1.0.8", 4 | "lockfileVersion": 2, 5 | "requires": true, 6 | "packages": { 7 | "": { 8 | "name": "coverage-diff-action", 9 | "version": "1.0.8", 10 | "license": "MIT", 11 | "dependencies": { 12 | "@actions/core": "^1.6.0", 13 | "@actions/github": "^5.0.0", 14 | "coverage-diff": "^1.6.0", 15 | "simple-git": "^3.1.1" 16 | }, 17 | "devDependencies": { 18 | "@vercel/ncc": "^0.33.1" 19 | } 20 | }, 21 | "node_modules/@actions/core": { 22 | "version": "1.6.0", 23 | "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.6.0.tgz", 24 | "integrity": "sha512-NB1UAZomZlCV/LmJqkLhNTqtKfFXJZAUPcfl/zqG7EfsQdeUJtaWO98SGbuQ3pydJ3fHl2CvI/51OKYlCYYcaw==", 25 | "dependencies": { 26 | "@actions/http-client": "^1.0.11" 27 | } 28 | }, 29 | "node_modules/@actions/github": { 30 | "version": "5.0.0", 31 | "resolved": "https://registry.npmjs.org/@actions/github/-/github-5.0.0.tgz", 32 | "integrity": "sha512-QvE9eAAfEsS+yOOk0cylLBIO/d6WyWIOvsxxzdrPFaud39G6BOkUwScXZn1iBzQzHyu9SBkkLSWlohDWdsasAQ==", 33 | "dependencies": { 34 | "@actions/http-client": "^1.0.11", 35 | "@octokit/core": "^3.4.0", 36 | "@octokit/plugin-paginate-rest": "^2.13.3", 37 | "@octokit/plugin-rest-endpoint-methods": "^5.1.1" 38 | } 39 | }, 40 | "node_modules/@actions/http-client": { 41 | "version": "1.0.11", 42 | "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.11.tgz", 43 | "integrity": "sha512-VRYHGQV1rqnROJqdMvGUbY/Kn8vriQe/F9HR2AlYHzmKuM/p3kjNuXhmdBfcVgsvRWTz5C5XW5xvndZrVBuAYg==", 44 | "dependencies": { 45 | "tunnel": "0.0.6" 46 | } 47 | }, 48 | "node_modules/@kwsites/file-exists": { 49 | "version": "1.1.1", 50 | "resolved": "https://registry.npmjs.org/@kwsites/file-exists/-/file-exists-1.1.1.tgz", 51 | "integrity": "sha512-m9/5YGR18lIwxSFDwfE3oA7bWuq9kdau6ugN4H2rJeyhFQZcG9AgSHkQtSD15a8WvTgfz9aikZMrKPHvbpqFiw==", 52 | "dependencies": { 53 | "debug": "^4.1.1" 54 | } 55 | }, 56 | "node_modules/@kwsites/promise-deferred": { 57 | "version": "1.1.1", 58 | "resolved": "https://registry.npmjs.org/@kwsites/promise-deferred/-/promise-deferred-1.1.1.tgz", 59 | "integrity": "sha512-GaHYm+c0O9MjZRu0ongGBRbinu8gVAMd2UZjji6jVmqKtZluZnptXGWhz1E8j8D2HJ3f/yMxKAUC0b+57wncIw==" 60 | }, 61 | "node_modules/@octokit/auth-token": { 62 | "version": "2.5.0", 63 | "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-2.5.0.tgz", 64 | "integrity": "sha512-r5FVUJCOLl19AxiuZD2VRZ/ORjp/4IN98Of6YJoJOkY75CIBuYfmiNHGrDwXr+aLGG55igl9QrxX3hbiXlLb+g==", 65 | "dependencies": { 66 | "@octokit/types": "^6.0.3" 67 | } 68 | }, 69 | "node_modules/@octokit/core": { 70 | "version": "3.5.1", 71 | "resolved": "https://registry.npmjs.org/@octokit/core/-/core-3.5.1.tgz", 72 | "integrity": "sha512-omncwpLVxMP+GLpLPgeGJBF6IWJFjXDS5flY5VbppePYX9XehevbDykRH9PdCdvqt9TS5AOTiDide7h0qrkHjw==", 73 | "dependencies": { 74 | "@octokit/auth-token": "^2.4.4", 75 | "@octokit/graphql": "^4.5.8", 76 | "@octokit/request": "^5.6.0", 77 | "@octokit/request-error": "^2.0.5", 78 | "@octokit/types": "^6.0.3", 79 | "before-after-hook": "^2.2.0", 80 | "universal-user-agent": "^6.0.0" 81 | } 82 | }, 83 | "node_modules/@octokit/endpoint": { 84 | "version": "6.0.12", 85 | "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-6.0.12.tgz", 86 | "integrity": "sha512-lF3puPwkQWGfkMClXb4k/eUT/nZKQfxinRWJrdZaJO85Dqwo/G0yOC434Jr2ojwafWJMYqFGFa5ms4jJUgujdA==", 87 | "dependencies": { 88 | "@octokit/types": "^6.0.3", 89 | "is-plain-object": "^5.0.0", 90 | "universal-user-agent": "^6.0.0" 91 | } 92 | }, 93 | "node_modules/@octokit/graphql": { 94 | "version": "4.8.0", 95 | "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.8.0.tgz", 96 | "integrity": "sha512-0gv+qLSBLKF0z8TKaSKTsS39scVKF9dbMxJpj3U0vC7wjNWFuIpL/z76Qe2fiuCbDRcJSavkXsVtMS6/dtQQsg==", 97 | "dependencies": { 98 | "@octokit/request": "^5.6.0", 99 | "@octokit/types": "^6.0.3", 100 | "universal-user-agent": "^6.0.0" 101 | } 102 | }, 103 | "node_modules/@octokit/openapi-types": { 104 | "version": "11.2.0", 105 | "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-11.2.0.tgz", 106 | "integrity": "sha512-PBsVO+15KSlGmiI8QAzaqvsNlZlrDlyAJYcrXBCvVUxCp7VnXjkwPoFHgjEJXx3WF9BAwkA6nfCUA7i9sODzKA==" 107 | }, 108 | "node_modules/@octokit/plugin-paginate-rest": { 109 | "version": "2.17.0", 110 | "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.17.0.tgz", 111 | "integrity": "sha512-tzMbrbnam2Mt4AhuyCHvpRkS0oZ5MvwwcQPYGtMv4tUa5kkzG58SVB0fcsLulOZQeRnOgdkZWkRUiyBlh0Bkyw==", 112 | "dependencies": { 113 | "@octokit/types": "^6.34.0" 114 | }, 115 | "peerDependencies": { 116 | "@octokit/core": ">=2" 117 | } 118 | }, 119 | "node_modules/@octokit/plugin-rest-endpoint-methods": { 120 | "version": "5.13.0", 121 | "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.13.0.tgz", 122 | "integrity": "sha512-uJjMTkN1KaOIgNtUPMtIXDOjx6dGYysdIFhgA52x4xSadQCz3b/zJexvITDVpANnfKPW/+E0xkOvLntqMYpviA==", 123 | "dependencies": { 124 | "@octokit/types": "^6.34.0", 125 | "deprecation": "^2.3.1" 126 | }, 127 | "peerDependencies": { 128 | "@octokit/core": ">=3" 129 | } 130 | }, 131 | "node_modules/@octokit/request": { 132 | "version": "5.6.3", 133 | "resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.6.3.tgz", 134 | "integrity": "sha512-bFJl0I1KVc9jYTe9tdGGpAMPy32dLBXXo1dS/YwSCTL/2nd9XeHsY616RE3HPXDVk+a+dBuzyz5YdlXwcDTr2A==", 135 | "dependencies": { 136 | "@octokit/endpoint": "^6.0.1", 137 | "@octokit/request-error": "^2.1.0", 138 | "@octokit/types": "^6.16.1", 139 | "is-plain-object": "^5.0.0", 140 | "node-fetch": "^2.6.7", 141 | "universal-user-agent": "^6.0.0" 142 | } 143 | }, 144 | "node_modules/@octokit/request-error": { 145 | "version": "2.1.0", 146 | "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-2.1.0.tgz", 147 | "integrity": "sha512-1VIvgXxs9WHSjicsRwq8PlR2LR2x6DwsJAaFgzdi0JfJoGSO8mYI/cHJQ+9FbN21aa+DrgNLnwObmyeSC8Rmpg==", 148 | "dependencies": { 149 | "@octokit/types": "^6.0.3", 150 | "deprecation": "^2.0.0", 151 | "once": "^1.4.0" 152 | } 153 | }, 154 | "node_modules/@octokit/types": { 155 | "version": "6.34.0", 156 | "resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.34.0.tgz", 157 | "integrity": "sha512-s1zLBjWhdEI2zwaoSgyOFoKSl109CUcVBCc7biPJ3aAf6LGLU6szDvi31JPU7bxfla2lqfhjbbg/5DdFNxOwHw==", 158 | "dependencies": { 159 | "@octokit/openapi-types": "^11.2.0" 160 | } 161 | }, 162 | "node_modules/@vercel/ncc": { 163 | "version": "0.33.1", 164 | "resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.33.1.tgz", 165 | "integrity": "sha512-Mlsps/P0PLZwsCFtSol23FGqT3FhBGb4B1AuGQ52JTAtXhak+b0Fh/4T55r0/SVQPeRiX9pNItOEHwakGPmZYA==", 166 | "dev": true, 167 | "bin": { 168 | "ncc": "dist/ncc/cli.js" 169 | } 170 | }, 171 | "node_modules/before-after-hook": { 172 | "version": "2.2.2", 173 | "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.2.tgz", 174 | "integrity": "sha512-3pZEU3NT5BFUo/AD5ERPWOgQOCZITni6iavr5AUw5AUwQjMlI0kzu5btnyD39AF0gUEsDPwJT+oY1ORBJijPjQ==" 175 | }, 176 | "node_modules/coverage-diff": { 177 | "version": "1.6.0", 178 | "resolved": "https://registry.npmjs.org/coverage-diff/-/coverage-diff-1.6.0.tgz", 179 | "integrity": "sha512-oS/kBlMM3RT6TZHEfHI1Xy5uiyr7jnmluO4Zd47MmjOro42Z+J1n8VgHSINvwDGwDgeok94LyO03iIBfrfuBeg==", 180 | "dependencies": { 181 | "markdown-table": "1.1.1" 182 | } 183 | }, 184 | "node_modules/debug": { 185 | "version": "4.3.3", 186 | "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", 187 | "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", 188 | "dependencies": { 189 | "ms": "2.1.2" 190 | }, 191 | "engines": { 192 | "node": ">=6.0" 193 | }, 194 | "peerDependenciesMeta": { 195 | "supports-color": { 196 | "optional": true 197 | } 198 | } 199 | }, 200 | "node_modules/deprecation": { 201 | "version": "2.3.1", 202 | "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", 203 | "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==" 204 | }, 205 | "node_modules/is-plain-object": { 206 | "version": "5.0.0", 207 | "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz", 208 | "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==", 209 | "engines": { 210 | "node": ">=0.10.0" 211 | } 212 | }, 213 | "node_modules/markdown-table": { 214 | "version": "1.1.1", 215 | "resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-1.1.1.tgz", 216 | "integrity": "sha1-Sz3ToTPRUYuO8NvHCb8qG0gkvIw=" 217 | }, 218 | "node_modules/ms": { 219 | "version": "2.1.2", 220 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", 221 | "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" 222 | }, 223 | "node_modules/node-fetch": { 224 | "version": "2.6.7", 225 | "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", 226 | "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", 227 | "dependencies": { 228 | "whatwg-url": "^5.0.0" 229 | }, 230 | "engines": { 231 | "node": "4.x || >=6.0.0" 232 | }, 233 | "peerDependencies": { 234 | "encoding": "^0.1.0" 235 | }, 236 | "peerDependenciesMeta": { 237 | "encoding": { 238 | "optional": true 239 | } 240 | } 241 | }, 242 | "node_modules/once": { 243 | "version": "1.4.0", 244 | "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", 245 | "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", 246 | "dependencies": { 247 | "wrappy": "1" 248 | } 249 | }, 250 | "node_modules/simple-git": { 251 | "version": "3.1.1", 252 | "resolved": "https://registry.npmjs.org/simple-git/-/simple-git-3.1.1.tgz", 253 | "integrity": "sha512-VamXD/Royf2Xo7s+ASzT9fp2cJatLtz/w8zLwjOLCAq9FC9ks5mEoBUYVwXuDq4GoqDReqV5r/GM+lwx6Jucyw==", 254 | "dependencies": { 255 | "@kwsites/file-exists": "^1.1.1", 256 | "@kwsites/promise-deferred": "^1.1.1", 257 | "debug": "^4.3.3" 258 | }, 259 | "funding": { 260 | "type": "github", 261 | "url": "https://github.com/sponsors/steveukx/" 262 | } 263 | }, 264 | "node_modules/tr46": { 265 | "version": "0.0.3", 266 | "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", 267 | "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=" 268 | }, 269 | "node_modules/tunnel": { 270 | "version": "0.0.6", 271 | "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", 272 | "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==", 273 | "engines": { 274 | "node": ">=0.6.11 <=0.7.0 || >=0.7.3" 275 | } 276 | }, 277 | "node_modules/universal-user-agent": { 278 | "version": "6.0.0", 279 | "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.0.tgz", 280 | "integrity": "sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w==" 281 | }, 282 | "node_modules/webidl-conversions": { 283 | "version": "3.0.1", 284 | "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", 285 | "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=" 286 | }, 287 | "node_modules/whatwg-url": { 288 | "version": "5.0.0", 289 | "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", 290 | "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=", 291 | "dependencies": { 292 | "tr46": "~0.0.3", 293 | "webidl-conversions": "^3.0.0" 294 | } 295 | }, 296 | "node_modules/wrappy": { 297 | "version": "1.0.2", 298 | "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", 299 | "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" 300 | } 301 | }, 302 | "dependencies": { 303 | "@actions/core": { 304 | "version": "1.6.0", 305 | "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.6.0.tgz", 306 | "integrity": "sha512-NB1UAZomZlCV/LmJqkLhNTqtKfFXJZAUPcfl/zqG7EfsQdeUJtaWO98SGbuQ3pydJ3fHl2CvI/51OKYlCYYcaw==", 307 | "requires": { 308 | "@actions/http-client": "^1.0.11" 309 | } 310 | }, 311 | "@actions/github": { 312 | "version": "5.0.0", 313 | "resolved": "https://registry.npmjs.org/@actions/github/-/github-5.0.0.tgz", 314 | "integrity": "sha512-QvE9eAAfEsS+yOOk0cylLBIO/d6WyWIOvsxxzdrPFaud39G6BOkUwScXZn1iBzQzHyu9SBkkLSWlohDWdsasAQ==", 315 | "requires": { 316 | "@actions/http-client": "^1.0.11", 317 | "@octokit/core": "^3.4.0", 318 | "@octokit/plugin-paginate-rest": "^2.13.3", 319 | "@octokit/plugin-rest-endpoint-methods": "^5.1.1" 320 | } 321 | }, 322 | "@actions/http-client": { 323 | "version": "1.0.11", 324 | "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.11.tgz", 325 | "integrity": "sha512-VRYHGQV1rqnROJqdMvGUbY/Kn8vriQe/F9HR2AlYHzmKuM/p3kjNuXhmdBfcVgsvRWTz5C5XW5xvndZrVBuAYg==", 326 | "requires": { 327 | "tunnel": "0.0.6" 328 | } 329 | }, 330 | "@kwsites/file-exists": { 331 | "version": "1.1.1", 332 | "resolved": "https://registry.npmjs.org/@kwsites/file-exists/-/file-exists-1.1.1.tgz", 333 | "integrity": "sha512-m9/5YGR18lIwxSFDwfE3oA7bWuq9kdau6ugN4H2rJeyhFQZcG9AgSHkQtSD15a8WvTgfz9aikZMrKPHvbpqFiw==", 334 | "requires": { 335 | "debug": "^4.1.1" 336 | } 337 | }, 338 | "@kwsites/promise-deferred": { 339 | "version": "1.1.1", 340 | "resolved": "https://registry.npmjs.org/@kwsites/promise-deferred/-/promise-deferred-1.1.1.tgz", 341 | "integrity": "sha512-GaHYm+c0O9MjZRu0ongGBRbinu8gVAMd2UZjji6jVmqKtZluZnptXGWhz1E8j8D2HJ3f/yMxKAUC0b+57wncIw==" 342 | }, 343 | "@octokit/auth-token": { 344 | "version": "2.5.0", 345 | "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-2.5.0.tgz", 346 | "integrity": "sha512-r5FVUJCOLl19AxiuZD2VRZ/ORjp/4IN98Of6YJoJOkY75CIBuYfmiNHGrDwXr+aLGG55igl9QrxX3hbiXlLb+g==", 347 | "requires": { 348 | "@octokit/types": "^6.0.3" 349 | } 350 | }, 351 | "@octokit/core": { 352 | "version": "3.5.1", 353 | "resolved": "https://registry.npmjs.org/@octokit/core/-/core-3.5.1.tgz", 354 | "integrity": "sha512-omncwpLVxMP+GLpLPgeGJBF6IWJFjXDS5flY5VbppePYX9XehevbDykRH9PdCdvqt9TS5AOTiDide7h0qrkHjw==", 355 | "requires": { 356 | "@octokit/auth-token": "^2.4.4", 357 | "@octokit/graphql": "^4.5.8", 358 | "@octokit/request": "^5.6.0", 359 | "@octokit/request-error": "^2.0.5", 360 | "@octokit/types": "^6.0.3", 361 | "before-after-hook": "^2.2.0", 362 | "universal-user-agent": "^6.0.0" 363 | } 364 | }, 365 | "@octokit/endpoint": { 366 | "version": "6.0.12", 367 | "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-6.0.12.tgz", 368 | "integrity": "sha512-lF3puPwkQWGfkMClXb4k/eUT/nZKQfxinRWJrdZaJO85Dqwo/G0yOC434Jr2ojwafWJMYqFGFa5ms4jJUgujdA==", 369 | "requires": { 370 | "@octokit/types": "^6.0.3", 371 | "is-plain-object": "^5.0.0", 372 | "universal-user-agent": "^6.0.0" 373 | } 374 | }, 375 | "@octokit/graphql": { 376 | "version": "4.8.0", 377 | "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.8.0.tgz", 378 | "integrity": "sha512-0gv+qLSBLKF0z8TKaSKTsS39scVKF9dbMxJpj3U0vC7wjNWFuIpL/z76Qe2fiuCbDRcJSavkXsVtMS6/dtQQsg==", 379 | "requires": { 380 | "@octokit/request": "^5.6.0", 381 | "@octokit/types": "^6.0.3", 382 | "universal-user-agent": "^6.0.0" 383 | } 384 | }, 385 | "@octokit/openapi-types": { 386 | "version": "11.2.0", 387 | "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-11.2.0.tgz", 388 | "integrity": "sha512-PBsVO+15KSlGmiI8QAzaqvsNlZlrDlyAJYcrXBCvVUxCp7VnXjkwPoFHgjEJXx3WF9BAwkA6nfCUA7i9sODzKA==" 389 | }, 390 | "@octokit/plugin-paginate-rest": { 391 | "version": "2.17.0", 392 | "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.17.0.tgz", 393 | "integrity": "sha512-tzMbrbnam2Mt4AhuyCHvpRkS0oZ5MvwwcQPYGtMv4tUa5kkzG58SVB0fcsLulOZQeRnOgdkZWkRUiyBlh0Bkyw==", 394 | "requires": { 395 | "@octokit/types": "^6.34.0" 396 | } 397 | }, 398 | "@octokit/plugin-rest-endpoint-methods": { 399 | "version": "5.13.0", 400 | "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.13.0.tgz", 401 | "integrity": "sha512-uJjMTkN1KaOIgNtUPMtIXDOjx6dGYysdIFhgA52x4xSadQCz3b/zJexvITDVpANnfKPW/+E0xkOvLntqMYpviA==", 402 | "requires": { 403 | "@octokit/types": "^6.34.0", 404 | "deprecation": "^2.3.1" 405 | } 406 | }, 407 | "@octokit/request": { 408 | "version": "5.6.3", 409 | "resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.6.3.tgz", 410 | "integrity": "sha512-bFJl0I1KVc9jYTe9tdGGpAMPy32dLBXXo1dS/YwSCTL/2nd9XeHsY616RE3HPXDVk+a+dBuzyz5YdlXwcDTr2A==", 411 | "requires": { 412 | "@octokit/endpoint": "^6.0.1", 413 | "@octokit/request-error": "^2.1.0", 414 | "@octokit/types": "^6.16.1", 415 | "is-plain-object": "^5.0.0", 416 | "node-fetch": "^2.6.7", 417 | "universal-user-agent": "^6.0.0" 418 | } 419 | }, 420 | "@octokit/request-error": { 421 | "version": "2.1.0", 422 | "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-2.1.0.tgz", 423 | "integrity": "sha512-1VIvgXxs9WHSjicsRwq8PlR2LR2x6DwsJAaFgzdi0JfJoGSO8mYI/cHJQ+9FbN21aa+DrgNLnwObmyeSC8Rmpg==", 424 | "requires": { 425 | "@octokit/types": "^6.0.3", 426 | "deprecation": "^2.0.0", 427 | "once": "^1.4.0" 428 | } 429 | }, 430 | "@octokit/types": { 431 | "version": "6.34.0", 432 | "resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.34.0.tgz", 433 | "integrity": "sha512-s1zLBjWhdEI2zwaoSgyOFoKSl109CUcVBCc7biPJ3aAf6LGLU6szDvi31JPU7bxfla2lqfhjbbg/5DdFNxOwHw==", 434 | "requires": { 435 | "@octokit/openapi-types": "^11.2.0" 436 | } 437 | }, 438 | "@vercel/ncc": { 439 | "version": "0.33.1", 440 | "resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.33.1.tgz", 441 | "integrity": "sha512-Mlsps/P0PLZwsCFtSol23FGqT3FhBGb4B1AuGQ52JTAtXhak+b0Fh/4T55r0/SVQPeRiX9pNItOEHwakGPmZYA==", 442 | "dev": true 443 | }, 444 | "before-after-hook": { 445 | "version": "2.2.2", 446 | "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.2.tgz", 447 | "integrity": "sha512-3pZEU3NT5BFUo/AD5ERPWOgQOCZITni6iavr5AUw5AUwQjMlI0kzu5btnyD39AF0gUEsDPwJT+oY1ORBJijPjQ==" 448 | }, 449 | "coverage-diff": { 450 | "version": "1.6.0", 451 | "resolved": "https://registry.npmjs.org/coverage-diff/-/coverage-diff-1.6.0.tgz", 452 | "integrity": "sha512-oS/kBlMM3RT6TZHEfHI1Xy5uiyr7jnmluO4Zd47MmjOro42Z+J1n8VgHSINvwDGwDgeok94LyO03iIBfrfuBeg==", 453 | "requires": { 454 | "markdown-table": "1.1.1" 455 | } 456 | }, 457 | "debug": { 458 | "version": "4.3.3", 459 | "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", 460 | "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", 461 | "requires": { 462 | "ms": "2.1.2" 463 | } 464 | }, 465 | "deprecation": { 466 | "version": "2.3.1", 467 | "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", 468 | "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==" 469 | }, 470 | "is-plain-object": { 471 | "version": "5.0.0", 472 | "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz", 473 | "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==" 474 | }, 475 | "markdown-table": { 476 | "version": "1.1.1", 477 | "resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-1.1.1.tgz", 478 | "integrity": "sha1-Sz3ToTPRUYuO8NvHCb8qG0gkvIw=" 479 | }, 480 | "ms": { 481 | "version": "2.1.2", 482 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", 483 | "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" 484 | }, 485 | "node-fetch": { 486 | "version": "2.6.7", 487 | "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", 488 | "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", 489 | "requires": { 490 | "whatwg-url": "^5.0.0" 491 | } 492 | }, 493 | "once": { 494 | "version": "1.4.0", 495 | "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", 496 | "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", 497 | "requires": { 498 | "wrappy": "1" 499 | } 500 | }, 501 | "simple-git": { 502 | "version": "3.1.1", 503 | "resolved": "https://registry.npmjs.org/simple-git/-/simple-git-3.1.1.tgz", 504 | "integrity": "sha512-VamXD/Royf2Xo7s+ASzT9fp2cJatLtz/w8zLwjOLCAq9FC9ks5mEoBUYVwXuDq4GoqDReqV5r/GM+lwx6Jucyw==", 505 | "requires": { 506 | "@kwsites/file-exists": "^1.1.1", 507 | "@kwsites/promise-deferred": "^1.1.1", 508 | "debug": "^4.3.3" 509 | } 510 | }, 511 | "tr46": { 512 | "version": "0.0.3", 513 | "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", 514 | "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=" 515 | }, 516 | "tunnel": { 517 | "version": "0.0.6", 518 | "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", 519 | "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==" 520 | }, 521 | "universal-user-agent": { 522 | "version": "6.0.0", 523 | "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.0.tgz", 524 | "integrity": "sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w==" 525 | }, 526 | "webidl-conversions": { 527 | "version": "3.0.1", 528 | "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", 529 | "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=" 530 | }, 531 | "whatwg-url": { 532 | "version": "5.0.0", 533 | "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", 534 | "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=", 535 | "requires": { 536 | "tr46": "~0.0.3", 537 | "webidl-conversions": "^3.0.0" 538 | } 539 | }, 540 | "wrappy": { 541 | "version": "1.0.2", 542 | "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", 543 | "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" 544 | } 545 | } 546 | } 547 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "coverage-diff-action", 3 | "version": "1.0.8", 4 | "description": "Publish diff coverage report as PR comment, and create a coverage badge to display on the readme.", 5 | "main": "dist/index.js", 6 | "keywords": [ 7 | "github-action", 8 | "diff", 9 | "coverage", 10 | "report", 11 | "json-summary", 12 | "badge" 13 | ], 14 | "repository": { 15 | "type": "git", 16 | "url": "https://github.com/GreatWizard/coverage-diff-action.git" 17 | }, 18 | "license": "MIT", 19 | "author": { 20 | "name": "Guillaume Gérard", 21 | "url": "https://guillaume.sh" 22 | }, 23 | "scripts": { 24 | "build": "ncc build src/index.js --license licenses.txt" 25 | }, 26 | "dependencies": { 27 | "@actions/core": "^1.6.0", 28 | "@actions/github": "^5.0.0", 29 | "coverage-diff": "^1.6.0", 30 | "simple-git": "^3.1.1" 31 | }, 32 | "devDependencies": { 33 | "@vercel/ncc": "^0.33.1" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/badge.js: -------------------------------------------------------------------------------- 1 | function getShieldURL(url) { 2 | return `https://img.shields.io/endpoint?url=${url}`; 3 | } 4 | 5 | function getJSONBadge(pct, thresholdGreen = 100, thresholdOrange = 70) { 6 | let color = "red"; 7 | if (pct >= thresholdGreen) { 8 | color = "brightgreen"; 9 | } else if (pct >= thresholdOrange) { 10 | color = "orange"; 11 | } 12 | 13 | return { 14 | schemaVersion: 1, 15 | label: "Coverage", 16 | message: `${pct}%`, 17 | color, 18 | }; 19 | } 20 | 21 | module.exports = { getShieldURL, getJSONBadge }; 22 | -------------------------------------------------------------------------------- /src/branch.js: -------------------------------------------------------------------------------- 1 | function isBranch() { 2 | return process.env.GITHUB_REF.startsWith("refs/heads/"); 3 | } 4 | 5 | async function isMainBranch(octokit, owner, repo) { 6 | let response = await octokit.rest.repos.get({ 7 | owner, 8 | repo, 9 | }); 10 | return response.data.default_branch === process.env.GITHUB_REF_NAME; 11 | } 12 | 13 | module.exports = { isBranch, isMainBranch }; 14 | -------------------------------------------------------------------------------- /src/comment.js: -------------------------------------------------------------------------------- 1 | const MARKER = ""; 2 | 3 | async function addComment(octokit, repo, issue_number, body) { 4 | return await octokit.rest.issues.createComment({ 5 | ...repo, 6 | issue_number, 7 | body: `${body} 8 | ${MARKER}`, 9 | }); 10 | } 11 | 12 | async function deleteExistingComments(octokit, repo, issue_number) { 13 | let comments = await octokit.rest.issues.listComments({ 14 | ...repo, 15 | issue_number, 16 | }); 17 | 18 | for (const comment of comments.data) { 19 | if (comment.body.includes(MARKER)) { 20 | await octokit.rest.issues.deleteComment({ 21 | ...repo, 22 | comment_id: comment.id, 23 | }); 24 | } 25 | } 26 | } 27 | 28 | module.exports = { addComment, deleteExistingComments }; 29 | -------------------------------------------------------------------------------- /src/diff.js: -------------------------------------------------------------------------------- 1 | const coverageDiff = require("coverage-diff"); 2 | 3 | const ICONS = { 4 | OK: "✅", 5 | WARN: "⚠️", 6 | KO: "🔴", 7 | }; 8 | 9 | const CRITERIAS = ["lines", "branches", "functions", "statements"]; 10 | 11 | function _renderPct(pct, addSign = true) { 12 | if (addSign && pct >= 0) { 13 | return `+${pct.toFixed(2)}%`; 14 | } 15 | return `${pct.toFixed(2)}%`; 16 | } 17 | 18 | function computeDiff(base, head, options = {}) { 19 | const diff = coverageDiff.diff(base, head); 20 | 21 | let totalTitle = "Total coverage"; 22 | let summaryTitle = "click to open the diff coverage report"; 23 | 24 | let countRegression = 0; 25 | let table = []; 26 | Object.keys(diff.diff).forEach((file) => { 27 | if (file === "total") { 28 | return; 29 | } 30 | 31 | const element = diff.diff[file]; 32 | 33 | if (CRITERIAS.every((criteria) => element[criteria].pct === 0)) { 34 | return; 35 | } 36 | 37 | const fileRegression = CRITERIAS.some( 38 | (criteria) => element[criteria].pct < 0 39 | ); 40 | if (fileRegression) { 41 | countRegression++; 42 | } 43 | 44 | table.push({ 45 | icon: fileRegression ? ICONS.KO : ICONS.OK, 46 | filename: file, 47 | lines: { 48 | pct: _renderPct(head[file].lines.pct, false), 49 | diff: _renderPct(element.lines.pct), 50 | }, 51 | branches: { 52 | pct: _renderPct(head[file].branches.pct, false), 53 | diff: _renderPct(element.branches.pct), 54 | }, 55 | functions: { 56 | pct: _renderPct(head[file].functions.pct, false), 57 | diff: _renderPct(element.functions.pct), 58 | }, 59 | statements: { 60 | pct: _renderPct(head[file].statements.pct, false), 61 | diff: _renderPct(element.statements.pct), 62 | }, 63 | }); 64 | }); 65 | 66 | if (table.length > 0 && countRegression > 0) { 67 | summaryTitle = `${countRegression} file${ 68 | countRegression > 1 ? "s" : "" 69 | } with a coverage regression`; 70 | } 71 | 72 | let totals = {}; 73 | let globalRegression = false; 74 | CRITERIAS.forEach((criteria) => { 75 | let diffPct = head.total[criteria].pct - base.total[criteria].pct; 76 | if (diffPct < 0) { 77 | globalRegression = true; 78 | } 79 | totals[criteria] = `${_renderPct( 80 | head.total[criteria].pct, 81 | false 82 | )} (${_renderPct(diffPct)})`; 83 | }); 84 | 85 | if (globalRegression) { 86 | totalTitle = `${ 87 | options.allowedToFail ? ICONS.WARN : ICONS.KO 88 | } Total coverage is lower than the default branch`; 89 | } 90 | 91 | return { 92 | regression: globalRegression, 93 | markdown: ` 94 | ### ${totalTitle} 95 | 96 | | Lines | Branches | Functions | Statements | 97 | | --------------- | ------------------ | ------------------- | -------------------- | 98 | | ${totals.lines} | ${totals.branches} | ${totals.functions} | ${ 99 | totals.statements 100 | } | 101 | ${ 102 | table.length > 0 103 | ? ` 104 | 105 | #### Detailed report 106 | 107 |
${summaryTitle} 108 | 109 | | | File | Lines | Branches | Functions | Statements | 110 | | - | ---- | ----- | -------- | --------- | ---------- |${table.map( 111 | (row) => 112 | `\n| ${row.icon} | ${row.filename} | ${row.lines.pct}${ 113 | row.lines.diff !== "+0.00%" ? ` (${row.lines.diff})` : "" 114 | } | ${row.branches.pct}${ 115 | row.branches.diff !== "+0.00%" ? ` (${row.branches.diff})` : "" 116 | } | ${row.functions.pct}${ 117 | row.functions.diff !== "+0.00%" ? ` (${row.functions.diff})` : "" 118 | } | ${row.statements.pct}${ 119 | row.statements.diff !== "+0.00%" ? ` (${row.statements.diff})` : "" 120 | } |` 121 | )} 122 |
` 123 | : "" 124 | } 125 | `, 126 | }; 127 | } 128 | 129 | module.exports = { computeDiff }; 130 | -------------------------------------------------------------------------------- /src/git.js: -------------------------------------------------------------------------------- 1 | const simpleGit = require("simple-git"); 2 | 3 | async function gitClone(url, wikiPath) { 4 | return await simpleGit().clone(url, wikiPath); 5 | } 6 | 7 | async function gitUpdate(wikiPath) { 8 | return await simpleGit(wikiPath) 9 | .addConfig("user.name", "Coverage Diff Action") 10 | .addConfig("user.email", "coverage-diff-action") 11 | .add("*") 12 | .commit("Update coverage badge") 13 | .push(); 14 | } 15 | 16 | module.exports = { gitClone, gitUpdate }; 17 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | const { 2 | readFile, 3 | writeFile, 4 | copyFile, 5 | mkdir, 6 | mkdtemp, 7 | } = require("fs/promises"); 8 | const { existsSync } = require("fs"); 9 | const path = require("path"); 10 | const core = require("@actions/core"); 11 | const github = require("@actions/github"); 12 | 13 | const { gitClone, gitUpdate } = require("./git"); 14 | const { isBranch, isMainBranch } = require("./branch"); 15 | const { getShieldURL, getJSONBadge } = require("./badge"); 16 | const { average } = require("./math"); 17 | const { computeDiff } = require("./diff"); 18 | const { addComment, deleteExistingComments } = require("./comment"); 19 | 20 | const { context } = github; 21 | 22 | async function run() { 23 | const tmpPath = await mkdir(path.join(process.env.GITHUB_WORKSPACE, "tmp"), { 24 | recursive: true, 25 | }); 26 | const WIKI_PATH = await mkdtemp(path.join(tmpPath, "coverage-diff-")); 27 | 28 | const githubToken = core.getInput("github-token"); 29 | const baseSummaryFilename = core.getInput("base-summary-filename"); 30 | const coverageFilename = core.getInput("coverage-filename"); 31 | const badgeThresholdOrange = core.getInput("badge-threshold-orange"); 32 | 33 | core.info(`Cloning wiki repository...`); 34 | 35 | await gitClone( 36 | `https://x-access-token:${githubToken}@github.com/${process.env.GITHUB_REPOSITORY}.wiki.git`, 37 | WIKI_PATH 38 | ); 39 | 40 | const octokit = github.getOctokit(githubToken); 41 | 42 | const head = JSON.parse(await readFile(coverageFilename, "utf8")); 43 | 44 | const pct = average( 45 | Object.keys(head.total).map((t) => head.total[t].pct), 46 | 0 47 | ); 48 | 49 | if ( 50 | isBranch() && 51 | (await isMainBranch(octokit, context.repo.owner, context.repo.repo)) 52 | ) { 53 | core.info("Running on default branch"); 54 | const BadgeEnabled = core.getBooleanInput("badge-enabled"); 55 | const badgeFilename = core.getInput("badge-filename"); 56 | 57 | core.info("Saving json-summary report into the repo wiki"); 58 | await copyFile(coverageFilename, path.join(WIKI_PATH, baseSummaryFilename)); 59 | 60 | if (BadgeEnabled) { 61 | core.info("Saving Badge into the repo wiki"); 62 | 63 | const badgeThresholdGreen = core.getInput("badge-threshold-green"); 64 | 65 | await writeFile( 66 | path.join(WIKI_PATH, badgeFilename), 67 | JSON.stringify( 68 | getJSONBadge(pct, badgeThresholdGreen, badgeThresholdOrange) 69 | ) 70 | ); 71 | } 72 | 73 | await gitUpdate(WIKI_PATH); 74 | 75 | if (BadgeEnabled) { 76 | const url = `https://raw.githubusercontent.com/wiki/${process.env.GITHUB_REPOSITORY}/${badgeFilename}`; 77 | core.info(`Badge JSON stored at ${url}`); 78 | core.info(`Badge URL: ${getShieldURL(url)}`); 79 | } 80 | } else { 81 | core.info("Running on pull request branch"); 82 | if (!existsSync(path.join(WIKI_PATH, baseSummaryFilename))) { 83 | core.info("No base json-summary found"); 84 | return; 85 | } 86 | 87 | const issue_number = context?.payload?.pull_request?.number; 88 | const allowedToFail = core.getBooleanInput("allowed-to-fail"); 89 | const base = JSON.parse( 90 | await readFile(path.join(WIKI_PATH, baseSummaryFilename), "utf8") 91 | ); 92 | 93 | const diff = computeDiff(base, head, { allowedToFail }); 94 | 95 | if (issue_number) { 96 | await deleteExistingComments(octokit, context.repo, issue_number); 97 | 98 | core.info("Add a comment with the diff coverage report"); 99 | await addComment(octokit, context.repo, issue_number, diff.markdown); 100 | } else { 101 | core.info(diff.results); 102 | } 103 | 104 | if (!allowedToFail && diff.regression) { 105 | throw new Error("Total coverage is lower than the default branch"); 106 | } 107 | } 108 | } 109 | 110 | try { 111 | run(); 112 | } catch (error) { 113 | core.setFailed(error.message); 114 | } 115 | -------------------------------------------------------------------------------- /src/math.js: -------------------------------------------------------------------------------- 1 | function average(arr, fixed = 2) { 2 | return Math.round(arr.reduce((a, b) => a + b, 0) / arr.length).toFixed(fixed); 3 | } 4 | 5 | module.exports = { average }; 6 | --------------------------------------------------------------------------------