MCPcopy
hub / github.com/ampproject/amphtml / printChangeSummary

Function printChangeSummary

build-system/pr-check/utils.js:34–86  ·  view source on GitHub ↗

* Prints a summary of files changed by, and commits included in the PR.

()

Source from the content-addressed store, hash-verified

32 * Prints a summary of files changed by, and commits included in the PR.
33 */
34function 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

Callers 2

runCiJobFunction · 0.85
prCheckFunction · 0.85

Calls 13

getLoggingPrefixFunction · 0.85
isCiBuildFunction · 0.85
logWithoutTimestampFunction · 0.85
cyanFunction · 0.85
shortShaFunction · 0.85
gitCiMainBaselineFunction · 0.85
ciPullRequestShaFunction · 0.85
gitCommitHashFunction · 0.85
gitDiffStatMainFunction · 0.85
gitBranchCreationPointFunction · 0.85
gitBranchNameFunction · 0.85
gitDiffCommitLogFunction · 0.85

Tested by

no test coverage detected