Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: feat: comment on the original pull/merge request when on error #125

Closed
wants to merge 1 commit into from

Conversation

earl-warren
Copy link
Contributor

@earl-warren earl-warren commented Apr 8, 2024

A comment is added to the original PR when a backport fails. The developers watching the PR will be notified even if they are not watching the CI.

Fixes: #123

A comment is added to the original PR when a backport fails. The
developers watching the PR will be notified even if they are not
watching the CI.

Fixes: kiegroup#123
@earl-warren
Copy link
Contributor Author

@lampajr is this going in the right direction or did you have something else in mind?

Copy link
Contributor

github-actions bot commented Apr 8, 2024

Coverage report

Caution

Test run failed

St.
Category Percentage Covered / Total
🟡 Statements
77.98% (-13.32% 🔻)
131/168
🟡 Branches
68.75% (-17.44% 🔻)
44/64
🟡 Functions
74.42% (-14.01% 🔻)
32/43
🟡 Lines
77.16% (-14.07% 🔻)
125/162
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟡 git/git-util.ts
65.79% (-34.21% 🔻)
52.94% (-47.06% 🔻)
50% (-50% 🔻)
61.76% (-38.24% 🔻)
🔴
... / console-logger-service.ts
46.15% (-46.15% 🔻)
50% (-50% 🔻)
33.33% (-55.56% 🔻)
46.15% (-46.15% 🔻)

Test suite run failed

Failed tests: 0/50. Failed suites: 11/16.
  ● Test suite failed to run

    src/service/runner/runner.ts:94:8 - error TS2492: Cannot redeclare identifier 'error' in catch clause.

    94  const error = `Something went wrong backporting to ${pr.base}: ${error}`;
              ~~~~~
    src/service/runner/runner.ts:94:8 - error TS7022: 'error' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.

    94  const error = `Something went wrong backporting to ${pr.base}: ${error}`;
              ~~~~~
    src/service/runner/runner.ts:94:67 - error TS2448: Block-scoped variable 'error' used before its declaration.

    94  const error = `Something went wrong backporting to ${pr.base}: ${error}`;
                                                                         ~~~~~

      src/service/runner/runner.ts:94:8
        94  const error = `Something went wrong backporting to ${pr.base}: ${error}`;
                  ~~~~~
        'error' is declared here.
    src/service/runner/runner.ts:96:24 - error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'.
      Type 'undefined' is not assignable to type 'string'.

    96    gitApi.commentError(configs.originalPullRequest.url, error)
                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


  ● Test suite failed to run

    src/service/runner/runner.ts:94:8 - error TS2492: Cannot redeclare identifier 'error' in catch clause.

    94  const error = `Something went wrong backporting to ${pr.base}: ${error}`;
              ~~~~~
    src/service/runner/runner.ts:94:8 - error TS7022: 'error' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.

    94  const error = `Something went wrong backporting to ${pr.base}: ${error}`;
              ~~~~~
    src/service/runner/runner.ts:94:67 - error TS2448: Block-scoped variable 'error' used before its declaration.

    94  const error = `Something went wrong backporting to ${pr.base}: ${error}`;
                                                                         ~~~~~

      src/service/runner/runner.ts:94:8
        94  const error = `Something went wrong backporting to ${pr.base}: ${error}`;
                  ~~~~~
        'error' is declared here.
    src/service/runner/runner.ts:96:24 - error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'.
      Type 'undefined' is not assignable to type 'string'.

    96    gitApi.commentError(configs.originalPullRequest.url, error)
                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


  ● Test suite failed to run

    src/service/git/git-client-factory.ts:44:9 - error TS2741: Property 'commentError' is missing in type 'GitLabClient' but required in type 'GitClient'.

    44         GitClientFactory.instance = new GitLabClient(authToken, apiUrl);
               ~~~~~~~~~~~~~~~~~~~~~~~~~

      src/service/git/git-client.ts:43:4
        43    commentError(prUrl: string, message: string): Promise<void>;
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        'commentError' is declared here.
    src/service/git/git-client-factory.ts:53:5 - error TS2322: Type 'GitClient | undefined' is not assignable to type 'GitClient'.
      Type 'undefined' is not assignable to type 'GitClient'.

    53     return GitClientFactory.instance;
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


  ● Test suite failed to run

    src/service/git/git-client-factory.ts:44:9 - error TS2741: Property 'commentError' is missing in type 'GitLabClient' but required in type 'GitClient'.

    44         GitClientFactory.instance = new GitLabClient(authToken, apiUrl);
               ~~~~~~~~~~~~~~~~~~~~~~~~~

      src/service/git/git-client.ts:43:4
        43    commentError(prUrl: string, message: string): Promise<void>;
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        'commentError' is declared here.
    src/service/git/git-client-factory.ts:53:5 - error TS2322: Type 'GitClient | undefined' is not assignable to type 'GitClient'.
      Type 'undefined' is not assignable to type 'GitClient'.

    53     return GitClientFactory.instance;
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


  ● Test suite failed to run

    src/service/runner/runner.ts:94:8 - error TS2492: Cannot redeclare identifier 'error' in catch clause.

    94  const error = `Something went wrong backporting to ${pr.base}: ${error}`;
              ~~~~~
    src/service/runner/runner.ts:94:8 - error TS7022: 'error' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.

    94  const error = `Something went wrong backporting to ${pr.base}: ${error}`;
              ~~~~~
    src/service/runner/runner.ts:94:67 - error TS2448: Block-scoped variable 'error' used before its declaration.

    94  const error = `Something went wrong backporting to ${pr.base}: ${error}`;
                                                                         ~~~~~

      src/service/runner/runner.ts:94:8
        94  const error = `Something went wrong backporting to ${pr.base}: ${error}`;
                  ~~~~~
        'error' is declared here.
    src/service/runner/runner.ts:96:24 - error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'.
      Type 'undefined' is not assignable to type 'string'.

    96    gitApi.commentError(configs.originalPullRequest.url, error)
                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


  ● Test suite failed to run

    src/service/git/git-client-factory.ts:44:9 - error TS2741: Property 'commentError' is missing in type 'GitLabClient' but required in type 'GitClient'.

    44         GitClientFactory.instance = new GitLabClient(authToken, apiUrl);
               ~~~~~~~~~~~~~~~~~~~~~~~~~

      src/service/git/git-client.ts:43:4
        43    commentError(prUrl: string, message: string): Promise<void>;
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        'commentError' is declared here.
    src/service/git/git-client-factory.ts:53:5 - error TS2322: Type 'GitClient | undefined' is not assignable to type 'GitClient'.
      Type 'undefined' is not assignable to type 'GitClient'.

    53     return GitClientFactory.instance;
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


  ● Test suite failed to run

    src/service/runner/runner.ts:94:8 - error TS2492: Cannot redeclare identifier 'error' in catch clause.

    94  const error = `Something went wrong backporting to ${pr.base}: ${error}`;
              ~~~~~
    src/service/runner/runner.ts:94:8 - error TS7022: 'error' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.

    94  const error = `Something went wrong backporting to ${pr.base}: ${error}`;
              ~~~~~
    src/service/runner/runner.ts:94:67 - error TS2448: Block-scoped variable 'error' used before its declaration.

    94  const error = `Something went wrong backporting to ${pr.base}: ${error}`;
                                                                         ~~~~~

      src/service/runner/runner.ts:94:8
        94  const error = `Something went wrong backporting to ${pr.base}: ${error}`;
                  ~~~~~
        'error' is declared here.
    src/service/runner/runner.ts:96:24 - error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'.
      Type 'undefined' is not assignable to type 'string'.

    96    gitApi.commentError(configs.originalPullRequest.url, error)
                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


  ● Test suite failed to run

    test/service/git/gitlab/gitlab-client.test.ts:30:17 - error TS2352: Conversion of type 'GitClient' to type 'GitLabClient' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
      Type 'GitClient' is missing the following properties from type 'GitLabClient': logger, apiUrl, mapper, client, and 3 more.

    30     gitClient = GitClientFactory.getOrCreate(GitClientType.GITLAB, "whatever", "apiUrl") as GitLabClient;
                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


  ● Test suite failed to run

    src/service/git/git-client-factory.ts:44:9 - error TS2741: Property 'commentError' is missing in type 'GitLabClient' but required in type 'GitClient'.

    44         GitClientFactory.instance = new GitLabClient(authToken, apiUrl);
               ~~~~~~~~~~~~~~~~~~~~~~~~~

      src/service/git/git-client.ts:43:4
        43    commentError(prUrl: string, message: string): Promise<void>;
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        'commentError' is declared here.
    src/service/git/git-client-factory.ts:53:5 - error TS2322: Type 'GitClient | undefined' is not assignable to type 'GitClient'.
      Type 'undefined' is not assignable to type 'GitClient'.

    53     return GitClientFactory.instance;
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


  ● Test suite failed to run

    src/service/git/git-client-factory.ts:44:9 - error TS2741: Property 'commentError' is missing in type 'GitLabClient' but required in type 'GitClient'.

    44         GitClientFactory.instance = new GitLabClient(authToken, apiUrl);
               ~~~~~~~~~~~~~~~~~~~~~~~~~

      src/service/git/git-client.ts:43:4
        43    commentError(prUrl: string, message: string): Promise<void>;
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        'commentError' is declared here.
    src/service/git/git-client-factory.ts:53:5 - error TS2322: Type 'GitClient | undefined' is not assignable to type 'GitClient'.
      Type 'undefined' is not assignable to type 'GitClient'.

    53     return GitClientFactory.instance;
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


  ● Test suite failed to run

    src/service/git/git-client-factory.ts:44:9 - error TS2741: Property 'commentError' is missing in type 'GitLabClient' but required in type 'GitClient'.

    44         GitClientFactory.instance = new GitLabClient(authToken, apiUrl);
               ~~~~~~~~~~~~~~~~~~~~~~~~~

      src/service/git/git-client.ts:43:4
        43    commentError(prUrl: string, message: string): Promise<void>;
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        'commentError' is declared here.
    src/service/git/git-client-factory.ts:53:5 - error TS2322: Type 'GitClient | undefined' is not assignable to type 'GitClient'.
      Type 'undefined' is not assignable to type 'GitClient'.

    53     return GitClientFactory.instance;
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Report generated by 🧪jest coverage report action from ef940d1

@lampajr
Copy link
Member

lampajr commented Apr 8, 2024

@lampajr is this going in the right direction or did you have something else in mind?

LOL, I think we both worked on the same issue 😄, this is how I thought to implement that #124 (this still a WIP)

@earl-warren
Copy link
Contributor Author

I'm glad I asked! I'll happily wait to review yours 😛

@earl-warren earl-warren closed this Apr 8, 2024
@lampajr
Copy link
Member

lampajr commented Apr 8, 2024

I'm glad I asked! I'll happily wait to review yours 😛

I hope I did not make you waste too much time, I should be able to finalize the other PR by today 🤞

@earl-warren
Copy link
Contributor Author

No time wasted at all and very happy to lean on you for this feature ❤️

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.

Add a comment to the backported PR on failure
2 participants