From 5c91cbd22a1f080c0b2dd553c45b7a9952fbc8f1 Mon Sep 17 00:00:00 2001 From: Fuxing Loh <4266087+fuxingloh@users.noreply.github.com> Date: Sun, 17 Jan 2021 15:05:38 +0800 Subject: [PATCH] feat: status checks (#35) * Added config parsing for checks * added checks with config validation * Added unit test for checks * Updated README.md * fixed payload issue pr number validation * npm run ncc, dist updated Signed-off-by: dist * Updated README.md Co-authored-by: dist --- .github/labeler.yml | 2 +- .idea/inspectionProfiles/Project_Default.xml | 2 +- README.md | 119 +++- __tests__/checks.test.ts | 536 ++++++++++++++++++ __tests__/config.test.ts | 62 +- __tests__/fixtures/checks-always.yml | 5 + __tests__/fixtures/checks-basic.yml | 12 + __tests__/fixtures/checks-failure.yml | 8 + __tests__/fixtures/checks.yml | 14 + __tests__/fixtures/empty.yml | 7 - .../fixtures/invalid/checks-all-invalid.yml | 15 + .../fixtures/invalid/checks-any-invalid.yml | 15 + .../invalid/checks-context-invalid.yml | 15 + .../invalid/checks-context-missing.yml | 15 + .../{labels-missing.yml => checks-empty.yml} | 2 + .../fixtures/invalid/checks-url-invalid.yml | 16 + __tests__/fixtures/labels.yml | 8 + __tests__/fixtures/semantic-release.yml | 31 + dist/index.js | 208 ++++++- dist/index.js.map | 2 +- src/checks.ts | 74 +++ src/config.ts | 34 +- src/labeler.ts | 4 + src/main.ts | 63 +- src/matcher/body.ts | 4 +- src/matcher/branch.ts | 4 +- src/matcher/comment.ts | 4 +- src/matcher/commits.ts | 2 +- src/matcher/files.ts | 4 +- src/matcher/title.ts | 4 +- 30 files changed, 1216 insertions(+), 75 deletions(-) create mode 100644 __tests__/checks.test.ts create mode 100644 __tests__/fixtures/checks-always.yml create mode 100644 __tests__/fixtures/checks-basic.yml create mode 100644 __tests__/fixtures/checks-failure.yml create mode 100644 __tests__/fixtures/checks.yml create mode 100644 __tests__/fixtures/invalid/checks-all-invalid.yml create mode 100644 __tests__/fixtures/invalid/checks-any-invalid.yml create mode 100644 __tests__/fixtures/invalid/checks-context-invalid.yml create mode 100644 __tests__/fixtures/invalid/checks-context-missing.yml rename __tests__/fixtures/invalid/{labels-missing.yml => checks-empty.yml} (57%) create mode 100644 __tests__/fixtures/invalid/checks-url-invalid.yml create mode 100644 __tests__/fixtures/labels.yml create mode 100644 __tests__/fixtures/semantic-release.yml create mode 100644 src/checks.ts diff --git a/.github/labeler.yml b/.github/labeler.yml index 092d2d2..0311068 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -75,7 +75,7 @@ checks: description: success: Ready for review & merge. failure: Missing semantic label for merge. - condition: + labels: any: - feat - fix diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml index 1f28eef..34bd38f 100644 --- a/.idea/inspectionProfiles/Project_Default.xml +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -3,7 +3,7 @@