Skip to content

Correctly set issue title to origin's project name when using custom issue tracker

Mitchell Nielsen requested to merge fix-issue-title-prefix into main

Summary

When custom issue trackers are configured, issue-bot was intended to set the issue title prefix to the name of the project where the failure occurred.

However, we were mistakenly using the issueTrackerClient to get the name of the project using the issue ID, which isn't the correct logic whether that project is on the same instance or a separate one.

For example: "Project A" creates issues in custom issue tracker on "Project B". If a pipeline in "Project A" fails, it will create an issue in "Project B" with the title:

"[Project A] [CI] Pipeline failed <etc...>"

Testing

Setup

    1. Created Project A
    1. Created Project B
    1. Created access token with api scope and added to project A as ISSUE_BOT_API_TOKEN
    1. Added Project B's project ID to Project A as ISSUE_TRACKER_PROJECT_ID
    1. Created CI file in Project A

Result

Pipeline in Project A created https://gitlab.com/mnielsen/project-b/-/issues/1 with the correct prefix ([Project A]).

Edited by Mitchell Nielsen

Merge request reports