|
1 | 1 | name: Check pull requests
|
2 | 2 | on:
|
3 | 3 | pull_request:
|
4 |
| - types: [opened, edited, labeled, unlabeled] |
| 4 | + types: [opened, edited, ready_for_review, labeled, unlabeled] |
5 | 5 | branches:
|
6 | 6 | - master
|
7 | 7 | - release/v*
|
@@ -38,14 +38,22 @@ jobs:
|
38 | 38 | if (titleCheckFailed) {
|
39 | 39 | core.setFailed('Please remove the tag from the pull request title.')
|
40 | 40 | }
|
| 41 | + // Check body does |
| 42 | + const linkingKeywords = ['closes', 'closed', 'fix', 'fixes', 'fixed', 'resolve', 'resolves', 'resolved'] |
| 43 | + const body = context.payload.pull_request.body |
| 44 | + const bodyCheckFailed = linkingKeywords.some(keyword => body.search(new RegExp(`${keyword}\\s\\d+`, "im")) !== -1) |
| 45 | + if (bodyCheckFailed) { |
| 46 | + core.setFailed('Please remove the issue linking keyword from the pull request body.') |
| 47 | + } |
41 | 48 | // Add comment to the pull request
|
42 |
| - if (labelsCheckFailed || titleCheckFailed) { |
| 49 | + if (labelsCheckFailed || titleCheckFailed || bodyCheckFailed) { |
43 | 50 | // Define comment body
|
44 | 51 | const commentMarker = '<!-- dd-trace-java-check-pull-requests-workflow -->'
|
45 | 52 | const commentBody = 'Hi! 👋 Thanks for your pull request! 🎉\n\n' +
|
46 | 53 | 'To help us review it, please make sure to:\n\n' +
|
47 | 54 | (labelsCheckFailed ? '* Add at least one type, and one component or instrumentation label to the pull request\n' : '') +
|
48 | 55 | (titleCheckFailed ? '* Remove the tag from the pull request title\n' : '') +
|
| 56 | + (bodyCheckFailed ? '* Remove the issue linking keyword\n' : '') + |
49 | 57 | '\nIf you need help, please check our [contributing guidelines](https://github.com/DataDog/dd-trace-java/blob/master/CONTRIBUTING.md).' +
|
50 | 58 | '\n\n' + commentMarker
|
51 | 59 | // Look for previous comment
|
|
0 commit comments