@@ -519,92 +519,92 @@ export function formatWebhookInput(
519519 }
520520
521521 if ( foundWebhook . provider === 'github' ) {
522- // // GitHub webhook input formatting logic
523- // const eventType = request.headers.get('x-github-event') || 'unknown'
524- // const delivery = request.headers.get('x-github-delivery') || ''
525-
526- // // Extract common GitHub properties
527- // const repository = body?.repository || {}
528- // const sender = body?.sender || {}
529- // const action = body?.action || ''
530-
531- // // Build GitHub-specific variables based on the trigger config outputs
532- // const githubData = {
533- // // Event metadata
534- // event_type: eventType,
535- // action: action,
536- // delivery_id: delivery,
537-
538- // // Repository information (avoid 'repository' to prevent conflict with the object)
539- // repository_full_name: repository.full_name || '',
540- // repository_name: repository.name || '',
541- // repository_owner: repository.owner?.login || '',
542- // repository_id: repository.id || '',
543- // repository_url: repository.html_url || '',
544-
545- // // Sender information (avoid 'sender' to prevent conflict with the object)
546- // sender_login: sender.login || '',
547- // sender_id: sender.id || '',
548- // sender_type: sender.type || '',
549- // sender_url: sender.html_url || '',
550-
551- // // Event-specific data
552- // ...(body?.ref && {
553- // ref: body.ref,
554- // branch: body.ref?.replace('refs/heads/', '') || '',
555- // }),
556- // ...(body?.before && { before: body.before }),
557- // ...(body?.after && { after: body.after }),
558- // ...(body?.commits && {
559- // commits: JSON.stringify(body.commits),
560- // commit_count: body.commits.length || 0,
561- // }),
562- // ...(body?.head_commit && {
563- // commit_message: body.head_commit.message || '',
564- // commit_author: body.head_commit.author?.name || '',
565- // commit_sha: body.head_commit.id || '',
566- // commit_url: body.head_commit.url || '',
567- // }),
568- // ...(body?.pull_request && {
569- // pull_request: JSON.stringify(body.pull_request),
570- // pr_number: body.pull_request.number || '',
571- // pr_title: body.pull_request.title || '',
572- // pr_state: body.pull_request.state || '',
573- // pr_url: body.pull_request.html_url || '',
574- // }),
575- // ...(body?.issue && {
576- // issue: JSON.stringify(body.issue),
577- // issue_number: body.issue.number || '',
578- // issue_title: body.issue.title || '',
579- // issue_state: body.issue.state || '',
580- // issue_url: body.issue.html_url || '',
581- // }),
582- // ...(body?.comment && {
583- // comment: JSON.stringify(body.comment),
584- // comment_body: body.comment.body || '',
585- // comment_url: body.comment.html_url || '',
586- // }),
587- // }
588-
589- // // Set input based on event type for workflow processing
590- // let input = ''
591- // switch (eventType) {
592- // case 'push':
593- // input = `Push to ${githubData.branch || githubData.ref}: ${githubData.commit_message || 'No commit message'}`
594- // break
595- // case 'pull_request':
596- // input = `${action} pull request: ${githubData.pr_title || 'No title'}`
597- // break
598- // case 'issues':
599- // input = `${action} issue: ${githubData.issue_title || 'No title'}`
600- // break
601- // case 'issue_comment':
602- // case 'pull_request_review_comment':
603- // input = `Comment ${action}: ${githubData.comment_body?.slice(0, 100) || 'No comment body'}${(githubData.comment_body?.length || 0) > 100 ? '...' : ''}`
604- // break
605- // default:
606- // input = `GitHub ${eventType} event${action ? ` (${action})` : ''}`
607- // }
522+ // GitHub webhook input formatting logic
523+ const eventType = request . headers . get ( 'x-github-event' ) || 'unknown'
524+ const delivery = request . headers . get ( 'x-github-delivery' ) || ''
525+
526+ // Extract common GitHub properties
527+ const repository = body ?. repository || { }
528+ const sender = body ?. sender || { }
529+ const action = body ?. action || ''
530+
531+ // Build GitHub-specific variables based on the trigger config outputs
532+ const githubData = {
533+ // Event metadata
534+ event_type : eventType ,
535+ action : action ,
536+ delivery_id : delivery ,
537+
538+ // Repository information (avoid 'repository' to prevent conflict with the object)
539+ repository_full_name : repository . full_name || '' ,
540+ repository_name : repository . name || '' ,
541+ repository_owner : repository . owner ?. login || '' ,
542+ repository_id : repository . id || '' ,
543+ repository_url : repository . html_url || '' ,
544+
545+ // Sender information (avoid 'sender' to prevent conflict with the object)
546+ sender_login : sender . login || '' ,
547+ sender_id : sender . id || '' ,
548+ sender_type : sender . type || '' ,
549+ sender_url : sender . html_url || '' ,
550+
551+ // Event-specific data
552+ ...( body ?. ref && {
553+ ref : body . ref ,
554+ branch : body . ref ?. replace ( 'refs/heads/' , '' ) || '' ,
555+ } ) ,
556+ ...( body ?. before && { before : body . before } ) ,
557+ ...( body ?. after && { after : body . after } ) ,
558+ ...( body ?. commits && {
559+ commits : JSON . stringify ( body . commits ) ,
560+ commit_count : body . commits . length || 0 ,
561+ } ) ,
562+ ...( body ?. head_commit && {
563+ commit_message : body . head_commit . message || '' ,
564+ commit_author : body . head_commit . author ?. name || '' ,
565+ commit_sha : body . head_commit . id || '' ,
566+ commit_url : body . head_commit . url || '' ,
567+ } ) ,
568+ ...( body ?. pull_request && {
569+ pull_request : JSON . stringify ( body . pull_request ) ,
570+ pr_number : body . pull_request . number || '' ,
571+ pr_title : body . pull_request . title || '' ,
572+ pr_state : body . pull_request . state || '' ,
573+ pr_url : body . pull_request . html_url || '' ,
574+ } ) ,
575+ ...( body ?. issue && {
576+ issue : JSON . stringify ( body . issue ) ,
577+ issue_number : body . issue . number || '' ,
578+ issue_title : body . issue . title || '' ,
579+ issue_state : body . issue . state || '' ,
580+ issue_url : body . issue . html_url || '' ,
581+ } ) ,
582+ ...( body ?. comment && {
583+ comment : JSON . stringify ( body . comment ) ,
584+ comment_body : body . comment . body || '' ,
585+ comment_url : body . comment . html_url || '' ,
586+ } ) ,
587+ }
588+
589+ // Set input based on event type for workflow processing
590+ let input = ''
591+ switch ( eventType ) {
592+ case 'push' :
593+ input = `Push to ${ githubData . branch || githubData . ref } : ${ githubData . commit_message || 'No commit message' } `
594+ break
595+ case 'pull_request' :
596+ input = `${ action } pull request: ${ githubData . pr_title || 'No title' } `
597+ break
598+ case 'issues' :
599+ input = `${ action } issue: ${ githubData . issue_title || 'No title' } `
600+ break
601+ case 'issue_comment' :
602+ case 'pull_request_review_comment' :
603+ input = `Comment ${ action } : ${ githubData . comment_body ?. slice ( 0 , 100 ) || 'No comment body' } ${ ( githubData . comment_body ?. length || 0 ) > 100 ? '...' : '' } `
604+ break
605+ default :
606+ input = `GitHub ${ eventType } event${ action ? ` (${ action } )` : '' } `
607+ }
608608
609609 return {
610610 // Expose raw GitHub payload at the root
0 commit comments