kiegroup / git-backporting

Git backporting is a CLI tool to execute pull request backporting.
MIT License
17 stars 9 forks source link

feat: implement error notification as pr comment #124

Closed lampajr closed 7 months ago

lampajr commented 7 months ago

Thank you for submitting this pull request

fixes https://github.com/kiegroup/git-backporting/issues/123

Description

Implement an optional notification mechanism on the original pull request for error tracking.

If enabled, the tool will create a new comment in the original PR (the one you tried to backport) with some infos of the error that occurred.

This is going to introduce other two inputs:

How Has This Been Tested?

Checklist

Merge criteria:

Note: dist/cli/index.js and dist/gha/index.js are automatically generated by git hooks and gh workflows.

First time here? This project follows [git conventional commits](https://gist.github.com/qoomon/5dfcdf8eec66a051ecd85625518cfd13) pattern, therefore the commits should have the following format: ``` (): empty separator line empty separator line ``` Where the type must be one of `[build, chore, ci, docs, feat, fix, perf, refactor, revert, style, test]` > **NOTE**: if you are still in a `work in progress` branch and you want to push your changes remotely, consider adding `--no-verify` for both `commit` and `push`, e.g., `git push origin --no-verify` - this could become useful to push changes where there are still tests failures. Once the pull request is ready, please `amend` the commit and force-push it to keep following the adopted git commit standard.
How to prepare for a new release? There is no need to manually update `package.json` version and `CHANGELOG.md` information. This process has been automated in [Prepare Release](./workflows/prepare-release.yml) *Github* workflow. Therefore whenever enough changes are merged into the `main` branch, one of the maintainers will trigger this workflow that will automatically update `version` and `changelog` based on the commits on the git tree. More details can be found in [package release](https://github.com/kiegroup/git-backporting/blob/main/README.md#package-release) section of the README.
github-actions[bot] commented 7 months ago

Coverage report

St.:grey_question:
Category Percentage Covered / Total
🟒 Statements
89.67% (-1.62% πŸ”»)
495/552
🟒 Branches
86.24% (+0.05% πŸ”Ό)
188/218
🟒 Functions
87.4% (-1.03% πŸ”»)
111/127
🟒 Lines
89.53% (-1.7% πŸ”»)
479/535
Show new covered files 🐣
|
St.:grey_question:
| File | Statements | Branches | Functions | Lines | | :-: | :- | :- | :- | :- | :- | | 🟒 |
`...` / runner-util.ts
| 100% | 100% | 100% | 100% |
Show files with reduced coverage πŸ”»
|
St.:grey_question:
| File | Statements | Branches | Functions | Lines | | :-: | :- | :- | :- | :- | :- | | 🟒 |
`...` / console-logger-service.ts
|
85.71% (-6.59% πŸ”»)
| 100% |
80% (-8.89% πŸ”»)
|
85.71% (-6.59% πŸ”»)
| | 🟒 |
`...` / github-client.ts
|
86.36% (-1.36% πŸ”»)
|
66.67% (-4.76% πŸ”»)
|
66.67% (+2.38% πŸ”Ό)
|
86.15% (-1.35% πŸ”»)
| | 🟒 |
`...` / gitlab-client.ts
|
84.78% (-9.19% πŸ”»)
|
75% (-6.82% πŸ”»)
|
88% (-3.67% πŸ”»)
|
84.09% (-9.58% πŸ”»)
|

Test suite run success

187 tests passing in 17 suites.

Report generated by πŸ§ͺjest coverage report action from 8b0412b1110044e554b9029e7f5b19158885f4ee

lampajr commented 7 months ago

Status update:

Open points:

TODOs:

lampajr commented 7 months ago

@earl-warren fyi

lampajr commented 7 months ago

One tiny change otherwise looks great.

Thanks, copy&paste issue lol

I need to drop for today, but I plan to finalize this tomorrow :rocket:

lampajr commented 7 months ago

Open points:

* I don't really like the default comment message I set right now, any feedback is welcome

As first implementation let's go with Backporting failed: ${{error}}

* Make the comment message configurable, I think this is a good thing but it can be done in a followup PR

Will create separate issue to make the comment body configurable through templating

TODOs:

Still need to try some real examples, did not have time to setup ad hoc test but will do asap.

lampajr commented 7 months ago

Ok I was able to test it with some real examples, e.g., https://github.com/lampajr/backporting-example/pull/66#issuecomment-2048379252

With latest two commits:

I decided to remove the error from the comment as it could become very huge if the conflicts are many, e.g., https://github.com/lampajr/backporting-example/pull/66#issuecomment-2048357951

lampajr commented 7 months ago

@earl-warren If you want to take a further look the PR is ready, otherwise I will go and merge!

PS: don't feel obligated, you already did a lot!!!