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

fix(gh130): apply commits in the correct order on github #131

Merged
merged 1 commit into from
Jul 16, 2024

Conversation

lampajr
Copy link
Member

@lampajr lampajr commented Jul 16, 2024

Thank you for submitting this pull request

fixes #130

Description

The change that was introduced with #115 was assuming that all services were returning the list of commits in the same order, but that's not true:

GITHUB        --> oldest to newest
CODEBERG  --> newest to oldest
GITLAB         --> newest to oldest

Therefore, in according to the GitServiceType, the list of commits is reversed (at the moment for Gitlab and Codeberg) in order to guarantee that the commit are applied from older to newest.

How Has This Been Tested?

  • Added unit tests
  • GitHub: Running node dist/cli/index.js -pr https://github.com/lampajr/backporting-example/pull/111 --no-squash -tb develop -d
[DEBUG] [develop] Cherry picking commits..
[INFO ] [develop] Cherry picking 55eb00fc71e09cfba968a27222dafb25aef2c53c
[DEBUG] [develop] Cherry picking command git cherry-pick,-m,1,--strategy=recursive,--strategy-option=theirs,55eb00fc71e09cfba968a27222dafb25aef2c53c
[INFO ] [develop] Cherry picking 518e65ce28e876fbc8bdf34783fcb440c45c922a
[DEBUG] [develop] Cherry picking command git cherry-pick,-m,1,--strategy=recursive,--strategy-option=theirs,518e65ce28e876fbc8bdf34783fcb440c45c922a
  • Codeberg: Running node dist/cli/index.js -pr https://codeberg.org/forgejo/forgejo/pulls/2669 --no-squash -tb "v8.0/forgejo" -d
[DEBUG] [v8.0/forgejo] Cherry picking commits..
[INFO ] [v8.0/forgejo] Cherry picking 1d3240887c519a04c13bcd7e852c6d6ad1cb00b5
[DEBUG] [v8.0/forgejo] Cherry picking command git cherry-pick,-m,1,--strategy=recursive,--strategy-option=theirs,1d3240887c519a04c13bcd7e852c6d6ad1cb00b5
[INFO ] [v8.0/forgejo] Cherry picking 781a37fbe18c223763f51968862f1c8f61e7e260
[DEBUG] [v8.0/forgejo] Cherry picking command git cherry-pick,-m,1,--strategy=recursive,--strategy-option=theirs,781a37fbe18c223763f51968862f1c8f61e7e260
[INFO ] [v8.0/forgejo] Cherry picking 8309f008c2721e313e1949ce42ed410e844c16e7
[DEBUG] [v8.0/forgejo] Cherry picking command git cherry-pick,-m,1,--strategy=recursive,--strategy-option=theirs,8309f008c2721e313e1949ce42ed410e844c16e7
[INFO ] [v8.0/forgejo] Cherry picking fae8d9f70d31704af91cbf37bcefcc4772830695
[DEBUG] [v8.0/forgejo] Cherry picking command git cherry-pick,-m,1,--strategy=recursive,--strategy-option=theirs,fae8d9f70d31704af91cbf37bcefcc4772830695
[INFO ] [v8.0/forgejo] Cherry picking 6721cba75b4997448b618a4b00ef25f142924de0
[DEBUG] [v8.0/forgejo] Cherry picking command git cherry-pick,-m,1,--strategy=recursive,--strategy-option=theirs,6721cba75b4997448b618a4b00ef25f142924de0
[INFO ] [v8.0/forgejo] Cherry picking 562e5cdf324597882b7e6971be1b9a148bbc7839
[DEBUG] [v8.0/forgejo] Cherry picking command git cherry-pick,-m,1,--strategy=recursive,--strategy-option=theirs,562e5cdf324597882b7e6971be1b9a148bbc7839
[INFO ] [v8.0/forgejo] Cherry picking d789d33229b3998bb33f1505d122504c8039f23d
[DEBUG] [v8.0/forgejo] Cherry picking command git cherry-pick,-m,1,--strategy=recursive,--strategy-option=theirs,d789d33229b3998bb33f1505d122504c8039f23d
[INFO ] [v8.0/forgejo] Cherry picking 8218e80bfc3a1f9ba02ce60f1acafdc0e57c5ae0
[DEBUG] [v8.0/forgejo] Cherry picking command git cherry-pick,-m,1,--strategy=recursive,--strategy-option=theirs,8218e80bfc3a1f9ba02ce60f1acafdc0e57c5ae0
[INFO ] [v8.0/forgejo] Cherry picking 10bca456a9140519e95559aa7bac2221e1156c5b
[DEBUG] [v8.0/forgejo] Cherry picking command git cherry-pick,-m,1,--strategy=recursive,--strategy-option=theirs,10bca456a9140519e95559aa7bac2221e1156c5b
[INFO ] [v8.0/forgejo] Cherry picking db6f6281fcf568ae8e35330a4a93c9be1cb46efd
[DEBUG] [v8.0/forgejo] Cherry picking command git cherry-pick,-m,1,--strategy=recursive,--strategy-option=theirs,db6f6281fcf568ae8e35330a4a93c9be1cb46efd
[INFO ] [v8.0/forgejo] Cherry picking ed8e8a792e75b930074cd3cf1bab580a09ff8485
[DEBUG] [v8.0/forgejo] Cherry picking command git cherry-pick,-m,1,--strategy=recursive,--strategy-option=theirs,ed8e8a792e75b930074cd3cf1bab580a09ff8485
[INFO ] [v8.0/forgejo] Cherry picking d6428f92ce7ce67d127cbd5bb4977aa92abf071c
[DEBUG] [v8.0/forgejo] Cherry picking command git cherry-pick,-m,1,--strategy=recursive,--strategy-option=theirs,d6428f92ce7ce67d127cbd5bb4977aa92abf071c
[INFO ] [v8.0/forgejo] Cherry picking 069d87b80f909e91626249afbb240a1df339a8fd
[DEBUG] [v8.0/forgejo] Cherry picking command git cherry-pick,-m,1,--strategy=recursive,--strategy-option=theirs,069d87b80f909e91626249afbb240a1df339a8fd
[INFO ] [v8.0/forgejo] Cherry picking 2b6546adc954d450a9c6befccd407ce2ca1636a0
[DEBUG] [v8.0/forgejo] Cherry picking command git cherry-pick,-m,1,--strategy=recursive,--strategy-option=theirs,2b6546adc954d450a9c6befccd407ce2ca1636a0
[INFO ] [v8.0/forgejo] Cherry picking 4c7cb0a5d20e8973b03e35d91119cf917eed125e
[DEBUG] [v8.0/forgejo] Cherry picking command git cherry-pick,-m,1,--strategy=recursive,--strategy-option=theirs,4c7cb0a5d20e8973b03e35d91119cf917eed125e
[INFO ] [v8.0/forgejo] Cherry picking 7e0014dd1391e123d95f2537c3b2165fef7122ef
[DEBUG] [v8.0/forgejo] Cherry picking command git cherry-pick,-m,1,--strategy=recursive,--strategy-option=theirs,7e0014dd1391e123d95f2537c3b2165fef7122ef
[INFO ] [v8.0/forgejo] Cherry picking 16a8658878a2656cb131453b728b65a89271f11f
[DEBUG] [v8.0/forgejo] Cherry picking command git cherry-pick,-m,1,--strategy=recursive,--strategy-option=theirs,16a8658878a2656cb131453b728b65a89271f11f
[INFO ] [v8.0/forgejo] Cherry picking 6e98bacbbd3c089b2ccfa725c58184f4dfe5e7fe
[DEBUG] [v8.0/forgejo] Cherry picking command git cherry-pick,-m,1,--strategy=recursive,--strategy-option=theirs,6e98bacbbd3c089b2ccfa725c58184f4dfe5e7fe

Checklist

  • Tests added if applicable.
  • Documentation updated if applicable.

Merge criteria:

  • The commits and have meaningful messages; the author will squash them after approval or will ask to merge with squash.
  • Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has manually tested the changes and verified that the changes work

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 pattern, therefore the commits should have the following format:

<type>(<optional scope>): <subject>
empty separator line
<optional body>
empty separator line
<optional footer>

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 <feat-branch> --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 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 section of the README.

Copy link
Contributor

Coverage report

St.
Category Percentage Covered / Total
🟢 Statements
89.71% (+0.04% 🔼)
497/554
🟢 Branches
86.88% (+0.64% 🔼)
192/221
🟢 Functions 87.4% 111/127
🟢 Lines
89.57% (+0.04% 🔼)
481/537

Test suite run success

215 tests passing in 18 suites.

Report generated by 🧪jest coverage report action from e986f06

@lampajr lampajr merged commit cb3473d into kiegroup:main Jul 16, 2024
6 checks passed
@lampajr lampajr deleted the wrong_commits_order branch July 16, 2024 15:49
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.

Commits are cherry-picked in the wrong order on github
1 participant