diff --git a/GitForWindowsHelper/cascading-runs.js b/GitForWindowsHelper/cascading-runs.js index b060a43..35118b1 100644 --- a/GitForWindowsHelper/cascading-runs.js +++ b/GitForWindowsHelper/cascading-runs.js @@ -166,7 +166,7 @@ const cascadingRuns = async (context, req) => { // Next, check that the commit is on the `main` branch const gitToken = await getToken(context, checkRunOwner, checkRunRepo) - const { ahead_by } = await githubApiRequest( + const { ahead_by, behind_by } = await githubApiRequest( context, gitToken, 'GET', @@ -174,7 +174,7 @@ const cascadingRuns = async (context, req) => { // `/repos/dscho/git/compare/HEAD...${commit}`, ) if (ahead_by > 0) { - return `Ignoring ${name} check-run because its corresponding commit ${commit} is not on the main branch` + return `Ignoring ${name} check-run because its corresponding commit ${commit} is not on the main branch (ahead by ${ahead_by}, behind by ${behind_by})` } const workFlowRunIDs = {} @@ -246,7 +246,7 @@ const cascadingRuns = async (context, req) => { } ) - return `The 'upload-snapshot' workflow run was started at ${answer.html_url}` + return `The 'upload-snapshot' workflow run was started at ${answer.html_url} (ahead by ${ahead_by}, behind by ${behind_by})` } return `Not a cascading run: ${name}; Doing nothing.` } diff --git a/__tests__/index.test.js b/__tests__/index.test.js index e149ddf..710f73d 100644 --- a/__tests__/index.test.js +++ b/__tests__/index.test.js @@ -175,7 +175,7 @@ The \`git-artifacts-aarch64\` workflow run [was started](dispatched-workflow-git } if (method === 'GET' && requestPath === '/repos/git-for-windows/git/compare/HEAD...0c796d3013a57e8cc894c152f0200107226e5dd1') { - return { ahead_by: 0 } + return { ahead_by: 0, behind_by: 99 } } throw new Error(`Unhandled ${method}-${requestPath}-${JSON.stringify(payload)}`) }) @@ -994,7 +994,7 @@ test('the third completed `git-artifacts-` check-run triggers an `upload-s try { expect(await index(context, context.req)).toBeUndefined() expect(context.res).toEqual({ - body: `The 'upload-snapshot' workflow run was started at dispatched-workflow-upload-snapshot.yml`, + body: `The 'upload-snapshot' workflow run was started at dispatched-workflow-upload-snapshot.yml (ahead by 0, behind by 99)`, headers: undefined, status: undefined })