Skip to content

Conversation

@ggazzo
Copy link
Member

@ggazzo ggazzo commented Feb 12, 2026

  • Added handleJira function to create Jira tasks from PR comments.
  • Updated .env.example to include new Jira configuration variables.
  • Integrated Jira handling into the main application logic, allowing users to trigger task creation via a command.

- Added `handleJira` function to create Jira tasks from PR comments.
- Updated `.env.example` to include new Jira configuration variables.
- Integrated Jira handling into the main application logic, allowing users to trigger task creation via a command.
@dionisio-bot
Copy link

dionisio-bot bot commented Feb 12, 2026

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is missing the 'stat: QA assured' label
  • This PR is missing the required milestone or project

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

… method

- Removed JIRA_EMAIL from `.env.example` as it is no longer needed.
- Updated the authorization method in `handleJira.ts` to use only the JIRA_API_TOKEN for authentication.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new /jira PR comment command to the Probot app to create a Jira issue from a pull request, with supporting environment configuration.

Changes:

  • Added handleJira implementation to create a Jira Task via REST API and propagate info back to GitHub.
  • Wired /jira <projectKey> command handling into the issue_comment.created flow with reactions for feedback.
  • Added Jira configuration placeholders to .env.example.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 7 comments.

File Description
src/index.ts Adds /jira command parsing and calls into handleJira, including reaction-based UX.
src/handleJira.ts Implements Jira issue creation and GitHub PR update/reaction behavior.
.env.example Adds JIRA_BASE_URL and JIRA_API_TOKEN placeholders.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +260 to +265
// reacts with thinking face
await context.octokit.reactions.createForIssueComment({
...context.issue(),
comment_id: comment.id,
content: 'confused',
});
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment says "thinking face" but the reaction used is confused. Update the comment to match the actual reaction (or change the reaction if a different one was intended).

Copilot uses AI. Check for mistakes.
# Go to https://smee.io/new set this to the URL that you are redirected to.
WEBHOOK_PROXY_URL=

JIRA_BASE_URL=
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the code sends Authorization: Basic ${JIRA_API_TOKEN}, it’s unclear what exact format the env var should contain (raw API token vs base64-encoded email:token). Add a short comment in the example env file describing the expected format (and any additional required Jira identity like email) to prevent misconfiguration.

Suggested change
JIRA_BASE_URL=
JIRA_BASE_URL=
# Base64-encoded "jira_email:api_token" used for HTTP Basic auth, e.g.:
# echo -n '[email protected]:your_jira_api_token' | base64

Copilot uses AI. Check for mistakes.
Comment on lines 113 to 122
const task = (await response.json()) as { key?: string };

await context.octokit.issues.update({
...context.issue(),
body: `${pr.body?.trim() || 'no description'} \n\n Task: [${task.key}]`,
});

const data = (await response.json()) as { key?: string };
const issueKey = data.key;

Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

response.json() is consumed twice (once into task and again into data). A Fetch Response body can only be read once, so the second call will throw at runtime. Parse the JSON once, validate the returned issue key, and reuse that object for subsequent steps.

Copilot uses AI. Check for mistakes.
Comment on lines +115 to +118
await context.octokit.issues.update({
...context.issue(),
body: `${pr.body?.trim() || 'no description'} \n\n Task: [${task.key}]`,
});
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This updates the PR/issue body before verifying that the Jira response actually included an issue key, and it can end up writing Task: [undefined] into the PR description. Validate the Jira response (including key) first, then update GitHub with a well-formed link/identifier.

Copilot uses AI. Check for mistakes.
Comment on lines 129 to 133
await context.octokit.reactions.createForIssueComment({
...context.issue(),
comment_id: commentId,
content: '+1',
});
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This handler adds a +1 reaction itself, but src/index.ts also adds a +1 reaction on success. GitHub rejects duplicate reactions from the same user, so this can turn a successful Jira creation into a caught error and a -1 reaction. Keep the success reaction in only one place (preferably in the command handler in index.ts for consistency with other commands).

Suggested change
await context.octokit.reactions.createForIssueComment({
...context.issue(),
comment_id: commentId,
content: '+1',
});

Copilot uses AI. Check for mistakes.
Comment on lines 229 to 242
await handleJira({
context,
boardName,
pr: {
number: pr.data.number,
title: pr.data.title,
body: pr.data.body,
html_url: pr.data.html_url,
labels: pr.data.labels.map((label) => label.name),
user: pr.data.user,
},
requestedBy: comment.user.login,
commentId: comment.id,
});
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

handleJira() returns an issue URL, but the return value is ignored. Either use it (e.g., post a comment with the created Jira link) or change handleJira to return void to avoid suggesting an unused result.

Copilot uses AI. Check for mistakes.
Comment on lines +243 to +248

await context.octokit.reactions.createForIssueComment({
...context.issue(),
comment_id: comment.id,
content: '+1',
});
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This +1 reaction duplicates the +1 reaction currently created inside handleJira(), which can cause a 422 from the GitHub API for duplicate reactions and flip a success into the catch path. Ensure only one success reaction is created (either here or inside handleJira, not both).

Suggested change
await context.octokit.reactions.createForIssueComment({
...context.issue(),
comment_id: comment.id,
content: '+1',
});

Copilot uses AI. Check for mistakes.
- Removed unnecessary error handling and response parsing in `handleJira`, returning the task key directly.
- Added cleanup logic to delete the 'eyes' reaction from commit comments in `index.ts` after processing.
- Eliminated the `commentId` parameter from the `handleJira` function signature as it is no longer needed for the current implementation.
- Changed the method for deleting reactions from commit comments to issue comments in the `handleJira` function, ensuring proper cleanup of the 'eyes' reaction.
- Added functionality to identify Jira task keys and handle subtasks in the `handleJira` function.
- Updated the function signature to include an optional `parentTaskKey` parameter for subtasks.
- Adjusted the project key and issue type based on whether the task is a subtask or not.
- Updated the `HandleJiraArg` interface to include an optional `milestone` property.
- Enhanced the `handleJira` function to utilize the milestone information when creating Jira tasks from PRs.
- Added the `md-to-adf` dependency to convert Markdown to ADF format.
- Implemented `prBodyToAdfContent` function in `handleJira.ts` to process PR descriptions into ADF blocks.
- Updated the `handleJira` function to utilize the new ADF content structure for better formatting in Jira tasks.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant