How to use checkRun method in ava

Best JavaScript code snippet using ava

evalCommit.js

Source:evalCommit.js Github

copy

Full Screen

1"use strict";2const commitStatus = require("../../utils/models/commitStatus");3/* eslint quotes: ["error", "double"], "quote-props": ["error", "always"], "comma-dangle": ["error", "never"] */4module.exports = [5 {6 "commitStatus": {7 "statusCheckRollup": {8 "state": "SUCCESS",9 "contexts": {10 "totalCount": 90,11 "pageInfo": { "endCursor": "OTA", "hasNextPage": false },12 "nodes": [13 {14 "__typename": "CheckRun",15 "status": "COMPLETED",16 "name": "Automatic Rebase",17 "conclusion": "SUCCESS"18 },19 {20 "__typename": "CheckRun",21 "status": "COMPLETED",22 "name": "Require “Allow Edits”",23 "conclusion": "SUCCESS"24 },25 {26 "__typename": "CheckRun",27 "status": "COMPLETED",28 "name": "tests / matrix",29 "conclusion": "SUCCESS"30 },31 {32 "__typename": "CheckRun",33 "status": "COMPLETED",34 "name": "tests / matrix",35 "conclusion": "SUCCESS"36 },37 {38 "__typename": "CheckRun",39 "status": "COMPLETED",40 "name": "tests / pretest",41 "conclusion": "SUCCESS"42 },43 {44 "__typename": "CheckRun",45 "status": "COMPLETED",46 "name": "tests / pretest",47 "conclusion": "SUCCESS"48 },49 {50 "__typename": "CheckRun",51 "status": "COMPLETED",52 "name": "tests / latest minors (17.4)",53 "conclusion": "SUCCESS"54 },55 {56 "__typename": "CheckRun",57 "status": "COMPLETED",58 "name": "tests / latest minors (17.4)",59 "conclusion": "SUCCESS"60 },61 {62 "__typename": "CheckRun",63 "status": "COMPLETED",64 "name": "tests / posttest",65 "conclusion": "SUCCESS"66 },67 {68 "__typename": "CheckRun",69 "status": "COMPLETED",70 "name": "tests / posttest",71 "conclusion": "SUCCESS"72 },73 {74 "__typename": "CheckRun",75 "status": "COMPLETED",76 "name": "tests / latest minors (16.13)",77 "conclusion": "SUCCESS"78 },79 {80 "__typename": "CheckRun",81 "status": "COMPLETED",82 "name": "tests / latest minors (16.13)",83 "conclusion": "SUCCESS"84 },85 {86 "__typename": "CheckRun",87 "status": "COMPLETED",88 "name": "tests / latest minors (14.19)",89 "conclusion": "SUCCESS"90 },91 {92 "__typename": "CheckRun",93 "status": "COMPLETED",94 "name": "tests / latest minors (14.19)",95 "conclusion": "SUCCESS"96 },97 {98 "__typename": "CheckRun",99 "status": "COMPLETED",100 "name": "tests / non-latest minors (17.3)",101 "conclusion": "SUCCESS"102 },103 {104 "__typename": "CheckRun",105 "status": "COMPLETED",106 "name": "tests / non-latest minors (17.3)",107 "conclusion": "SUCCESS"108 },109 {110 "__typename": "CheckRun",111 "status": "COMPLETED",112 "name": "tests / non-latest minors (17.2)",113 "conclusion": "SUCCESS"114 },115 {116 "__typename": "CheckRun",117 "status": "COMPLETED",118 "name": "tests / non-latest minors (17.2)",119 "conclusion": "SUCCESS"120 },121 {122 "__typename": "CheckRun",123 "status": "COMPLETED",124 "name": "tests / non-latest minors (17.1)",125 "conclusion": "SUCCESS"126 },127 {128 "__typename": "CheckRun",129 "status": "COMPLETED",130 "name": "tests / non-latest minors (17.1)",131 "conclusion": "SUCCESS"132 },133 {134 "__typename": "CheckRun",135 "status": "COMPLETED",136 "name": "tests / non-latest minors (17.0)",137 "conclusion": "SUCCESS"138 },139 {140 "__typename": "CheckRun",141 "status": "COMPLETED",142 "name": "tests / non-latest minors (17.0)",143 "conclusion": "SUCCESS"144 },145 {146 "__typename": "CheckRun",147 "status": "COMPLETED",148 "name": "tests / non-latest minors (16.12)",149 "conclusion": "SUCCESS"150 },151 {152 "__typename": "CheckRun",153 "status": "COMPLETED",154 "name": "tests / non-latest minors (16.12)",155 "conclusion": "SUCCESS"156 },157 {158 "__typename": "CheckRun",159 "status": "COMPLETED",160 "name": "tests / non-latest minors (16.11)",161 "conclusion": "SUCCESS"162 },163 {164 "__typename": "CheckRun",165 "status": "COMPLETED",166 "name": "tests / non-latest minors (16.11)",167 "conclusion": "SUCCESS"168 },169 {170 "__typename": "CheckRun",171 "status": "COMPLETED",172 "name": "tests / non-latest minors (16.10)",173 "conclusion": "SUCCESS"174 },175 {176 "__typename": "CheckRun",177 "status": "COMPLETED",178 "name": "tests / non-latest minors (16.10)",179 "conclusion": "SUCCESS"180 },181 {182 "__typename": "CheckRun",183 "status": "COMPLETED",184 "name": "tests / non-latest minors (16.9)",185 "conclusion": "SUCCESS"186 },187 {188 "__typename": "CheckRun",189 "status": "COMPLETED",190 "name": "tests / non-latest minors (16.9)",191 "conclusion": "SUCCESS"192 },193 {194 "__typename": "CheckRun",195 "status": "COMPLETED",196 "name": "tests / non-latest minors (16.8)",197 "conclusion": "SUCCESS"198 },199 {200 "__typename": "CheckRun",201 "status": "COMPLETED",202 "name": "tests / non-latest minors (16.8)",203 "conclusion": "SUCCESS"204 },205 {206 "__typename": "CheckRun",207 "status": "COMPLETED",208 "name": "tests / non-latest minors (16.7)",209 "conclusion": "SUCCESS"210 },211 {212 "__typename": "CheckRun",213 "status": "COMPLETED",214 "name": "tests / non-latest minors (16.7)",215 "conclusion": "SUCCESS"216 },217 {218 "__typename": "CheckRun",219 "status": "COMPLETED",220 "name": "tests / non-latest minors (16.6)",221 "conclusion": "SUCCESS"222 },223 {224 "__typename": "CheckRun",225 "status": "COMPLETED",226 "name": "tests / non-latest minors (16.6)",227 "conclusion": "SUCCESS"228 },229 {230 "__typename": "CheckRun",231 "status": "COMPLETED",232 "name": "tests / non-latest minors (16.5)",233 "conclusion": "SUCCESS"234 },235 {236 "__typename": "CheckRun",237 "status": "COMPLETED",238 "name": "tests / non-latest minors (16.5)",239 "conclusion": "SUCCESS"240 },241 {242 "__typename": "CheckRun",243 "status": "COMPLETED",244 "name": "tests / non-latest minors (16.4)",245 "conclusion": "SUCCESS"246 },247 {248 "__typename": "CheckRun",249 "status": "COMPLETED",250 "name": "tests / non-latest minors (16.4)",251 "conclusion": "SUCCESS"252 },253 {254 "__typename": "CheckRun",255 "status": "COMPLETED",256 "name": "tests / non-latest minors (16.3)",257 "conclusion": "SUCCESS"258 },259 {260 "__typename": "CheckRun",261 "status": "COMPLETED",262 "name": "tests / non-latest minors (16.3)",263 "conclusion": "SUCCESS"264 },265 {266 "__typename": "CheckRun",267 "status": "COMPLETED",268 "name": "tests / non-latest minors (16.2)",269 "conclusion": "SUCCESS"270 },271 {272 "__typename": "CheckRun",273 "status": "COMPLETED",274 "name": "tests / non-latest minors (16.2)",275 "conclusion": "SUCCESS"276 },277 {278 "__typename": "CheckRun",279 "status": "COMPLETED",280 "name": "tests / non-latest minors (16.1)",281 "conclusion": "SUCCESS"282 },283 {284 "__typename": "CheckRun",285 "status": "COMPLETED",286 "name": "tests / non-latest minors (16.1)",287 "conclusion": "SUCCESS"288 },289 {290 "__typename": "CheckRun",291 "status": "COMPLETED",292 "name": "tests / non-latest minors (16.0)",293 "conclusion": "SUCCESS"294 },295 {296 "__typename": "CheckRun",297 "status": "COMPLETED",298 "name": "tests / non-latest minors (16.0)",299 "conclusion": "SUCCESS"300 },301 {302 "__typename": "CheckRun",303 "status": "COMPLETED",304 "name": "tests / non-latest minors (14.18)",305 "conclusion": "SUCCESS"306 },307 {308 "__typename": "CheckRun",309 "status": "COMPLETED",310 "name": "tests / non-latest minors (14.18)",311 "conclusion": "SUCCESS"312 },313 {314 "__typename": "CheckRun",315 "status": "COMPLETED",316 "name": "tests / non-latest minors (14.17)",317 "conclusion": "SUCCESS"318 },319 {320 "__typename": "CheckRun",321 "status": "COMPLETED",322 "name": "tests / non-latest minors (14.17)",323 "conclusion": "SUCCESS"324 },325 {326 "__typename": "CheckRun",327 "status": "COMPLETED",328 "name": "tests / non-latest minors (14.16)",329 "conclusion": "SUCCESS"330 },331 {332 "__typename": "CheckRun",333 "status": "COMPLETED",334 "name": "tests / non-latest minors (14.16)",335 "conclusion": "SUCCESS"336 },337 {338 "__typename": "CheckRun",339 "status": "COMPLETED",340 "name": "tests / non-latest minors (14.15)",341 "conclusion": "SUCCESS"342 },343 {344 "__typename": "CheckRun",345 "status": "COMPLETED",346 "name": "tests / non-latest minors (14.15)",347 "conclusion": "SUCCESS"348 },349 {350 "__typename": "CheckRun",351 "status": "COMPLETED",352 "name": "tests / non-latest minors (14.14)",353 "conclusion": "SUCCESS"354 },355 {356 "__typename": "CheckRun",357 "status": "COMPLETED",358 "name": "tests / non-latest minors (14.14)",359 "conclusion": "SUCCESS"360 },361 {362 "__typename": "CheckRun",363 "status": "COMPLETED",364 "name": "tests / non-latest minors (14.13)",365 "conclusion": "SUCCESS"366 },367 {368 "__typename": "CheckRun",369 "status": "COMPLETED",370 "name": "tests / non-latest minors (14.13)",371 "conclusion": "SUCCESS"372 },373 {374 "__typename": "CheckRun",375 "status": "COMPLETED",376 "name": "tests / non-latest minors (14.12)",377 "conclusion": "SUCCESS"378 },379 {380 "__typename": "CheckRun",381 "status": "COMPLETED",382 "name": "tests / non-latest minors (14.12)",383 "conclusion": "SUCCESS"384 },385 {386 "__typename": "CheckRun",387 "status": "COMPLETED",388 "name": "tests / non-latest minors (14.11)",389 "conclusion": "SUCCESS"390 },391 {392 "__typename": "CheckRun",393 "status": "COMPLETED",394 "name": "tests / non-latest minors (14.11)",395 "conclusion": "SUCCESS"396 },397 {398 "__typename": "CheckRun",399 "status": "COMPLETED",400 "name": "tests / non-latest minors (14.10)",401 "conclusion": "SUCCESS"402 },403 {404 "__typename": "CheckRun",405 "status": "COMPLETED",406 "name": "tests / non-latest minors (14.10)",407 "conclusion": "SUCCESS"408 },409 {410 "__typename": "CheckRun",411 "status": "COMPLETED",412 "name": "tests / non-latest minors (14.9)",413 "conclusion": "SUCCESS"414 },415 {416 "__typename": "CheckRun",417 "status": "COMPLETED",418 "name": "tests / non-latest minors (14.9)",419 "conclusion": "SUCCESS"420 },421 {422 "__typename": "CheckRun",423 "status": "COMPLETED",424 "name": "tests / non-latest minors (14.8)",425 "conclusion": "SUCCESS"426 },427 {428 "__typename": "CheckRun",429 "status": "COMPLETED",430 "name": "tests / non-latest minors (14.8)",431 "conclusion": "SUCCESS"432 },433 {434 "__typename": "CheckRun",435 "status": "COMPLETED",436 "name": "tests / non-latest minors (14.7)",437 "conclusion": "SUCCESS"438 },439 {440 "__typename": "CheckRun",441 "status": "COMPLETED",442 "name": "tests / non-latest minors (14.7)",443 "conclusion": "SUCCESS"444 },445 {446 "__typename": "CheckRun",447 "status": "COMPLETED",448 "name": "tests / non-latest minors (14.6)",449 "conclusion": "SUCCESS"450 },451 {452 "__typename": "CheckRun",453 "status": "COMPLETED",454 "name": "tests / non-latest minors (14.6)",455 "conclusion": "SUCCESS"456 },457 {458 "__typename": "CheckRun",459 "status": "COMPLETED",460 "name": "tests / non-latest minors (14.5)",461 "conclusion": "SUCCESS"462 },463 {464 "__typename": "CheckRun",465 "status": "COMPLETED",466 "name": "tests / non-latest minors (14.5)",467 "conclusion": "SUCCESS"468 },469 {470 "__typename": "CheckRun",471 "status": "COMPLETED",472 "name": "tests / non-latest minors (14.4)",473 "conclusion": "SUCCESS"474 },475 {476 "__typename": "CheckRun",477 "status": "COMPLETED",478 "name": "tests / non-latest minors (14.4)",479 "conclusion": "SUCCESS"480 },481 {482 "__typename": "CheckRun",483 "status": "COMPLETED",484 "name": "tests / non-latest minors (14.3)",485 "conclusion": "SUCCESS"486 },487 {488 "__typename": "CheckRun",489 "status": "COMPLETED",490 "name": "tests / non-latest minors (14.3)",491 "conclusion": "SUCCESS"492 },493 {494 "__typename": "CheckRun",495 "status": "COMPLETED",496 "name": "tests / non-latest minors (14.2)",497 "conclusion": "SUCCESS"498 },499 {500 "__typename": "CheckRun",501 "status": "COMPLETED",502 "name": "tests / non-latest minors (14.2)",503 "conclusion": "SUCCESS"504 },505 {506 "__typename": "CheckRun",507 "status": "COMPLETED",508 "name": "tests / non-latest minors (14.1)",509 "conclusion": "SUCCESS"510 },511 {512 "__typename": "CheckRun",513 "status": "COMPLETED",514 "name": "tests / non-latest minors (14.1)",515 "conclusion": "SUCCESS"516 },517 {518 "__typename": "CheckRun",519 "status": "COMPLETED",520 "name": "tests / non-latest minors (14.0)",521 "conclusion": "SUCCESS"522 },523 {524 "__typename": "CheckRun",525 "status": "COMPLETED",526 "name": "tests / non-latest minors (14.0)",527 "conclusion": "SUCCESS"528 },529 {530 "__typename": "CheckRun",531 "status": "COMPLETED",532 "name": "tests / node minors @ ^14 || >= 16",533 "conclusion": "SUCCESS"534 },535 {536 "__typename": "CheckRun",537 "status": "COMPLETED",538 "name": "tests / node minors @ ^14 || >= 16",539 "conclusion": "SUCCESS"540 },541 {542 "__typename": "CheckRun",543 "status": "COMPLETED",544 "name": "node",545 "conclusion": "SUCCESS"546 },547 {548 "__typename": "CheckRun",549 "status": "COMPLETED",550 "name": "node",551 "conclusion": "SUCCESS"552 }553 ]554 }555 }556 },557 "expected": commitStatus.STATUS_SUCCESS,558 "description": "✔ All commit checks are successful"559 },560 {561 "commitStatus": {562 "statusCheckRollup": {563 "state": "PENDING",564 "contexts": {565 "totalCount": 34,566 "pageInfo": {567 "endCursor": "MzQ",568 "hasNextPage": false569 },570 "nodes": [571 {572 "__typename": "StatusContext",573 "state": "PENDING",574 "context": "ci/circleci: sync_reconciler_forks",575 "description": "CircleCI is running your tests"576 },577 {578 "__typename": "StatusContext",579 "state": "PENDING",580 "context":581 "ci/circleci: yarn_test--r=www-classic --env=development --variant=true",582 "description": "CircleCI is running your tests"583 },584 {585 "__typename": "CheckRun",586 "status": "COMPLETED",587 "name": "Facebook CLA Check",588 "conclusion": "SUCCESS"589 },590 {591 "__typename": "StatusContext",592 "state": "SUCCESS",593 "context": "ci/circleci: RELEASE_CHANNEL_stable_yarn_build",594 "description": "Your tests passed on CircleCI!"595 },596 {597 "__typename": "StatusContext",598 "state": "SUCCESS",599 "context":600 "ci/circleci: RELEASE_CHANNEL_stable_yarn_test_dom_fixtures",601 "description": "Your tests passed on CircleCI!"602 },603 {604 "__typename": "StatusContext",605 "state": "SUCCESS",606 "context": "ci/circleci: build_devtools_and_process_artifacts",607 "description": "Your tests passed on CircleCI!"608 },609 {610 "__typename": "StatusContext",611 "state": "SUCCESS",612 "context": "ci/circleci: build_devtools_scheduling_profiler",613 "description": "Your tests passed on CircleCI!"614 },615 {616 "__typename": "StatusContext",617 "state": "SUCCESS",618 "context": "ci/circleci: get_base_build",619 "description": "Your tests passed on CircleCI!"620 },621 {622 "__typename": "StatusContext",623 "state": "SUCCESS",624 "context": "ci/circleci: process_artifacts_combined",625 "description": "Your tests passed on CircleCI!"626 },627 {628 "__typename": "StatusContext",629 "state": "SUCCESS",630 "context": "ci/circleci: setup",631 "description": "Your tests passed on CircleCI!"632 },633 {634 "__typename": "StatusContext",635 "state": "SUCCESS",636 "context": "ci/circleci: sizebot",637 "description": "Your tests passed on CircleCI!"638 },639 {640 "__typename": "StatusContext",641 "state": "SUCCESS",642 "context": "ci/circleci: yarn_build",643 "description": "Your tests passed on CircleCI!"644 },645 {646 "__typename": "StatusContext",647 "state": "SUCCESS",648 "context": "ci/circleci: yarn_build_combined",649 "description": "Your tests passed on CircleCI!"650 },651 {652 "__typename": "StatusContext",653 "state": "SUCCESS",654 "context": "ci/circleci: yarn_flow",655 "description": "Your tests passed on CircleCI!"656 },657 {658 "__typename": "StatusContext",659 "state": "SUCCESS",660 "context": "ci/circleci: yarn_lint",661 "description": "Your tests passed on CircleCI!"662 },663 {664 "__typename": "StatusContext",665 "state": "SUCCESS",666 "context": "ci/circleci: yarn_lint_build",667 "description": "Your tests passed on CircleCI!"668 },669 {670 "__typename": "StatusContext",671 "state": "SUCCESS",672 "context":673 "ci/circleci: yarn_test--r=experimental --env=development",674 "description": "Your tests passed on CircleCI!"675 },676 {677 "__typename": "StatusContext",678 "state": "SUCCESS",679 "context":680 "ci/circleci: yarn_test--r=experimental --env=production",681 "description": "Your tests passed on CircleCI!"682 },683 {684 "__typename": "StatusContext",685 "state": "SUCCESS",686 "context": "ci/circleci: yarn_test--r=stable --env=development",687 "description": "Your tests passed on CircleCI!"688 },689 {690 "__typename": "StatusContext",691 "state": "SUCCESS",692 "context":693 "ci/circleci: yarn_test--r=stable --env=development --persistent",694 "description": "Your tests passed on CircleCI!"695 },696 {697 "__typename": "StatusContext",698 "state": "SUCCESS",699 "context": "ci/circleci: yarn_test--r=stable --env=production",700 "description": "Your tests passed on CircleCI!"701 },702 {703 "__typename": "StatusContext",704 "state": "SUCCESS",705 "context":706 "ci/circleci: yarn_test--r=www-classic --env=development --variant=false",707 "description": "Your tests passed on CircleCI!"708 },709 {710 "__typename": "StatusContext",711 "state": "SUCCESS",712 "context":713 "ci/circleci: yarn_test--r=www-classic --env=production --variant=false",714 "description": "Your tests passed on CircleCI!"715 },716 {717 "__typename": "StatusContext",718 "state": "SUCCESS",719 "context":720 "ci/circleci: yarn_test--r=www-classic --env=production --variant=true",721 "description": "Your tests passed on CircleCI!"722 },723 {724 "__typename": "StatusContext",725 "state": "SUCCESS",726 "context":727 "ci/circleci: yarn_test--r=www-modern --env=development --variant=false",728 "description": "Your tests passed on CircleCI!"729 },730 {731 "__typename": "StatusContext",732 "state": "SUCCESS",733 "context":734 "ci/circleci: yarn_test--r=www-modern --env=development --variant=true",735 "description": "Your tests passed on CircleCI!"736 },737 {738 "__typename": "StatusContext",739 "state": "SUCCESS",740 "context":741 "ci/circleci: yarn_test--r=www-modern --env=production --variant=false",742 "description": "Your tests passed on CircleCI!"743 },744 {745 "__typename": "StatusContext",746 "state": "SUCCESS",747 "context":748 "ci/circleci: yarn_test--r=www-modern --env=production --variant=true",749 "description": "Your tests passed on CircleCI!"750 },751 {752 "__typename": "StatusContext",753 "state": "SUCCESS",754 "context":755 "ci/circleci: yarn_test_build---project=devtools -r=experimental",756 "description": "Your tests passed on CircleCI!"757 },758 {759 "__typename": "StatusContext",760 "state": "SUCCESS",761 "context":762 "ci/circleci: yarn_test_build--r=experimental --env=development",763 "description": "Your tests passed on CircleCI!"764 },765 {766 "__typename": "StatusContext",767 "state": "SUCCESS",768 "context":769 "ci/circleci: yarn_test_build--r=experimental --env=production",770 "description": "Your tests passed on CircleCI!"771 },772 {773 "__typename": "StatusContext",774 "state": "SUCCESS",775 "context":776 "ci/circleci: yarn_test_build--r=stable --env=development",777 "description": "Your tests passed on CircleCI!"778 },779 {780 "__typename": "StatusContext",781 "state": "SUCCESS",782 "context":783 "ci/circleci: yarn_test_build--r=stable --env=production",784 "description": "Your tests passed on CircleCI!"785 },786 {787 "__typename": "StatusContext",788 "state": "SUCCESS",789 "context": "ci/codesandbox",790 "description": "Building packages succeeded."791 }792 ]793 }794 }795 },796 "expected": commitStatus.STATUS_PENDING,797 "description": "⌛ Some commit checks are pending"798 },799 {800 "commitStatus": {801 "statusCheckRollup": {802 "state": "FAILURE",803 "contexts": {804 "totalCount": 48,805 "pageInfo": { "endCursor": "NDg", "hasNextPage": false },806 "nodes": [807 {808 "__typename": "CheckRun",809 "status": "COMPLETED",810 "name": "Automatic Rebase",811 "conclusion": "FAILURE"812 },813 {814 "__typename": "CheckRun",815 "status": "COMPLETED",816 "name": "Require “Allow Edits”",817 "conclusion": "SUCCESS"818 },819 {820 "__typename": "CheckRun",821 "status": "COMPLETED",822 "name": "tests / matrix",823 "conclusion": "SUCCESS"824 },825 {826 "__typename": "CheckRun",827 "status": "COMPLETED",828 "name": "tests / pretest",829 "conclusion": "SUCCESS"830 },831 {832 "__typename": "CheckRun",833 "status": "COMPLETED",834 "name": "tests / latest minors (17.5)",835 "conclusion": "SUCCESS"836 },837 {838 "__typename": "CheckRun",839 "status": "COMPLETED",840 "name": "tests / posttest",841 "conclusion": "SUCCESS"842 },843 {844 "__typename": "CheckRun",845 "status": "COMPLETED",846 "name": "tests / latest minors (16.14)",847 "conclusion": "SUCCESS"848 },849 {850 "__typename": "CheckRun",851 "status": "COMPLETED",852 "name": "tests / latest minors (14.19)",853 "conclusion": "SUCCESS"854 },855 {856 "__typename": "CheckRun",857 "status": "COMPLETED",858 "name": "tests / non-latest minors (17.4)",859 "conclusion": "SUCCESS"860 },861 {862 "__typename": "CheckRun",863 "status": "COMPLETED",864 "name": "tests / non-latest minors (17.3)",865 "conclusion": "SUCCESS"866 },867 {868 "__typename": "CheckRun",869 "status": "COMPLETED",870 "name": "tests / non-latest minors (17.2)",871 "conclusion": "SUCCESS"872 },873 {874 "__typename": "CheckRun",875 "status": "COMPLETED",876 "name": "tests / non-latest minors (17.1)",877 "conclusion": "SUCCESS"878 },879 {880 "__typename": "CheckRun",881 "status": "COMPLETED",882 "name": "tests / non-latest minors (17.0)",883 "conclusion": "SUCCESS"884 },885 {886 "__typename": "CheckRun",887 "status": "COMPLETED",888 "name": "tests / non-latest minors (16.13)",889 "conclusion": "SUCCESS"890 },891 {892 "__typename": "CheckRun",893 "status": "COMPLETED",894 "name": "tests / non-latest minors (16.12)",895 "conclusion": "SUCCESS"896 },897 {898 "__typename": "CheckRun",899 "status": "COMPLETED",900 "name": "tests / non-latest minors (16.11)",901 "conclusion": "SUCCESS"902 },903 {904 "__typename": "CheckRun",905 "status": "COMPLETED",906 "name": "tests / non-latest minors (16.10)",907 "conclusion": "SUCCESS"908 },909 {910 "__typename": "CheckRun",911 "status": "COMPLETED",912 "name": "tests / non-latest minors (16.9)",913 "conclusion": "SUCCESS"914 },915 {916 "__typename": "CheckRun",917 "status": "COMPLETED",918 "name": "tests / non-latest minors (16.8)",919 "conclusion": "SUCCESS"920 },921 {922 "__typename": "CheckRun",923 "status": "COMPLETED",924 "name": "tests / non-latest minors (16.7)",925 "conclusion": "SUCCESS"926 },927 {928 "__typename": "CheckRun",929 "status": "COMPLETED",930 "name": "tests / non-latest minors (16.6)",931 "conclusion": "SUCCESS"932 },933 {934 "__typename": "CheckRun",935 "status": "COMPLETED",936 "name": "tests / non-latest minors (16.5)",937 "conclusion": "SUCCESS"938 },939 {940 "__typename": "CheckRun",941 "status": "COMPLETED",942 "name": "tests / non-latest minors (16.4)",943 "conclusion": "SUCCESS"944 },945 {946 "__typename": "CheckRun",947 "status": "COMPLETED",948 "name": "tests / non-latest minors (16.3)",949 "conclusion": "SUCCESS"950 },951 {952 "__typename": "CheckRun",953 "status": "COMPLETED",954 "name": "tests / non-latest minors (16.2)",955 "conclusion": "SUCCESS"956 },957 {958 "__typename": "CheckRun",959 "status": "COMPLETED",960 "name": "tests / non-latest minors (16.1)",961 "conclusion": "SUCCESS"962 },963 {964 "__typename": "CheckRun",965 "status": "COMPLETED",966 "name": "tests / non-latest minors (16.0)",967 "conclusion": "SUCCESS"968 },969 {970 "__typename": "CheckRun",971 "status": "COMPLETED",972 "name": "tests / non-latest minors (14.18)",973 "conclusion": "SUCCESS"974 },975 {976 "__typename": "CheckRun",977 "status": "COMPLETED",978 "name": "tests / non-latest minors (14.17)",979 "conclusion": "SUCCESS"980 },981 {982 "__typename": "CheckRun",983 "status": "COMPLETED",984 "name": "tests / non-latest minors (14.16)",985 "conclusion": "SUCCESS"986 },987 {988 "__typename": "CheckRun",989 "status": "COMPLETED",990 "name": "tests / non-latest minors (14.15)",991 "conclusion": "SUCCESS"992 },993 {994 "__typename": "CheckRun",995 "status": "COMPLETED",996 "name": "tests / non-latest minors (14.14)",997 "conclusion": "SUCCESS"998 },999 {1000 "__typename": "CheckRun",1001 "status": "COMPLETED",1002 "name": "tests / non-latest minors (14.13)",1003 "conclusion": "SUCCESS"1004 },1005 {1006 "__typename": "CheckRun",1007 "status": "COMPLETED",1008 "name": "tests / non-latest minors (14.12)",1009 "conclusion": "SUCCESS"1010 },1011 {1012 "__typename": "CheckRun",1013 "status": "COMPLETED",1014 "name": "tests / non-latest minors (14.11)",1015 "conclusion": "SUCCESS"1016 },1017 {1018 "__typename": "CheckRun",1019 "status": "COMPLETED",1020 "name": "tests / non-latest minors (14.10)",1021 "conclusion": "SUCCESS"1022 },1023 {1024 "__typename": "CheckRun",1025 "status": "COMPLETED",1026 "name": "tests / non-latest minors (14.9)",1027 "conclusion": "SUCCESS"1028 },1029 {1030 "__typename": "CheckRun",1031 "status": "COMPLETED",1032 "name": "tests / non-latest minors (14.8)",1033 "conclusion": "SUCCESS"1034 },1035 {1036 "__typename": "CheckRun",1037 "status": "COMPLETED",1038 "name": "tests / non-latest minors (14.7)",1039 "conclusion": "SUCCESS"1040 },1041 {1042 "__typename": "CheckRun",1043 "status": "COMPLETED",1044 "name": "tests / non-latest minors (14.6)",1045 "conclusion": "SUCCESS"1046 },1047 {1048 "__typename": "CheckRun",1049 "status": "COMPLETED",1050 "name": "tests / non-latest minors (14.5)",1051 "conclusion": "SUCCESS"1052 },1053 {1054 "__typename": "CheckRun",1055 "status": "COMPLETED",1056 "name": "tests / non-latest minors (14.4)",1057 "conclusion": "SUCCESS"1058 },1059 {1060 "__typename": "CheckRun",1061 "status": "COMPLETED",1062 "name": "tests / non-latest minors (14.3)",1063 "conclusion": "SUCCESS"1064 },1065 {1066 "__typename": "CheckRun",1067 "status": "COMPLETED",1068 "name": "tests / non-latest minors (14.2)",1069 "conclusion": "SUCCESS"1070 },1071 {1072 "__typename": "CheckRun",1073 "status": "COMPLETED",1074 "name": "tests / non-latest minors (14.1)",1075 "conclusion": "SUCCESS"1076 },1077 {1078 "__typename": "CheckRun",1079 "status": "COMPLETED",1080 "name": "tests / non-latest minors (14.0)",1081 "conclusion": "SUCCESS"1082 },1083 {1084 "__typename": "CheckRun",1085 "status": "COMPLETED",1086 "name": "tests / node minors @ ^14 || >= 16",1087 "conclusion": "SUCCESS"1088 },1089 {1090 "__typename": "CheckRun",1091 "status": "COMPLETED",1092 "name": "node",1093 "conclusion": "SUCCESS"1094 }1095 ]1096 }1097 }1098 },1099 "expected": commitStatus.STATUS_FAILURE,1100 "description": "⚠ Some commit checks were not successful"1101 },1102 {1103 "commitStatus": {1104 "statusCheckRollup": {1105 "state": "ERROR",1106 "contexts": {1107 "totalCount": 49,1108 "pageInfo": { "endCursor": "NDk", "hasNextPage": false },1109 "nodes": [1110 {1111 "__typename": "CheckRun",1112 "status": "COMPLETED",1113 "name": "Automatic Rebase",1114 "conclusion": "ERROR"1115 },1116 {1117 "__typename": "CheckRun",1118 "status": "COMPLETED",1119 "name": "Require “Allow Edits”",1120 "conclusion": "SUCCESS"1121 },1122 {1123 "__typename": "CheckRun",1124 "status": "COMPLETED",1125 "name": "tests / matrix",1126 "conclusion": "SUCCESS"1127 },1128 {1129 "__typename": "CheckRun",1130 "status": "COMPLETED",1131 "name": "tests / pretest",1132 "conclusion": "SUCCESS"1133 },1134 {1135 "__typename": "CheckRun",1136 "status": "COMPLETED",1137 "name": "tests / latest minors (17.6)",1138 "conclusion": "SUCCESS"1139 },1140 {1141 "__typename": "CheckRun",1142 "status": "COMPLETED",1143 "name": "tests / posttest",1144 "conclusion": "SUCCESS"1145 },1146 {1147 "__typename": "CheckRun",1148 "status": "COMPLETED",1149 "name": "tests / latest minors (16.14)",1150 "conclusion": "SUCCESS"1151 },1152 {1153 "__typename": "CheckRun",1154 "status": "COMPLETED",1155 "name": "tests / latest minors (14.19)",1156 "conclusion": "SUCCESS"1157 },1158 {1159 "__typename": "CheckRun",1160 "status": "COMPLETED",1161 "name": "tests / non-latest minors (17.5)",1162 "conclusion": "SUCCESS"1163 },1164 {1165 "__typename": "CheckRun",1166 "status": "COMPLETED",1167 "name": "tests / non-latest minors (17.4)",1168 "conclusion": "SUCCESS"1169 },1170 {1171 "__typename": "CheckRun",1172 "status": "COMPLETED",1173 "name": "tests / non-latest minors (17.3)",1174 "conclusion": "SUCCESS"1175 },1176 {1177 "__typename": "CheckRun",1178 "status": "COMPLETED",1179 "name": "tests / non-latest minors (17.2)",1180 "conclusion": "SUCCESS"1181 },1182 {1183 "__typename": "CheckRun",1184 "status": "COMPLETED",1185 "name": "tests / non-latest minors (17.1)",1186 "conclusion": "SUCCESS"1187 },1188 {1189 "__typename": "CheckRun",1190 "status": "COMPLETED",1191 "name": "tests / non-latest minors (17.0)",1192 "conclusion": "SUCCESS"1193 },1194 {1195 "__typename": "CheckRun",1196 "status": "COMPLETED",1197 "name": "tests / non-latest minors (16.13)",1198 "conclusion": "SUCCESS"1199 },1200 {1201 "__typename": "CheckRun",1202 "status": "COMPLETED",1203 "name": "tests / non-latest minors (16.12)",1204 "conclusion": "SUCCESS"1205 },1206 {1207 "__typename": "CheckRun",1208 "status": "COMPLETED",1209 "name": "tests / non-latest minors (16.11)",1210 "conclusion": "SUCCESS"1211 },1212 {1213 "__typename": "CheckRun",1214 "status": "COMPLETED",1215 "name": "tests / non-latest minors (16.10)",1216 "conclusion": "SUCCESS"1217 },1218 {1219 "__typename": "CheckRun",1220 "status": "COMPLETED",1221 "name": "tests / non-latest minors (16.9)",1222 "conclusion": "SUCCESS"1223 },1224 {1225 "__typename": "CheckRun",1226 "status": "COMPLETED",1227 "name": "tests / non-latest minors (16.8)",1228 "conclusion": "SUCCESS"1229 },1230 {1231 "__typename": "CheckRun",1232 "status": "COMPLETED",1233 "name": "tests / non-latest minors (16.7)",1234 "conclusion": "SUCCESS"1235 },1236 {1237 "__typename": "CheckRun",1238 "status": "COMPLETED",1239 "name": "tests / non-latest minors (16.6)",1240 "conclusion": "SUCCESS"1241 },1242 {1243 "__typename": "CheckRun",1244 "status": "COMPLETED",1245 "name": "tests / non-latest minors (16.5)",1246 "conclusion": "SUCCESS"1247 },1248 {1249 "__typename": "CheckRun",1250 "status": "COMPLETED",1251 "name": "tests / non-latest minors (16.4)",1252 "conclusion": "SUCCESS"1253 },1254 {1255 "__typename": "CheckRun",1256 "status": "COMPLETED",1257 "name": "tests / non-latest minors (16.3)",1258 "conclusion": "SUCCESS"1259 },1260 {1261 "__typename": "CheckRun",1262 "status": "COMPLETED",1263 "name": "tests / non-latest minors (16.2)",1264 "conclusion": "SUCCESS"1265 },1266 {1267 "__typename": "CheckRun",1268 "status": "COMPLETED",1269 "name": "tests / non-latest minors (16.1)",1270 "conclusion": "SUCCESS"1271 },1272 {1273 "__typename": "CheckRun",1274 "status": "COMPLETED",1275 "name": "tests / non-latest minors (16.0)",1276 "conclusion": "SUCCESS"1277 },1278 {1279 "__typename": "CheckRun",1280 "status": "COMPLETED",1281 "name": "tests / non-latest minors (14.18)",1282 "conclusion": "SUCCESS"1283 },1284 {1285 "__typename": "CheckRun",1286 "status": "COMPLETED",1287 "name": "tests / non-latest minors (14.17)",1288 "conclusion": "SUCCESS"1289 },1290 {1291 "__typename": "CheckRun",1292 "status": "COMPLETED",1293 "name": "tests / non-latest minors (14.16)",1294 "conclusion": "SUCCESS"1295 },1296 {1297 "__typename": "CheckRun",1298 "status": "COMPLETED",1299 "name": "tests / non-latest minors (14.15)",1300 "conclusion": "SUCCESS"1301 },1302 {1303 "__typename": "CheckRun",1304 "status": "COMPLETED",1305 "name": "tests / non-latest minors (14.14)",1306 "conclusion": "SUCCESS"1307 },1308 {1309 "__typename": "CheckRun",1310 "status": "COMPLETED",1311 "name": "tests / non-latest minors (14.13)",1312 "conclusion": "SUCCESS"1313 },1314 {1315 "__typename": "CheckRun",1316 "status": "COMPLETED",1317 "name": "tests / non-latest minors (14.12)",1318 "conclusion": "SUCCESS"1319 },1320 {1321 "__typename": "CheckRun",1322 "status": "COMPLETED",1323 "name": "tests / non-latest minors (14.11)",1324 "conclusion": "SUCCESS"1325 },1326 {1327 "__typename": "CheckRun",1328 "status": "COMPLETED",1329 "name": "tests / non-latest minors (14.10)",1330 "conclusion": "SUCCESS"1331 },1332 {1333 "__typename": "CheckRun",1334 "status": "COMPLETED",1335 "name": "tests / non-latest minors (14.9)",1336 "conclusion": "SUCCESS"1337 },1338 {1339 "__typename": "CheckRun",1340 "status": "COMPLETED",1341 "name": "tests / non-latest minors (14.8)",1342 "conclusion": "SUCCESS"1343 },1344 {1345 "__typename": "CheckRun",1346 "status": "COMPLETED",1347 "name": "tests / non-latest minors (14.7)",1348 "conclusion": "SUCCESS"1349 },1350 {1351 "__typename": "CheckRun",1352 "status": "COMPLETED",1353 "name": "tests / non-latest minors (14.6)",1354 "conclusion": "SUCCESS"1355 },1356 {1357 "__typename": "CheckRun",1358 "status": "COMPLETED",1359 "name": "tests / non-latest minors (14.5)",1360 "conclusion": "SUCCESS"1361 },1362 {1363 "__typename": "CheckRun",1364 "status": "COMPLETED",1365 "name": "tests / non-latest minors (14.4)",1366 "conclusion": "SUCCESS"1367 },1368 {1369 "__typename": "CheckRun",1370 "status": "COMPLETED",1371 "name": "tests / non-latest minors (14.3)",1372 "conclusion": "SUCCESS"1373 },1374 {1375 "__typename": "CheckRun",1376 "status": "COMPLETED",1377 "name": "tests / non-latest minors (14.2)",1378 "conclusion": "SUCCESS"1379 },1380 {1381 "__typename": "CheckRun",1382 "status": "COMPLETED",1383 "name": "tests / non-latest minors (14.1)",1384 "conclusion": "SUCCESS"1385 },1386 {1387 "__typename": "CheckRun",1388 "status": "COMPLETED",1389 "name": "tests / non-latest minors (14.0)",1390 "conclusion": "SUCCESS"1391 },1392 {1393 "__typename": "CheckRun",1394 "status": "COMPLETED",1395 "name": "tests / node minors @ ^14 || >= 16",1396 "conclusion": "SUCCESS"1397 },1398 {1399 "__typename": "CheckRun",1400 "status": "COMPLETED",1401 "name": "node",1402 "conclusion": "SUCCESS"1403 }1404 ]1405 }1406 }1407 },1408 "expected": commitStatus.STATUS_FAILURE,1409 "description": "⚠ Some commit checks were not successful"1410 },1411 {1412 "commitStatus": {1413 "statusCheckRollup": {1414 "state": "NULL"1415 }1416 },1417 "expected": commitStatus.STATUS_NOT_FOUND,1418 "description": "ℹ No commit checks were found"1419 }...

Full Screen

Full Screen

index.js

Source:index.js Github

copy

Full Screen

1// Checks API example2// See: https://developer.github.com/v3/checks/ to learn more3var cors = require('cors');4var corsOptions = {5 origin: ["https://githint.herokuapp.com", "https://githint.herokuapp.com/"]6};7var models = require('./database/models');8var utils = require('./utils');9/**10 * This is the main entrypoint to your Probot app11 * @param {import('probot').Application} app12 */13module.exports = app => {14 const router = app.route('/api');15 router.use(cors(corsOptions));16 router.get('/stats', async (req, res) => {17 const installs = await models.Installation.count();18 const repos = await models.Repository.count();19 res.json({20 data: {21 installs,22 repos23 }24 });25 });26 app.on(['check_suite.requested', 'check_run.rerequested'], handleCheckEvents);27 app.on([28 'installation.created',29 'installation.deleted',30 'installation_repositories.added',31 'installation_repositories.removed'32 ],33 handleInstallationEvents);34 async function handleInstallationEvents(context) {35 try {36 const { payload } = context;37 if (context.name === 'installation') {38 if (payload.action === 'created') {39 const installation = await models.Installation.create({40 id: payload.installation.id,41 accessTokenUrl: payload.installation.access_tokens_url,42 accountName: payload.installation.account.login,43 accountType: payload.installation.account.type,44 accountUrl: payload.installation.account.url,45 targetId: payload.installation.target_id,46 targetType: payload.installation.target_type,47 });48 if (installation) {49 payload.repositories.forEach(async repo => {50 const repository = await models.Repository.create({51 id: repo.id,52 fullName: repo.full_name,53 installationId: installation.id,54 name: repo.name,55 private: repo.private,56 });57 });58 }59 } else if (payload.action === 'deleted') {60 // deleting the installation will cascade delete its repos61 await models.Installation.destroy({62 where: {63 id: payload.installation.id,64 }65 });66 }67 } else if (context.name === 'installation_repositories') {68 payload.repositories_added.forEach(async repo => {69 // just in case it already exists70 // (which will be the case if payload.installation.repository_selection71 // is changing from 'all' to 'selected')72 let repository = await models.Repository.destroy({73 where: {74 id: repo.id,75 }76 });77 repository = await models.Repository.create({78 id: repo.id,79 fullName: repo.full_name,80 installationId: payload.installation.id,81 name: repo.name,82 private: repo.private,83 });84 });85 payload.repositories_removed.forEach(async repo => {86 const repository = await models.Repository.destroy({87 where: {88 id: repo.id,89 }90 });91 });92 }93 } catch (e) {}94 }95 async function handleCheckEvents(context) {96 const startTime = new Date()97 // extract info98 const {99 check_run: checkRun,100 check_suite,101 repository102 }103 = context.payload;104 let checkSuite = check_suite || checkRun.check_suite;105 const {106 head_branch: headBranch,107 head_sha: headSha,108 pull_requests: pullRequests109 }110 = checkSuite;111 // get the .githint.json file112 const gitHintResponse = await checkGitHintFile(context, {113 checkRun,114 headBranch,115 headSha,116 repository,117 startTime118 });119 if (!gitHintResponse.data || !gitHintResponse.data.checks) {120 return;121 }122 const gitHintFile = gitHintResponse.data;123 const options = gitHintFile.options || {};124 // get the branch125 var getBranchResponse = await context.github.repos.getBranch({126 owner: repository.owner.login,127 repo: repository.name,128 branch: headBranch129 });130 const branch = { ...getBranchResponse.data };131 // get the commit132 var getCommitResponse = await context.github.repos.getCommit({133 owner: repository.owner.login,134 repo: repository.name,135 sha: headSha136 });137 const commit = { ...getCommitResponse.data };138 // get the tree139 var getTreeResponse = await context.github.gitdata.getTree({140 owner: repository.owner.login,141 repo: repository.name,142 tree_sha: commit.commit.tree.sha,143 recursive: 1144 });145 const tree = { ...getTreeResponse.data };146 // get the pull147 let pullResponse = {};148 pullResponse = await checkPull(context, {149 checkRun,150 headBranch,151 headSha,152 options,153 pull: pullRequests[0],154 repository,155 scope: {156 branch,157 commit,158 tree159 },160 startTime161 });162 if (!pullResponse.data && pullResponse.detectPull) {163 return;164 }165 const pull = await getPullInnerObjects(context, {166 pull: pullResponse.data167 });168 // run checks169 const checkNames = await getChecksToPerform({170 checkRun: checkRun && checkRun.name === 'GitHint: check for pull request' ? undefined : checkRun,171 gitHintFile172 });173 if (checkNames.length > 0) {174 runChecks(context, {175 checkRun: checkRun && checkRun.name === 'GitHint: check for pull request' ? undefined : checkRun,176 checkNames,177 gitHintFile,178 headBranch,179 headSha,180 options,181 scope: {182 branch,183 commit,184 pull,185 tree186 },187 startTime188 });189 }190 }191 async function runChecks(context, {192 checkRun,193 checkNames,194 gitHintFile,195 headBranch,196 headSha,197 options,198 scope,199 startTime200 }) {201 let allChecksPassed = true;202 let skippedChecks = [];203 for (let i = 0; i < checkNames.length; i++) {204 const name = checkNames[i];205 let script = gitHintFile.checks[name];206 let message = '';207 let skip = options.skip || false;208 // first, if script is an object get script from script.script209 if (typeof script === 'object' && !Array.isArray(script)) {210 if (typeof script.skip !== 'undefined') {211 skip = script.skip; // override any global skip212 }213 message = script.message || message;214 script = script.script || 'false';215 // if message is an array, join them216 if (Array.isArray(message)) {217 message = message.join("\n");218 }219 }220 // if script is an array, join them221 if (Array.isArray(script)) {222 script = script.filter(line => !!(line.trim())).join("\n");223 }224 // if script is string225 else if (typeof script === 'string') {226 script = `return ${script}`;227 }228 if (typeof skip === 'string') {229 skip = await utils.runScript(`return ${skip}`, scope);230 skip = skip.data || false;231 }232 // decide if check is to be skipped233 if (skip === true) {234 skippedChecks.push(name);235 continue;236 }237 const response = await utils.runScript(script, scope);238 let resData = response.data;239 let resMessage;240 if (response.data && typeof response.data === 'object') {241 resData = response.data.result;242 resMessage = response.data.message;243 } else if (response.error) {244 resMessage = response.error.message;245 }246 allChecksPassed = allChecksPassed && resData;247 if (!resData || (checkRun && checkRun.name === name)) {248 postCheckResult(context, {249 name,250 conclusion: !resData ? 'failure' : 'success',251 headBranch,252 headSha,253 startTime,254 status: 'completed',255 summary:256 resMessage257 ? resMessage258 : `The check '${name}' ${resData === true ? 'passed' : 'failed'}.`,259 text: message,260 title: name261 });262 }263 }264 if (allChecksPassed && !checkRun) {265 const checksSkipped = skippedChecks.length;266 postCheckResult(context, {267 name: `All checks passed`,268 conclusion: 'success',269 headBranch,270 headSha,271 startTime,272 status: 'completed',273 summary: `All checks that were run passed.`,274 text:275 `${checksSkipped === 0 ? "No" : checksSkipped} check${checksSkipped < 2 ? " was" : "s were"} skipped.` +276 `${checksSkipped === 0 ? "" : "\n" + skippedChecks.map(c => ` * ${c}`).join("\n")}`,277 title: `All checks passed`278 });279 }280 }281 async function checkPull(context, {checkRun, headBranch, headSha, options, pull, repository, scope, startTime}) {282 let response = {};283 if (pull) {284 response = await context.github.pullRequests.get({285 owner: repository.owner.login,286 repo: repository.name,287 number: pull.number288 });289 }290 let { detectPull } = options;291 if (typeof detectPull === 'string') {292 detectPull = await utils.runScript(`return ${detectPull}`, scope);293 detectPull = detectPull.data || false;294 }295 response.detectPull = detectPull;296 const name = 'GitHint: check for pull request'; // if u change this here, change it somewhere above (Ctrl+F)297 if ((!response.data && detectPull) || (checkRun && checkRun.name === name)) {298 postCheckResult(context, {299 name,300 conclusion: !response.data ? 'failure' : 'success',301 headBranch,302 headSha,303 startTime,304 status: 'completed',305 summary:306 response.error307 ? response.error.message308 : `The check '${name}' ${!response.data ? 'failed' : 'passed'}.`,309 text:310 !response.data311 ? 'If a code commit was made before a pull request was created ' +312 'then this check will fail. After a pull request is created you can ' +313 're-run this check. If it\'s still failing you may want to wait a ' +314 'few seconds before re-running it.'315 : 'The pull request has been detected successfully.',316 title: name317 });318 }319 return response;320 }321 async function checkGitHintFile(context, {checkRun, headBranch, headSha, repository, startTime}) {322 const response = await utils.getGitHintFile(repository.owner.login, repository.name, headBranch);323 const name = 'GitHint: check for .githint.json file';324 if (!response.data || (checkRun && checkRun.name === name)) {325 postCheckResult(context, {326 name,327 conclusion: !response.data ? 'failure' : 'success',328 headBranch,329 headSha,330 startTime,331 status: 'completed',332 summary: response.error ? response.error.message : `The check '${name}' passed.`,333 // text: "There's supposed to be a .githint.json file in the root directory",334 title: name335 });336 }337 return response;338 }339 async function getChecksToPerform({ checkRun, gitHintFile }) {340 if (gitHintFile.checks) {341 let checkNames = Object.keys(gitHintFile.checks);342 if (checkRun) {343 let checkNameToReRun = checkNames.find(name => name === checkRun.name);344 if (checkNameToReRun) {345 checkNames = [checkNameToReRun];346 } else {347 checkNames = [];348 }349 }350 return checkNames;351 }352 return [];353 }354 async function getPullInnerObjects(context, { pull }) {355 if (!pull) {356 return;357 }358 // get the reviews359 const reviewsResponse = await context.github.pullRequests.listReviews({360 owner: pull.head.repo.owner.login,361 repo: pull.head.repo.name,362 number: pull.number363 });364 pull.reviews = reviewsResponse.data;365 return pull;366 }367 async function postCheckResult (context, {368 conclusion,369 headBranch,370 headSha,371 name,372 startTime,373 status,374 summary,375 text,376 title377 }) {378 // Probot API note: context.repo() => {username: 'hiimbex', repo: 'testing-things'}379 context.github.checks.create(context.repo({380 name,381 head_branch: headBranch,382 head_sha: headSha,383 status,384 started_at: startTime,385 conclusion,386 completed_at: new Date(),387 output: {388 title,389 summary,390 text391 }392 }))393 }394 // For more information on building apps:395 // https://probot.github.io/docs/396 // To get your app running against GitHub, see:397 // https://probot.github.io/docs/development/...

Full Screen

Full Screen

check-run-view.js

Source:check-run-view.js Github

copy

Full Screen

1import React from 'react';2import PropTypes from 'prop-types';3import {graphql, createFragmentContainer} from 'react-relay';4import Octicon from '../atom/octicon';5import GithubDotcomMarkdown from './github-dotcom-markdown';6import {buildStatusFromCheckResult} from '../models/build-status';7export class BareCheckRunView extends React.Component {8 static propTypes = {9 // Relay10 checkRun: PropTypes.shape({11 name: PropTypes.string.isRequired,12 status: PropTypes.oneOf([13 'QUEUED', 'IN_PROGRESS', 'COMPLETED', 'REQUESTED',14 ]).isRequired,15 conclusion: PropTypes.oneOf([16 'ACTION_REQUIRED', 'TIMED_OUT', 'CANCELLED', 'FAILURE', 'SUCCESS', 'NEUTRAL',17 ]),18 title: PropTypes.string,19 detailsUrl: PropTypes.string,20 }).isRequired,21 // Actions22 switchToIssueish: PropTypes.func.isRequired,23 }24 render() {25 const {checkRun} = this.props;26 const {icon, classSuffix} = buildStatusFromCheckResult(checkRun);27 return (28 <li className="github-PrStatuses-list-item github-PrStatuses-list-item--checkRun">29 <span className="github-PrStatuses-list-item-icon">30 <Octicon icon={icon} className={`github-PrStatuses--${classSuffix}`} />31 </span>32 <a className="github-PrStatuses-list-item-name" href={checkRun.permalink}>{checkRun.name}</a>33 <div className="github-PrStatuses-list-item-context">34 {checkRun.title && <span className="github-PrStatuses-list-item-title">{checkRun.title}</span>}35 {checkRun.summary && (36 <GithubDotcomMarkdown37 className="github-PrStatuses-list-item-summary"38 switchToIssueish={this.props.switchToIssueish}39 markdown={checkRun.summary}40 />41 )}42 </div>43 {checkRun.detailsUrl && (44 <a className="github-PrStatuses-list-item-details-link" href={checkRun.detailsUrl}>45 Details46 </a>47 )}48 </li>49 );50 }51}52export default createFragmentContainer(BareCheckRunView, {53 checkRun: graphql`54 fragment checkRunView_checkRun on CheckRun {55 name56 status57 conclusion58 title59 summary60 permalink61 detailsUrl62 }63 `,...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const test = require('ava');2const { checkRun } = require('../lib/checkRun');3test('checkRun is a function', t => {4 t.is(typeof checkRun, 'function');5});6test('checkRun return false if no argument', t => {7 const result = checkRun();8 t.is(result, false);9});10test('checkRun return false if argument is not a string', t => {11 const result = checkRun(1);12 t.is(result, false);13});14test('checkRun return false if argument is not a valid run', t => {15 const result = checkRun('abc');16 t.is(result, false);17});18test('checkRun return true if argument is a valid run', t => {19 const result = checkRun('1');20 t.is(result, true);21});22test('checkRun return true if argument is a valid run', t => {23 const result = checkRun('2');24 t.is(result, true);25});26test('checkRun return true if argument is a valid run', t => {27 const result = checkRun('3');28 t.is(result, true);29});30test('checkRun return true if argument is a valid run', t => {31 const result = checkRun('4');32 t.is(result, true);33});34test('checkRun return true if argument is a valid run', t => {35 const result = checkRun('5');36 t.is(result, true);37});38test('checkRun return true if argument is a valid run', t => {39 const result = checkRun('6');40 t.is(result, true);41});42test('checkRun return true if argument is a valid run', t => {43 const result = checkRun('7');44 t.is(result, true);45});46test('checkRun return true if argument is a valid run', t => {47 const result = checkRun('8');48 t.is(result, true);49});50test('checkRun return true if argument is a valid run', t => {51 const result = checkRun('9');52 t.is(result, true);53});54test('checkRun return true if argument is a valid run', t => {55 const result = checkRun('10');56 t.is(result, true);57});58test('checkRun return true if argument is a valid run', t => {59 const result = checkRun('11');60 t.is(result, true);

Full Screen

Using AI Code Generation

copy

Full Screen

1const available = require('./Available');2const availableObj = new available();3const result = availableObj.checkRun(10);4console.log(result);5class Available {6 checkRun(number) {7 return number % 2 === 0 ? 'even' : 'odd';8 }9}10module.exports = Available;11import available from './Available';12const availableObj = new available();13const result = availableObj.checkRun(10);14console.log(result);15class Available {16 checkRun(number) {17 return number % 2 === 0 ? 'even' : 'odd';18 }19}20export default Available;21In this example, we have created two files one is test.js and another is Available.js . In the test.js file, we are using the checkRun method of Available class. To use the checkRun method of Available class in test.js file, we have to import the Available class in test.js

Full Screen

Using AI Code Generation

copy

Full Screen

1const test = require('ava');2const checkRun = test.checkRun;3test('checkRun', t => {4 t.is(checkRun(), true);5});6### `checkRun()`7Returns `true` if the current test file is run by [`ava`](

Full Screen

Using AI Code Generation

copy

Full Screen

1var available = require('./available.js');2var check = available.checkRun('test');3if(check == 'true'){4 console.log('user is available');5}else{6 console.log('user is not available');7}8var available = require('./available.js');9var check = available.checkRun('test');10if(check == 'true'){11 console.log('user is available');12}else{13 console.log('user is not available');14}15var available = require('./available.js');16var check = available.checkRun('test');17if(check == 'true'){18 console.log('user is available');19}else{20 console.log('user is not available');21}22var available = require('./available.js');23var check = available.checkRun('test');24if(check == 'true'){25 console.log('user is available');26}else{27 console.log('user is not available');28}

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run ava automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful