Skip to content

Commit

Permalink
chore: enhance logging of PR numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
dsanders11 committed Feb 5, 2025
1 parent 616624e commit a578d40
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,14 @@ const submitFeedbackForPR = async (
export const probotRunner = (app: Probot) => {
app.on('pull_request', async (context) => {
const pr = context.payload.pull_request;
const repo = context.payload.repository.full_name;

Check failure on line 76 in src/index.ts

View workflow job for this annotation

GitHub Actions / build

test/comment.test.ts > probotRunner > should add "Notes: none" to Dependabot PR body

AggregateError: TypeError: Cannot read properties of undefined (reading 'full_name') at /home/runner/work/clerk/clerk/src/index.ts:76:45 at /home/runner/work/clerk/clerk/node_modules/@octokit/webhooks/dist-node/index.js:424:14 at async Promise.all (index 0) at /home/runner/work/clerk/clerk/test/comment.test.ts:98:5 at file:///home/runner/work/clerk/clerk/node_modules/@vitest/runner/dist/index.js:533:5 at runTest (file:///home/runner/work/clerk/clerk/node_modules/@vitest/runner/dist/index.js:1056:11) at runSuite (file:///home/runner/work/clerk/clerk/node_modules/@vitest/runner/dist/index.js:1205:15) at runSuite (file:///home/runner/work/clerk/clerk/node_modules/@vitest/runner/dist/index.js:1205:15) at runFiles (file:///home/runner/work/clerk/clerk/node_modules/@vitest/runner/dist/index.js:1262:5) at startTests (file:///home/runner/work/clerk/clerk/node_modules/@vitest/runner/dist/index.js:1271:3) ❯ src/index.ts:76:45 ❯ node_modules/@octokit/webhooks/dist-node/index.js:424:14 ❯ test/comment.test.ts:98:5 ❯ node_modules/@octokit/webhooks/dist-node/index.js:431:19 ❯ test/comment.test.ts:98:5 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { _errors: [ { stack: 'TypeError: Cannot read properties of undefined (reading \'full_name\')\n at /home/runner/work/clerk/clerk/src/index.ts:76:45\n at /home/runner/work/clerk/clerk/node_modules/@octokit/webhooks/dist-node/index.js:424:14\n at async Promise.all (index 0)\n at /home/runner/work/clerk/clerk/test/comment.test.ts:98:5\n at file:///home/runner/work/clerk/clerk/node_modules/@vitest/runner/dist/index.js:533:5\n at runTest (file:///home/runner/work/clerk/clerk/node_modules/@vitest/runner/dist/index.js:1056:11)\n at runSuite (file:///home/runner/work/clerk/clerk/node_modules/@vitest/runner/dist/index.js:1205:15)\n at runSuite (file:///home/runner/work/clerk/clerk/node_modules/@vitest/runner/dist/index.js:1205:15)\n at runFiles (file:///home/runner/work/clerk/clerk/node_modules/@vitest/runner/dist/index.js:1262:5)\n at startTests (file:///home/runner/work/clerk/clerk/node_modules/@vitest/runner/dist/index.js:1271:3)', message: 'Cannot read properties of undefined (reading \'full_name\')', event: { id: '123', name: 'pull_request', payload: { action: 'opened', pull_request: { number: 1, title: 'chore(deps): bump lodash from 4.17.15 to 4.17.19', body: 'Update lodash to the latest version', user: { login: 'dependabot[bot]' } } } }, constructor: 'Function<TypeError>', name: 'TypeError', toString: 'Function<toString>' } ], event: { id: '123', name: 'pull_request', payload: { action: 'opened', pull_request: { number: 1, title: 'chore(deps): bump lodash from 4.17.15 to 4.17.19', body: 'Update lodash to the latest version', user: { login: 'dependabot[bot]' } } } }, errors: [ { stack: 'TypeError: Cannot read properties of undefined (reading \'full_name\')\n at /home/runner/work/clerk/clerk/src/index.ts:76:45\n at /home/runner/work/clerk/clerk/node_modules/@octokit/webhooks/dist-node/index.js:424:14\n at async Promise.all (index 0)\n at /home/runner/work/clerk/clerk/test/comment.test.ts:98:5\n at file:///home/runner/work/clerk/clerk/node_modules/@vitest/runner/dist/index.js:533:5\n at runTest (file:///home/runner/work/clerk/clerk/node_modules/@vitest/runner/dist/index.js:1056:11)\n at runSuite (file:///home/runner/work/clerk/clerk/node_modules/@vitest/runner/dist/index.js:1205:15)\n at runSuite (file:///home/runner/work/clerk/clerk/node_modules/@vitest/runner/dist/index.js:1205:15)\n at runFiles (file:///home/runner/work/clerk/clerk/node_modules/@vitest/runner/dist/index.js:1262:5)\n at startTests (file:///home/runner/work/clerk/clerk/node_modules/@vitest/runner/dist/index.js:1271:3)', message: 'Cannot read properties of undefined (reading \'full_name\')', event: { id: '123', name: 'pull_request', payload: { action: 'opened', pull_request: { number: 1, title: 'chore(deps): bump lodash from 4.17.15 to 4.17.19', body: 'Update lodash to the latest

Check failure on line 76 in src/index.ts

View workflow job for this annotation

GitHub Actions / build

test/comment.test.ts > probotRunner > should add "Notes: none" to build PR body

AggregateError: TypeError: Cannot read properties of undefined (reading 'full_name') at /home/runner/work/clerk/clerk/src/index.ts:76:45 at /home/runner/work/clerk/clerk/node_modules/@octokit/webhooks/dist-node/index.js:424:14 at async Promise.all (index 0) at /home/runner/work/clerk/clerk/test/comment.test.ts:126:5 at file:///home/runner/work/clerk/clerk/node_modules/@vitest/runner/dist/index.js:533:5 at runTest (file:///home/runner/work/clerk/clerk/node_modules/@vitest/runner/dist/index.js:1056:11) at runSuite (file:///home/runner/work/clerk/clerk/node_modules/@vitest/runner/dist/index.js:1205:15) at runSuite (file:///home/runner/work/clerk/clerk/node_modules/@vitest/runner/dist/index.js:1205:15) at runFiles (file:///home/runner/work/clerk/clerk/node_modules/@vitest/runner/dist/index.js:1262:5) at startTests (file:///home/runner/work/clerk/clerk/node_modules/@vitest/runner/dist/index.js:1271:3) ❯ src/index.ts:76:45 ❯ node_modules/@octokit/webhooks/dist-node/index.js:424:14 ❯ test/comment.test.ts:126:5 ❯ node_modules/@octokit/webhooks/dist-node/index.js:431:19 ❯ test/comment.test.ts:126:5 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { _errors: [ { stack: 'TypeError: Cannot read properties of undefined (reading \'full_name\')\n at /home/runner/work/clerk/clerk/src/index.ts:76:45\n at /home/runner/work/clerk/clerk/node_modules/@octokit/webhooks/dist-node/index.js:424:14\n at async Promise.all (index 0)\n at /home/runner/work/clerk/clerk/test/comment.test.ts:126:5\n at file:///home/runner/work/clerk/clerk/node_modules/@vitest/runner/dist/index.js:533:5\n at runTest (file:///home/runner/work/clerk/clerk/node_modules/@vitest/runner/dist/index.js:1056:11)\n at runSuite (file:///home/runner/work/clerk/clerk/node_modules/@vitest/runner/dist/index.js:1205:15)\n at runSuite (file:///home/runner/work/clerk/clerk/node_modules/@vitest/runner/dist/index.js:1205:15)\n at runFiles (file:///home/runner/work/clerk/clerk/node_modules/@vitest/runner/dist/index.js:1262:5)\n at startTests (file:///home/runner/work/clerk/clerk/node_modules/@vitest/runner/dist/index.js:1271:3)', message: 'Cannot read properties of undefined (reading \'full_name\')', event: { id: '123', name: 'pull_request', payload: { action: 'opened', pull_request: { number: 1, title: 'build: Build PR', body: 'Fix something to do with GitHub Actions', user: { login: 'codebytere' } } } }, constructor: 'Function<TypeError>', name: 'TypeError', toString: 'Function<toString>' } ], event: { id: '123', name: 'pull_request', payload: { action: 'opened', pull_request: { number: 1, title: 'build: Build PR', body: 'Fix something to do with GitHub Actions', user: { login: 'codebytere' } } } }, errors: [ { stack: 'TypeError: Cannot read properties of undefined (reading \'full_name\')\n at /home/runner/work/clerk/clerk/src/index.ts:76:45\n at /home/runner/work/clerk/clerk/node_modules/@octokit/webhooks/dist-node/index.js:424:14\n at async Promise.all (index 0)\n at /home/runner/work/clerk/clerk/test/comment.test.ts:126:5\n at file:///home/runner/work/clerk/clerk/node_modules/@vitest/runner/dist/index.js:533:5\n at runTest (file:///home/runner/work/clerk/clerk/node_modules/@vitest/runner/dist/index.js:1056:11)\n at runSuite (file:///home/runner/work/clerk/clerk/node_modules/@vitest/runner/dist/index.js:1205:15)\n at runSuite (file:///home/runner/work/clerk/clerk/node_modules/@vitest/runner/dist/index.js:1205:15)\n at runFiles (file:///home/runner/work/clerk/clerk/node_modules/@vitest/runner/dist/index.js:1262:5)\n at startTests (file:///home/runner/work/clerk/clerk/node_modules/@vitest/runner/dist/index.js:1271:3)', message: 'Cannot read properties of undefined (reading \'full_name\')', event: { id: '123', name: 'pull_request', payload: { action: 'opened', pull_request: { number: 1, title: 'build: Build PR', body: 'Fix something to do with GitHub Actions', user: { login: 'codebytere' } } } }, constructor: 'Function<TypeError>', name: 'Ty

if (context.payload.action === 'closed' && pr.merged) {
debug(`Checking release notes comment on PR #${pr.number}`);
debug(`Checking release notes comment on PR ${repo}#${pr.number}`);
await submitFeedbackForPR(context, pr, true);
} else if (!pr.merged && pr.state === 'open') {
// Only submit feedback for PRs that aren't merged and are open
debug(`Checking & posting release notes comment on PR #${pr.number}`);
debug(`Checking & posting release notes comment on PR ${repo}#${pr.number}`);
await submitFeedbackForPR(context, pr);
}
});
Expand Down

0 comments on commit a578d40

Please sign in to comment.