octaviuslabs / walter

AI-powered software development assistant built right into GitHub so it can act as your junior developer.
MIT License
8 stars 1 forks source link

Allow changes on pull request #68

Closed jsfour closed 1 year ago

jsfour commented 1 year ago

We need to be able to pull the related issue from the pull request description and log it here: https://github.com/octaviuslabs/walter/blob/main/index.ts#L189

imwalterbot commented 1 year ago

We need to be able to pull the related issue from the pull request description and log it here: https://github.com/octaviuslabs/walter/blob/main/index.ts#L189

Queued for processing...

imwalterbot commented 1 year ago

Here's the pseudocode to extract the related issue from the pull request description and log it:

  1. Modify the existing webhook event listener to listen for pull_request events instead of pull_request_review_comment.created.

  2. Create a new function extractRelatedIssue that takes the pull request description as input and returns the related issue number.

  3. Call the extractRelatedIssue function inside the modified webhook event listener and log the extracted issue number.

Here's the modified pseudocode:

// Modify the webhook event listener
webhooks.on("pull_request", async (event: any) => {
  const pullRequest = event.payload.pull_request;
  Log.info("Pull request description:", pullRequest.body);

  // Extract the related issue number
  const relatedIssueNumber = extractRelatedIssue(pullRequest.body);

  // Log the related issue number
  Log.info("Related issue number:", relatedIssueNumber);
});

function extractRelatedIssue(description: string): number {
  // Define a regular expression pattern to match issue numbers
  const issueNumberRegex = /#(\d+)/;

  // Search for the issue number in the description
  const match = description.match(issueNumberRegex);

  // If a match is found, return the issue number as an integer
  if (match && match[1]) {
    return parseInt(match[1], 10);
  }

  // If no match is found, return -1 to indicate no related issue
  return -1;
}

Remember to replace the existing webhook event listener with the modified one in the code.

jsfour commented 1 year ago

@imwalterbot APPROVED

imwalterbot commented 1 year ago

@imwalterbot APPROVED

Queued for processing...

imwalterbot commented 1 year ago

@imwalterbot APPROVED

Processing this now

jsfour commented 1 year ago

@APPROVED changes on https://github.com/octaviuslabs/walter/blob/main/index.ts#L189

jsfour commented 1 year ago

We need to be able to pull the related issue from the pull request description and log it here: https://github.com/octaviuslabs/walter/blob/main/index.ts#L189

imwalterbot commented 1 year ago

We need to be able to pull the related issue from the pull request description and log it here: https://github.com/octaviuslabs/walter/blob/main/index.ts#L189

Queued for processing...

jsfour commented 1 year ago

We need to be able to pull the related issue from the pull request description and log it here: https://github.com/octaviuslabs/walter/blob/main/index.ts#L189

imwalterbot commented 1 year ago

We need to be able to pull the related issue from the pull request description and log it here: https://github.com/octaviuslabs/walter/blob/main/index.ts#L189

Queued for processing...

jsfour commented 1 year ago

We need to be able to pull the related issue from the pull request description and log it here: https://github.com/octaviuslabs/walter/blob/main/src/index.ts#L189

imwalterbot commented 1 year ago

We need to be able to pull the related issue from the pull request description and log it here: https://github.com/octaviuslabs/walter/blob/main/src/index.ts#L189

Queued for processing...

imwalterbot commented 1 year ago

Here's the pseudocode to extract the related issue from the pull request description and log it at the specified line:

  1. Modify the existing webhook event listener to listen for pull_request events instead of pull_request_review_comment.created.

  2. Create a new function extractRelatedIssue that takes the pull request description as input and returns the related issue number.

  3. Call the extractRelatedIssue function inside the modified webhook event listener and log the extracted issue number.

Here's the modified pseudocode:

// Modify the webhook event listener
webhooks.on("pull_request", async (event: any) => {
  const pullRequest = event.payload.pull_request;
  Log.info("Pull request description:", pullRequest.body);

  // Extract the related issue number
  const relatedIssueNumber = extractRelatedIssue(pullRequest.body);

  // Log the related issue number
  Log.info("Related issue number:", relatedIssueNumber);
});

function extractRelatedIssue(description: string): number {
  // Define a regular expression pattern to match issue numbers
  const issueNumberRegex = /#(\d+)/;

  // Search for the issue number in the description
  const match = description.match(issueNumberRegex);

  // If a match is found, return the issue number as an integer
  if (match && match[1]) {
    return parseInt(match[1], 10);
  }

  // If no match is found, return -1 to indicate no related issue
  return -1;
}

Remember to replace the existing webhook event listener with the modified one in the code.

jsfour commented 1 year ago

@imwalterbot APPROVED for changes on https://github.com/octaviuslabs/walter/blob/main/src/index.ts#L189

jsfour commented 1 year ago

@imwalterbot APPROVED for changes on https://github.com/octaviuslabs/walter/blob/main/src/index.ts#L189

imwalterbot commented 1 year ago

@imwalterbot APPROVED for changes on https://github.com/octaviuslabs/walter/blob/main/src/index.ts#L189

Queued for processing...

imwalterbot commented 1 year ago

@imwalterbot APPROVED for changes on https://github.com/octaviuslabs/walter/blob/main/src/index.ts#L189

Processing this now