You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

677 lines
19KB

  1. bot: "webpack-bot"
  2. rules:
  3. # Add ci-ok, ci-not-ok labels depending on travis status
  4. # comment to point the user to the results
  5. # comment in case of success
  6. - filters:
  7. open: true
  8. pull_request:
  9. mergeable: true
  10. status_1:
  11. context: "continuous-integration/travis-ci/pr"
  12. status_2:
  13. context: "continuous-integration/appveyor/pr"
  14. ensure_1:
  15. value: "{{status_1.state}}"
  16. equals: "success"
  17. ensure_2:
  18. value: "{{status_2.state}}"
  19. equals: "success"
  20. actions:
  21. label:
  22. add: "PR: CI-ok"
  23. remove: "PR: CI-not-ok"
  24. comment:
  25. identifier: "ci-result"
  26. message: |-
  27. Thank you for your pull request! The most important CI builds succeeded, we’ll review the pull request soon.
  28. - filters:
  29. open: true
  30. pull_request:
  31. mergeable: true
  32. status_1:
  33. context: "continuous-integration/travis-ci/pr"
  34. status_2:
  35. context: "continuous-integration/appveyor/pr"
  36. any:
  37. ensure_1:
  38. value: "{{status_1.state}}"
  39. equals: "failure"
  40. ensure_2:
  41. value: "{{status_2.state}}"
  42. equals: "failure"
  43. not:
  44. any:
  45. ensure_3:
  46. value: "{{status_1.state}}"
  47. equals: "pending"
  48. ensure_4:
  49. value: "{{status_2.state}}"
  50. equals: "pending"
  51. actions:
  52. label:
  53. add: "PR: CI-not-ok"
  54. remove: "PR: CI-ok"
  55. set:
  56. id: report_ci
  57. value: yep
  58. # Report specific error message if jest for basic tests fails
  59. - filters:
  60. ensure:
  61. value: "{{report_ci}}"
  62. equals: yep
  63. commit: true
  64. status:
  65. context: "continuous-integration/travis-ci/pr"
  66. travis_job:
  67. state: "failed"
  68. allow_failure: false
  69. config:
  70. env: JOB_PART=basic
  71. fetch: travis_job.log
  72. string_cleanup:
  73. id: logResult
  74. value: "{{{fetch}}}"
  75. remove:
  76. - ".\\[2K.\\[1G|.\\[999D.\\[K"
  77. - "^[\\s\\S]+?\\$ yarn travis:\\$JOB_PART.*\n"
  78. - "\\$ node --max-old-space-size=4096.*\n"
  79. - ".+rimraf coverage"
  80. - "yarn run.+\n"
  81. - "\\(node:\\d+\\) (\\[DEP0005\\]|DeprecationWarning).+\n"
  82. - "\\$ yarn (cover|test):.+\n"
  83. - "Ran all test suites.\n[\\s\\S]*"
  84. - "error Command failed with exit code \\d+.\n"
  85. - "info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.\n"
  86. - "Force exiting Jest\n\nHave you considered.+"
  87. - "=============================== Coverage summary ===============================[\\s\\S]+?================================================================================"
  88. - " *PASS *test/.*\n"
  89. - "^\\s+\n|\\s+$"
  90. string_cleanup_1:
  91. id: firstError
  92. value: "{{{logResult}}}"
  93. remove:
  94. - "\n\n( ●| FAIL)[\\s\\S]*"
  95. - "Test Suites:[\\s\\S]*"
  96. - "\\s+$"
  97. string_cleanup_2:
  98. id: remainingErrors
  99. value: "{{{logResult}}}"
  100. remove:
  101. - "^[\\s\\S]+?(?=\n\n( ●| FAIL)|$)"
  102. - "^\n+"
  103. - "Test Suites:[\\s\\S]*"
  104. - "\\s+$"
  105. string_cleanup_3:
  106. id: summary
  107. value: "{{{logResult}}}"
  108. remove:
  109. - "^[\\s\\S]+?(?=Test Suites:)"
  110. - "\\s+$"
  111. actions:
  112. comment:
  113. identifier: "ci-result"
  114. message: |-
  115. The basic integration tests failed.
  116. @{{commit.author.login}} Please review the following output log for errors:
  117. ```text
  118. {{{firstError}}}
  119. ```
  120. {{#if remainingErrors}}
  121. <details>
  122. <summary>Show remaining errors</summary>
  123. ```text
  124. {{{remainingErrors}}}
  125. ```
  126. </details>
  127. {{/if}}
  128. ```text
  129. {{{summary}}}
  130. ```
  131. See [complete report here]({{status.target_url}}).
  132. set:
  133. id: report_ci
  134. value: nope
  135. # Report specific error message if jest for integration tests fails
  136. - filters:
  137. ensure:
  138. value: "{{report_ci}}"
  139. equals: yep
  140. commit: true
  141. status:
  142. context: "continuous-integration/travis-ci/pr"
  143. travis_job:
  144. state: "failed"
  145. allow_failure: false
  146. config:
  147. env: JOB_PART=integration
  148. fetch: travis_job.log
  149. string_cleanup:
  150. id: logResult
  151. value: "{{{fetch}}}"
  152. remove:
  153. - ".\\[2K.\\[1G|.\\[999D.\\[K"
  154. - "^[\\s\\S]+?\\$ yarn travis:\\$JOB_PART.*\n"
  155. - "\\$ node --max-old-space-size=4096.*\n"
  156. - ".+rimraf coverage"
  157. - "yarn run.+\n"
  158. - "\\(node:\\d+\\) (\\[DEP0005\\]|DeprecationWarning).+\n"
  159. - "\\$ yarn (cover|test):.+\n"
  160. - "The command \"yarn travis:\\$JOB_PART\" exited[\\s\\S]*"
  161. - "Ran all test suites.+\n"
  162. - "error Command failed with exit code \\d+.\n"
  163. - "info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.\n"
  164. - "Force exiting Jest\n\nHave you considered.+"
  165. - "=============================== Coverage summary ===============================[\\s\\S]+?================================================================================"
  166. - " *PASS *test/.*\n"
  167. - "^\\s+\n|\\s+$"
  168. string_cleanup_1:
  169. id: firstError
  170. value: "{{{logResult}}}"
  171. remove:
  172. - "\n\n( ●| FAIL)[\\s\\S]*"
  173. - "Test Suites:[\\s\\S]*"
  174. - "\\s+$"
  175. string_cleanup_2:
  176. id: remainingErrors
  177. value: "{{{logResult}}}"
  178. remove:
  179. - "^[\\s\\S]+?(?=\n\n( ●| FAIL)|$)"
  180. - "^\n+"
  181. - "Test Suites:[\\s\\S]*"
  182. - "\\s+$"
  183. string_cleanup_3:
  184. id: summary
  185. value: "{{{logResult}}}"
  186. remove:
  187. - "^[\\s\\S]+?(?=Test Suites:)"
  188. - "\\s+$"
  189. actions:
  190. comment:
  191. identifier: "ci-result"
  192. message: |-
  193. The basic integration tests succeeded, but the full suite failed.
  194. @{{commit.author.login}} Please review the following output log for errors:
  195. ```text
  196. {{{firstError}}}
  197. ```
  198. {{#if remainingErrors}}
  199. <details>
  200. <summary>Show remaining errors</summary>
  201. ```text
  202. {{{remainingErrors}}}
  203. ```
  204. </details>
  205. {{/if}}
  206. ```text
  207. {{{summary}}}
  208. ```
  209. See [complete report here]({{status.target_url}}).
  210. set:
  211. id: report_ci
  212. value: nope
  213. # Report specific error message if jest for unit tests or liniting fails
  214. - filters:
  215. ensure:
  216. value: "{{report_ci}}"
  217. equals: yep
  218. commit: true
  219. status:
  220. context: "continuous-integration/travis-ci/pr"
  221. travis_job:
  222. state: "failed"
  223. allow_failure: false
  224. config:
  225. env: JOB_PART=lint-unit
  226. fetch: travis_job.log
  227. string_cleanup:
  228. id: logResult
  229. value: "{{{fetch}}}"
  230. remove:
  231. - ".\\[2K.\\[1G|.\\[999D.\\[K"
  232. - "^[\\s\\S]+?\\$ yarn travis:\\$JOB_PART.*\n"
  233. - "\\$ node --max-old-space-size=4096.*\n"
  234. - ".+rimraf coverage"
  235. - "yarn run.+\n"
  236. - "\\(node:\\d+\\) (\\[DEP0005\\]|DeprecationWarning).+\n"
  237. - "\\$ yarn (unit|lint).+\n"
  238. - "The command \"yarn travis:\\$JOB_PART\" exited[\\s\\S]*"
  239. - "Ran all test suites.+\n"
  240. - "error Command failed with exit code \\d+.\n"
  241. - "info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.\n"
  242. - "Force exiting Jest\n\nHave you considered.+"
  243. - "=============================== Coverage summary ===============================[\\s\\S]+?================================================================================"
  244. - " *PASS *test/.*\n"
  245. - "^\\s+\n|\\s+$"
  246. actions:
  247. comment:
  248. identifier: "ci-result"
  249. message: |-
  250. The integration tests look fine, but there are code style issues or unit test failures in the Pull Request.
  251. @{{commit.author.login}} Please review the following output log for errors:
  252. ``` text
  253. {{{logResult}}}
  254. ```
  255. If the unit tests are outdated, you can choose to delete them and add integration tests instead. That would be great.
  256. See [complete report here]({{status.target_url}}).
  257. set:
  258. id: report_ci
  259. value: nope
  260. # Report a general error message
  261. - filters:
  262. ensure:
  263. value: "{{report_ci}}"
  264. equals: yep
  265. commit: true
  266. status_1:
  267. context: "continuous-integration/travis-ci/pr"
  268. status_2:
  269. context: "continuous-integration/appveyor/pr"
  270. actions:
  271. comment:
  272. identifier: "ci-result"
  273. message: |-
  274. @{{commit.author.login}} The most important CI builds failed. This way your PR can't be merged.
  275. Please take a look at the CI results from [travis]({{status_1.target_url}}) ({{status_1.state}}) and [appveyor]({{status_2.target_url}}) ({{status_2.state}}) and fix these issues.
  276. # Add tests-needed label depending on codecov status
  277. # comment to point the user writing test cases
  278. # comment in case of success
  279. - filters:
  280. open: true
  281. pull_request:
  282. mergeable: true
  283. status:
  284. context: "codecov/patch/integration"
  285. ensure:
  286. value: "{{status.state}}"
  287. equals: "success"
  288. label: "PR: tests-needed"
  289. actions:
  290. label:
  291. remove: "PR: tests-needed"
  292. comment:
  293. identifier: "tests-result"
  294. message: |-
  295. The minimum test ratio has been reached. Thanks!
  296. - filters:
  297. open: true
  298. pull_request:
  299. mergeable: true
  300. status:
  301. context: "codecov/patch/integration"
  302. ensure:
  303. value: "{{status.state}}"
  304. equals: "failure"
  305. actions:
  306. label:
  307. add: "PR: tests-needed"
  308. - filters:
  309. open: true
  310. pull_request:
  311. mergeable: true
  312. status:
  313. context: "codecov/patch/integration"
  314. ensure:
  315. value: "{{status.state}}"
  316. equals: "failure"
  317. age:
  318. value: "{{status.created_at}}"
  319. minimum: 1h
  320. permission: "read|none"
  321. actions:
  322. comment:
  323. identifier: "tests-result"
  324. message: |-
  325. It looks like this Pull Request doesn't include [enough test cases]({{status.target_url}}) (based on Code Coverage analysis of the PR diff).
  326. A PR need to be covered by tests if you add a new feature (we want to make sure that your feature is working) or if you fix a bug (we want to make sure that we don't run into a regression in future).
  327. @{{issue.user.login}} Please check if this is appliable to your PR and if you can add more test cases.
  328. Read the [test readme](https://github.com/webpack/webpack/blob/master/test/README.md) for details how to write test cases.
  329. # add conflict label to pull requests with conflict
  330. # on conflict all result labels are removed
  331. - filters:
  332. open: true
  333. pull_request:
  334. mergeable: false
  335. actions:
  336. label:
  337. add: "PR: conflict"
  338. remove:
  339. - "PR: tests-needed"
  340. - "PR: CI-ok"
  341. - "PR: CI-not-ok"
  342. - filters:
  343. open: true
  344. pull_request:
  345. mergeable: true
  346. actions:
  347. label:
  348. remove: "PR: conflict"
  349. # add unreviewed, reviewed, review-outdated labels
  350. # comment to ping reviewer
  351. # comment on new PR
  352. - filters:
  353. open: true
  354. in_order:
  355. commit: true
  356. review:
  357. state: APPROVED|CHANGES_REQUESTED
  358. ensure:
  359. value: "{{review.state}}"
  360. equals: APPROVED
  361. permission:
  362. user: "{{review.user.login}}"
  363. actions:
  364. label:
  365. add: "PR: reviewed-approved"
  366. remove:
  367. - "PR: review-outdated"
  368. - "PR: unreviewed"
  369. - "PR: reviewed"
  370. - filters:
  371. open: true
  372. in_order:
  373. commit: true
  374. review:
  375. state: APPROVED|CHANGES_REQUESTED
  376. permission:
  377. user: "{{review.user.login}}"
  378. ensure:
  379. value: "{{review.state}}"
  380. equals: CHANGES_REQUESTED
  381. actions:
  382. label:
  383. add: "PR: reviewed-changes-requested"
  384. remove:
  385. - "PR: review-outdated"
  386. - "PR: unreviewed"
  387. - "PR: reviewed"
  388. - filters:
  389. open: true
  390. in_order:
  391. review:
  392. state: APPROVED|CHANGES_REQUESTED
  393. commit: true
  394. permission:
  395. user: "{{review.user.login}}"
  396. not:
  397. label: "review-outdated"
  398. ensure:
  399. value: "{{commit.author.login}}"
  400. notEquals: "{{review.user.login}}"
  401. actions:
  402. label:
  403. add: "PR: review-outdated"
  404. remove:
  405. - "PR: reviewed-approved"
  406. - "PR: reviewed-changes-requested"
  407. - "PR: unreviewed"
  408. - "PR: reviewed"
  409. comment:
  410. identifier: "review-outdated"
  411. message: |-
  412. @{{commit.author.login}} Thanks for your update.
  413. I labeled the Pull Request so reviewers will review it again.
  414. @{{review.user.login}} Please review the new changes.
  415. - filters:
  416. open: true
  417. commit: true
  418. not:
  419. review:
  420. state: APPROVED|CHANGES_REQUESTED
  421. actions:
  422. label: "PR: unreviewed"
  423. # add non-master and next label to pull request to other branch
  424. - filters:
  425. pull_request:
  426. base_ref: "^master$"
  427. actions:
  428. label:
  429. remove: "PR: non-master"
  430. - filters:
  431. pull_request:
  432. base_ref: "^next$"
  433. actions:
  434. label:
  435. add: "PR: next"
  436. remove: "PR: non-master"
  437. - filters:
  438. pull_request:
  439. base_ref: "^(?!master$)(?!next$)"
  440. actions:
  441. label:
  442. add: "PR: non-master"
  443. remove: "PR: next"
  444. # add non-master label to pull request to other branch
  445. - filters:
  446. open: true
  447. age:
  448. minimum: 1d
  449. maximum: 1w
  450. pull_request:
  451. head_ref: "^master$"
  452. permission: "read|none"
  453. actions:
  454. comment:
  455. identifier: "head-master"
  456. edit: true
  457. message: |-
  458. Hi @{{pull_request.user.login}}.
  459. Just a little hint from a friendly bot about the best practice when submitting pull requests:
  460. > Don't submit pull request from your own `master` branch. It's recommended to create a feature branch for the PR.
  461. *You don't have to change it for this PR, just make sure to follow this hint the next time you submit a PR.*
  462. # skip CLA for dependabot
  463. - filters:
  464. open: true
  465. pull_request:
  466. author: "^dependabot(-preview)?\\[bot\\]$"
  467. status:
  468. context: "licence/cla"
  469. state: "pending"
  470. actions:
  471. status:
  472. context: "licence/cla"
  473. description: "Contributor License Agreement is not needed for this user."
  474. state: "success"
  475. # merge dependabot PRs automatically
  476. - filters:
  477. open: true
  478. pull_request:
  479. author: "^dependabot(-preview)?\\[bot\\]$"
  480. mergeable_state: clean
  481. merged: false
  482. label: "PR: CI-ok"
  483. actions:
  484. merge: true
  485. # add "Send a PR" label when somebody with write permission say it
  486. - filters:
  487. open: true
  488. comment: "[Ss]end a [Pp][Rr]"
  489. permission:
  490. user: "{{comment.actor.login}}"
  491. actions:
  492. label: "Send a PR"
  493. # Move issue task
  494. - filters:
  495. open: true
  496. comment: "\\s*@webpack-bot\\s+move\\s+(?:to\\s+)?([a-z0-9_\\-\\.]+/[a-z0-9_\\-\\.]+)\\s*([\\s\\S]*)$"
  497. not:
  498. comment_1:
  499. matching: "moved\\-by\\-bot"
  500. author: "."
  501. permission:
  502. user: "{{comment.actor.login}}"
  503. actions:
  504. new_issue:
  505. target: "{{{comment_match.[1]}}}"
  506. body: |-
  507. {{{issue.body}}}
  508. ---
  509. This issue was moved from {{owner}}/{{repo}}#{{issue.number}} by @{{comment.actor.login}}. Original issue was by @{{issue.user.login}}.
  510. {{{comment_match.[2]}}}
  511. comment:
  512. identifier: moved-by-bot
  513. message: |-
  514. I've moved it to {{comment_match.[1]}}.
  515. close: true
  516. # mark inactive issues with inactive label
  517. # close them when no activity after warning
  518. - filters:
  519. issue: true
  520. open: true
  521. not:
  522. label: inactive
  523. ensure:
  524. value: "{{issue.reactions.[+1]}}"
  525. range: "< 10"
  526. last_action_age: 13w # three months
  527. actions:
  528. comment:
  529. identifier: inactive-warning
  530. message: |-
  531. **This issue had no activity for at least three months.**
  532. It's subject to automatic issue closing if there is no activity in the next 15 days.
  533. label: inactive
  534. - filters:
  535. open: true
  536. label: inactive
  537. last_action_age:
  538. maximum: 13w # three months
  539. actions:
  540. label:
  541. remove:
  542. - inactive
  543. - filters:
  544. open: true
  545. label: inactive
  546. last_action_age:
  547. minimum: 15d
  548. includeBotActions: true
  549. actions:
  550. close: true
  551. comment:
  552. identifier: inactive-close
  553. message: |-
  554. Issue was closed because of inactivity.
  555. If you think this is still a valid issue, please file a new issue with additional information.
  556. # Add action actions box to each pull request
  557. - filters:
  558. pull_request: true
  559. open: true
  560. not:
  561. comment:
  562. matching: admin-actions
  563. author: webpack-bot
  564. actions:
  565. comment:
  566. identifier: admin-actions
  567. message: |-
  568. *For maintainers only:*
  569. * [ ] <!-- document --> This needs to be documented (issue in webpack/webpack.js.org will be filed when merged)
  570. * [ ] <!-- webpack-4-backport --> This needs to be backported to webpack 4 (issue will be created when merged)
  571. # When a pull request need to be documented, create an issue in webpack/webpack.js.org when merged
  572. - filters:
  573. pull_request:
  574. merged: true
  575. comment:
  576. author: webpack-bot
  577. matching: "\\* \\[x\\] <!-- document -->"
  578. not:
  579. comment_1:
  580. author: webpack-bot
  581. matching: admin-action-document-executed
  582. actions:
  583. new_issue:
  584. target: webpack/webpack.js.org
  585. title: "Document webpack change: {{{pull_request.title}}}"
  586. body: |-
  587. <!-- documentation request from webpack/webpack -->
  588. *A pull request by @{{pull_request.user.login}} was merged and maintainers requested a documentation change.*
  589. See pull request: {{{pull_request.html_url}}}
  590. ---
  591. {{{pull_request.body}}}
  592. comment:
  593. identifier: admin-action-document-executed
  594. message: |-
  595. I've created an issue to document this in webpack/webpack.js.org.
  596. # When a pull request need to be backported, create an issue in webpack/webpack when merged
  597. - filters:
  598. pull_request:
  599. merged: true
  600. comment:
  601. author: webpack-bot
  602. matching: "\\* \\[x\\] <!-- webpack-4-backport -->"
  603. not:
  604. comment_1:
  605. author: webpack-bot
  606. matching: admin-action-webpack-4-backport-executed
  607. actions:
  608. new_issue:
  609. target: webpack/webpack
  610. title: "Backport to webpack 4: {{{pull_request.title}}}"
  611. body: |-
  612. {{{pull_request.html_url}}} needs to be backported to webpack 4.
  613. Send a PR.
  614. cc @{{pull_request.user.login}}
  615. comment:
  616. identifier: admin-action-webpack-4-backport-executed
  617. message: |-
  618. I've created an issue to backport this.
  619. # Check open issues and pull requests every day
  620. - filters:
  621. open: true
  622. actions:
  623. schedule: 1d