Skip to content

[T1601] FEAT: Automatically fill the Github PR URL upon PR creation - #1791

Open
AlexandrePhilibert wants to merge 2 commits into
18.0from
T1601-use-github-rest-api-in-project
Open

[T1601] FEAT: Automatically fill the Github PR URL upon PR creation#1791
AlexandrePhilibert wants to merge 2 commits into
18.0from
T1601-use-github-rest-api-in-project

Conversation

@AlexandrePhilibert

Copy link
Copy Markdown

Automatically fill the Github PR URL on tasks when PRs are opened.

This PR does not address the following points :

  • Automatically detect commits within the organization linked to a task (show the link)
  • Display the information with icons in the kanban view

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Introduces a new Odoo addon (project_task_github) that listens to GitHub Pull Request webhooks and automatically populates the task’s PR URI when the PR title (or branch name) starts with a task code like T1601.

Changes:

  • Add a GitHub webhook controller that validates X-Hub-Signature-256 and processes pull_request opened/edited events.
  • Add task lookup/linking helpers on project.task to find tasks by code and set pr_uri only when empty.
  • Add module documentation (usage + configuration) and addon manifest/init wiring.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
project_task_github/readme/USAGE.md Documents how task codes in PR title/branch trigger PR URI auto-fill.
project_task_github/readme/DESCRIPTION.md Describes module behavior and examples of supported PR/branch naming.
project_task_github/readme/CONFIGURE.md Explains how to configure the GitHub webhook secret and org webhook settings.
project_task_github/models/project_task.py Adds task-code extraction and PR URI linking helpers on project.task.
project_task_github/models/init.py Exposes the new model extension.
project_task_github/controllers/github_webhook.py Implements the webhook endpoint, signature verification, and linking flow.
project_task_github/controllers/init.py Exposes the new controller.
project_task_github/manifest.py Declares the addon, dependencies, and metadata.
project_task_github/init.py Initializes controllers and models packages.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread project_task_github/readme/DESCRIPTION.md Outdated
Comment thread project_task_github/models/project_task.py
Comment thread project_task_github/controllers/github_webhook.py
Comment on lines +59 to +67
try:
payload = json.loads(body)
except json.JSONDecodeError:
_logger.error(
"The body of GitHub delivery %s is not JSON. The content type "
"of the webhook must be set to application/json.",
delivery,
)
return request.make_response("BAD_PAYLOAD", status=400)
Comment on lines +20 to +27
@http.route(
"/github/webhook",
type="http",
auth="public",
methods=["POST"],
csrf=False,
save_session=False,
)
@AlexandrePhilibert
AlexandrePhilibert force-pushed the T1601-use-github-rest-api-in-project branch from 7eff833 to 5b10f5e Compare August 10, 2026 14:03
@greptile-apps

greptile-apps Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 4/5

One non-security P1 failure remains: editing a pull request’s task reference can create duplicate task-to-PR associations.

The final scoring set has exactly one P1 finding and it is not security-related, which results in a confidence score of 4.

Files Needing Attention: project_task_github/controllers/github_webhook.py

T-Rex T-Rex Logs

What T-Rex did

  • T-Rex produced a proof for the posted P1 finding and linked it to the review comment.
  • T-Rex prepared and executed the authenticated edited-webhook reproduction harness to reproduce the scenario described in the finding.
  • T-Rex captured the observed webhook reproduction output in a log and recorded a URL to review the result.
  • T-Rex used the observed reproduction output to validate that the reproduction path aligns with the posted finding details.

View all artifacts

T-Rex Ran code and verified through T-Rex

Reviews (2): Last reviewed commit: "[T1601] FIX: Typo" | Re-trigger Greptile

Comment thread project_task_github/controllers/github_webhook.py
)
return request.make_response("NO_TASK")

task._set_github_pr_uri(pull_request["html_url"])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Edited pull requests retain the previous task link

When a pull request initially linked to task A is edited so its title or branch resolves to task B, this call adds the PR URL to B without removing it from A. Both tasks then remain associated with the same pull request. Before linking the newly resolved task, clear or reassign any existing holder of this URL.

Artifacts

Executable GitHub webhook reassociation harness

  • A narrow authored harness imports the repository controller and model methods, signs realistic webhook payloads, and drives the opened-to-edited sequence, showing the changed path was executed.

Opened pull request webhook response before title retargeting

  • The executed initial webhook request returned HTTP 200 OK and linked only T100 to the PR URL, establishing the pre-edit association.

Edited pull request webhook response after title retargeting

  • The executed edited webhook request returned HTTP 200 OK but retained T100's URL and added the same URL to T200, confirming the stale duplicate association.

Python compilation of the harness and exercised source files

  • The executed Python compilation command completed with exit code 0 for the harness, controller, and model source, confirming the exercised files parse successfully.

View artifacts

T-Rex Ran code and verified through T-Rex

)
return request.make_response("NO_TASK")

task._set_github_pr_uri(pull_request["html_url"])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Edited PR links are not reassigned

When an edited pull request changes from task A to task B, this assigns the URL to B but never removes the existing assignment from A. The PR can therefore remain linked to two tasks, producing incorrect task/PR associations. Reconcile existing holders of html_url before assigning it to the newly resolved task.

Artifacts

Authenticated edited-webhook reproduction harness

  • This executable harness loads the repository’s actual webhook and task methods and submits the edited event with A already linked and B identified, demonstrating the duplicate-link condition.

Observed webhook reproduction output

  • This captured output records exit code 0, 200 OK, and the final state where both A and B contain the same pull-request URL, confirming the finding.

View artifacts

T-Rex Ran code and verified through T-Rex

@NoeBerdoz
NoeBerdoz self-requested a review August 12, 2026 13:26
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.

2 participants