kiegroup / git-backporting

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

fix: auto-no-squash inference for GitLab #140

Closed peat-psuwit closed 1 month ago

peat-psuwit commented 1 month ago

Thank you for submitting this pull request

Description

When a GitLab MR is not squashed, squash_commit_sha will be null, not undefined. Update inferSquash() to account for this.

How Has This Been Tested?

node dist/cli/index.js -pr https://gitla
b.com/ubports/development/core/lomiri-system-settings-cellular/-/merge_requests/10 --auto-no-squash -tb personal/peat-psuwit
/ignore-me-test-backporter -d
[WARN ] Dry run enabled
[INFO ] Auth argument not provided, checking available tokens from env..
[INFO ] Git token not found in the environment
[DEBUG] Setting up gitlab client: apiUrl=https://gitlab.com/api/v4, token=****
[DEBUG] Parsing configs..
[DEBUG] cherry-pick the merged commit(s)
[DEBUG] [personal/peat-psuwit/ignore-me-test-backporter] Cloning repo..
[INFO ] [personal/peat-psuwit/ignore-me-test-backporter] Cloning repository https://gitlab.com/ubports/development/core/lomiri-system-settings-cellular.git to /workspaces/git-backporting/bp
[DEBUG] [personal/peat-psuwit/ignore-me-test-backporter] Creating local branch..
[INFO ] [personal/peat-psuwit/ignore-me-test-backporter] Creating branch bp-personal/peat-psuwit/ignore-me-test-backporter-97c8dc6-2d0c909
[DEBUG] [personal/peat-psuwit/ignore-me-test-backporter] Cherry picking commits..
[INFO ] [personal/peat-psuwit/ignore-me-test-backporter] Cherry picking 97c8dc681c1f732cb174c809209de666b9b833db
[DEBUG] [personal/peat-psuwit/ignore-me-test-backporter] Cherry picking command git cherry-pick,-m,1,--strategy=recursive,--strategy-option=theirs,97c8dc681c1f732cb174c809209de666b9b833db
[INFO ] [personal/peat-psuwit/ignore-me-test-backporter] Cherry picking 2d0c9092db2900c675a728e135b2365f04687d9e
[DEBUG] [personal/peat-psuwit/ignore-me-test-backporter] Cherry picking command git cherry-pick,-m,1,--strategy=recursive,--strategy-option=theirs,2d0c9092db2900c675a728e135b2365f04687d9e
[WARN ] [personal/peat-psuwit/ignore-me-test-backporter] Pull request creation and remote push skipped
[INFO ] [personal/peat-psuwit/ignore-me-test-backporter] {
  "owner": "ubports/development/core",
  "repo": "lomiri-system-settings-cellular",
  "head": "bp-personal/peat-psuwit/ignore-me-test-backporter-97c8dc6-2d0c909",
  "base": "personal/peat-psuwit/ignore-me-test-backporter",
  "title": "[personal/peat-psuwit/ignore-me-test-backporter] Implement a VoLTE Switch in Cellular Settings",
  "body": "**Backport:** https://gitlab.com/ubports/development/core/lomiri-system-settings-cellular/-/merge_requests/10\r\n\r\nFor the switch to be shown, device port has to set a new\nOfonoImplementsIms configuration value in deviceinfo.\n\nThe reason for enabling it per-device is that there is currently no\nway to query from ofono-binder-plugin whether it has an underlying\nextension that implements IMS, since it always registers the ofono\nIMS driver.\n\nPutting it as draft for discussion for now, as I'm not quite sure about where to put the settings item exactly across single-SIM and dual-SIM setups.\n\n![screenshot20240914_230337458](/uploads/064dcdae23b09f26244a776821cff6fd/screenshot20240914_230337458.png){width=400px}\n![screenshot20240914_214640538](/uploads/11598b17c0b3b6f2a9004c18d14857a2/screenshot20240914_214640538.png){width=400px}",
  "reviewers": [
    "NotKit",
    "peat-psuwit"
  ],
  "assignees": [],
  "labels": [],
  "comments": []
}
[INFO ] Process succeeded

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 1 month ago

Coverage report

St.:grey_question:
Category Percentage Covered / Total
🟒 Statements 89.71% 497/554
🟒 Branches 86.1% 192/223
🟒 Functions 87.4% 111/127
🟒 Lines 89.57% 481/537

Test suite run success

217 tests passing in 18 suites.

Report generated by πŸ§ͺjest coverage report action from 568f2e47fcd9ba27b204dc82ad7cf896ceaf1fb3