* Prints a summary of files changed by, and commits included in the PR.
()
| 32 | * Prints a summary of files changed by, and commits included in the PR. |
| 33 | */ |
| 34 | function printChangeSummary() { |
| 35 | const loggingPrefix = getLoggingPrefix(); |
| 36 | let commitSha; |
| 37 | |
| 38 | if (isCiBuild()) { |
| 39 | logWithoutTimestamp( |
| 40 | `${loggingPrefix} Latest commit from ${cyan('main')} included ` + |
| 41 | `in this build: ${cyan(shortSha(gitCiMainBaseline()))}` |
| 42 | ); |
| 43 | commitSha = ciPullRequestSha(); |
| 44 | } else { |
| 45 | commitSha = gitCommitHash(); |
| 46 | } |
| 47 | logWithoutTimestamp( |
| 48 | `${loggingPrefix} Testing the following changes at commit ` + |
| 49 | `${cyan(shortSha(commitSha))}` |
| 50 | ); |
| 51 | |
| 52 | const filesChanged = gitDiffStatMain(); |
| 53 | logWithoutTimestamp(filesChanged); |
| 54 | |
| 55 | const branchCreationPoint = gitBranchCreationPoint(); |
| 56 | if (branchCreationPoint) { |
| 57 | logWithoutTimestamp( |
| 58 | `${loggingPrefix} Commit log since branch`, |
| 59 | `${cyan(gitBranchName())} was forked from`, |
| 60 | `${cyan('main')} at`, |
| 61 | `${cyan(shortSha(branchCreationPoint))}:` |
| 62 | ); |
| 63 | logWithoutTimestamp(gitDiffCommitLog() + '\n'); |
| 64 | } else { |
| 65 | logWithoutTimestamp( |
| 66 | loggingPrefix, |
| 67 | yellow('WARNING:'), |
| 68 | 'Could not find a common ancestor for', |
| 69 | cyan(gitBranchName()), |
| 70 | 'and', |
| 71 | cyan('main') + '. (This can happen with older PR branches.)' |
| 72 | ); |
| 73 | logWithoutTimestamp( |
| 74 | loggingPrefix, |
| 75 | yellow('NOTE 1:'), |
| 76 | 'If this causes unexpected test failures, try rebasing the PR branch on', |
| 77 | cyan('main') + '.' |
| 78 | ); |
| 79 | logWithoutTimestamp( |
| 80 | loggingPrefix, |
| 81 | yellow('NOTE 2:'), |
| 82 | "If rebasing doesn't work, you may have to recreate the branch. See", |
| 83 | cyan(GIT_BRANCH_URL) + '.\n' |
| 84 | ); |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | /** |
| 89 | * Signal to dependent jobs that they should be skipped. Uses an identifier that |
no test coverage detected