Closed earl-warren closed 6 months ago
St.:grey_question: |
Category | Percentage | Covered / Total |
---|---|---|---|
π’ | Statements | 91.28% (+0.46% πΌ) |
429/470 |
π’ | Branches | 85.86% (+1.67% πΌ) |
170/198 |
π’ | Functions | 88.24% | 105/119 |
π’ | Lines | 91.23% (+0.48% πΌ) |
416/456 |
169 tests passing in 16 suites.
Report generated by π§ͺjest coverage report action from 5f12c50c451e799fb6300483c377f0e741958500
This is probably not how you would like that implemented and I'm ready to make improvements. The original author of the patch may also be willing to improve upon it.
added tests
Hey @earl-warren , this looks a great idea!
I see you already added some tests, thx a lot!
After a quick check looks good to me, I will deeply check it in a while :rocket:
Overall looks great to me!
Just a couple of missing things:
* Could you please add the same `git-client` param in the [`action.yaml`](https://github.com/kiegroup/git-backporting/blob/main/action.yml#L3-L72) for the GHA * If I run `npm run build` locally I see the following diff:
"query", "search", - "hash", ]; // Create handlers that pass events from native requests @@ -6325,7 +6324,7 @@ RedirectableRequest.prototype._processResponse = function (response) { redirectUrl.protocol !== "https:" || redirectUrl.host !== currentHost && !isSubdomain(redirectUrl.host, currentHost)) { - removeMatchingHeaders(/^(?:(?:proxy-)?authorization|cookie)$/i, this._options.headers); + removeMatchingHeaders(/^(?:authorization|cookie)$/i, this._options.headers); } // Evaluate the beforeRedirect callback diff --git a/dist/gha/index.js b/dist/gha/index.js index b50c45c..21cc4e7 100755 --- a/dist/gha/index.js +++ b/dist/gha/index.js @@ -7621,7 +7621,6 @@ var preservedUrlFields = [ "protocol", "query", "search", - "hash", ]; // Create handlers that pass events from native requests @@ -8055,7 +8054,7 @@ RedirectableRequest.prototype._processResponse = function (response) { redirectUrl.protocol !== "https:" || redirectUrl.host !== currentHost && !isSubdomain(redirectUrl.host, currentHost)) { - removeMatchingHeaders(/^(?:(?:proxy-)?authorization|cookie)$/i, this._options.headers); + removeMatchingHeaders(/^(?:authorization|cookie)$/i, this._options.headers); }
Do you mind to double check this?
I have no clue why it does that in my environment. I'll remove these hunks and figure that out later.
* Could you please add the same `git-client` param in the [`action.yaml`](https://github.com/kiegroup/git-backporting/blob/main/action.yml#L3-L72) for the GHA
Here is the output of npm run build
on my environment. There evidently is a difference in my environment that matters but I don't know how to figure that out. Do you have a suggestion? Not that it matters in the context of this PRs but it would be nice to have clean content the next time around :pray:
earl-warren:~/software/git-backporting$ npm run build
> @kie/git-backporting@4.5.2 build
> npm run clean && npm run compile && npm run package
> @kie/git-backporting@4.5.2 clean
> rm -rf ./build ./dist
> @kie/git-backporting@4.5.2 compile
> tsc -p tsconfig.json && tsc-alias -p tsconfig.json
> @kie/git-backporting@4.5.2 package
> npm run package:cli && npm run package:gha
> @kie/git-backporting@4.5.2 package:cli
> ncc build ./build/src/bin/cli.js -o dist/cli
ncc: Version 0.36.0
ncc: Compiling file index.js into CJS
1105kB dist/cli/index.js
1105kB [950ms] - ncc 0.36.0
> @kie/git-backporting@4.5.2 package:gha
> ncc build ./build/src/bin/gha.js -o dist/gha
ncc: Version 0.36.0
ncc: Compiling file index.js into CJS
1095kB dist/gha/index.js
1095kB [1009ms] - ncc 0.36.0
earl-warren:~/software/git-backporting$ git diff
diff --git a/dist/cli/index.js b/dist/cli/index.js
index a3f1819..77ad9bf 100755
--- a/dist/cli/index.js
+++ b/dist/cli/index.js
@@ -5891,6 +5891,7 @@ var preservedUrlFields = [
"protocol",
"query",
"search",
+ "hash",
];
// Create handlers that pass events from native requests
@@ -6324,7 +6325,7 @@ RedirectableRequest.prototype._processResponse = function (response) {
redirectUrl.protocol !== "https:" ||
redirectUrl.host !== currentHost &&
!isSubdomain(redirectUrl.host, currentHost)) {
- removeMatchingHeaders(/^(?:authorization|cookie)$/i, this._options.headers);
+ removeMatchingHeaders(/^(?:(?:proxy-)?authorization|cookie)$/i, this._options.headers);
}
// Evaluate the beforeRedirect callback
diff --git a/dist/gha/index.js b/dist/gha/index.js
index 21cc4e7..b50c45c 100755
--- a/dist/gha/index.js
+++ b/dist/gha/index.js
@@ -7621,6 +7621,7 @@ var preservedUrlFields = [
"protocol",
"query",
"search",
+ "hash",
];
// Create handlers that pass events from native requests
@@ -8054,7 +8055,7 @@ RedirectableRequest.prototype._processResponse = function (response) {
redirectUrl.protocol !== "https:" ||
redirectUrl.host !== currentHost &&
!isSubdomain(redirectUrl.host, currentHost)) {
- removeMatchingHeaders(/^(?:authorization|cookie)$/i, this._options.headers);
+ removeMatchingHeaders(/^(?:(?:proxy-)?authorization|cookie)$/i, this._options.headers);
}
// Evaluate the beforeRedirect callback
codeberg is running Forgejo and it may not be possible to infer that from the URL alone. The same is true for GitHub Enterprise Server.