Skip to content

Commit 739b2e4

Browse files
committed
snapshot uploading: log both ahead/behind by numbers
This should help with debugging in the future, should the need arise again. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent df801d0 commit 739b2e4

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

GitForWindowsHelper/cascading-runs.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,15 +166,15 @@ const cascadingRuns = async (context, req) => {
166166

167167
// Next, check that the commit is on the `main` branch
168168
const gitToken = await getToken(context, checkRunOwner, checkRunRepo)
169-
const { ahead_by } = await githubApiRequest(
169+
const { ahead_by, behind_by } = await githubApiRequest(
170170
context,
171171
gitToken,
172172
'GET',
173173
`/repos/${checkRunOwner}/${checkRunRepo}/compare/HEAD...${commit}`,
174174
// `/repos/dscho/git/compare/HEAD...${commit}`,
175175
)
176176
if (ahead_by > 0) {
177-
return `Ignoring ${name} check-run because its corresponding commit ${commit} is not on the main branch`
177+
return `Ignoring ${name} check-run because its corresponding commit ${commit} is not on the main branch (ahead by ${ahead_by}, behind by ${behind_by})`
178178
}
179179

180180
const workFlowRunIDs = {}
@@ -246,7 +246,7 @@ const cascadingRuns = async (context, req) => {
246246
}
247247
)
248248

249-
return `The 'upload-snapshot' workflow run was started at ${answer.html_url}`
249+
return `The 'upload-snapshot' workflow run was started at ${answer.html_url} (ahead by ${ahead_by}, behind by ${behind_by})`
250250
}
251251
return `Not a cascading run: ${name}; Doing nothing.`
252252
}

__tests__/index.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ The \`git-artifacts-aarch64\` workflow run [was started](dispatched-workflow-git
175175
}
176176
if (method === 'GET' && requestPath ===
177177
'/repos/git-for-windows/git/compare/HEAD...0c796d3013a57e8cc894c152f0200107226e5dd1') {
178-
return { ahead_by: 0 }
178+
return { ahead_by: 0, behind_by: 99 }
179179
}
180180
throw new Error(`Unhandled ${method}-${requestPath}-${JSON.stringify(payload)}`)
181181
})
@@ -994,7 +994,7 @@ test('the third completed `git-artifacts-<arch>` check-run triggers an `upload-s
994994
try {
995995
expect(await index(context, context.req)).toBeUndefined()
996996
expect(context.res).toEqual({
997-
body: `The 'upload-snapshot' workflow run was started at dispatched-workflow-upload-snapshot.yml`,
997+
body: `The 'upload-snapshot' workflow run was started at dispatched-workflow-upload-snapshot.yml (ahead by 0, behind by 99)`,
998998
headers: undefined,
999999
status: undefined
10001000
})

0 commit comments

Comments
 (0)