Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: renovatebot/renovate
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 37.281.2
Choose a base ref
...
head repository: renovatebot/renovate
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 37.281.3
Choose a head ref
  • 4 commits
  • 5 files changed
  • 2 contributors

Commits on Apr 9, 2024

  1. chore(deps): update codecov/codecov-action action to v4.3.0 (#28296)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Apr 9, 2024
    Copy the full SHA
    85dfa58 View commit details

Commits on Apr 10, 2024

  1. fix(http): honor authType first (#28304)

    rarkins authored Apr 10, 2024
    Copy the full SHA
    ee34245 View commit details
  2. build(deps): update opentelemetry-js monorepo (#28305)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Apr 10, 2024
    Copy the full SHA
    f25c281 View commit details
  3. chore(deps): update dependency type-fest to v4.15.0 (#28306)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Apr 10, 2024
    Copy the full SHA
    7f8c874 View commit details
Showing with 151 additions and 103 deletions.
  1. +1 −1 .github/workflows/build.yml
  2. +24 −0 lib/util/http/auth.spec.ts
  3. +9 −9 lib/util/http/auth.ts
  4. +9 −9 package.json
  5. +108 −84 pnpm-lock.yaml
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -392,7 +392,7 @@ jobs:
merge-multiple: true

- name: Codecov
uses: codecov/codecov-action@7afa10ed9b269c561c2336fd862446844e0cbf71 # v4.2.0
uses: codecov/codecov-action@84508663e988701840491b86de86b666e8a86bed # v4.3.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: coverage/lcov
24 changes: 24 additions & 0 deletions lib/util/http/auth.spec.ts
Original file line number Diff line number Diff line change
@@ -189,6 +189,30 @@ describe('util/http/auth', () => {
token: 'test',
});
});

it(`honors authType`, () => {
const opts: GotOptions = {
headers: {},
token: 'test',
context: {
authType: 'Bearer',
},
hostType: 'custom',
};

applyAuthorization(opts);

expect(opts).toEqual({
context: {
authType: 'Bearer',
},
headers: {
authorization: 'Bearer test',
},
hostType: 'custom',
token: 'test',
});
});
});

describe('removeAuthorization', () => {
18 changes: 9 additions & 9 deletions lib/util/http/auth.ts
Original file line number Diff line number Diff line change
@@ -29,7 +29,14 @@ export function applyAuthorization<GotOptions extends AuthGotOptions>(

options.headers ??= {};
if (options.token) {
if (
const authType = options.context?.authType;
if (authType) {
if (authType === 'Token-Only') {
options.headers.authorization = options.token;
} else {
options.headers.authorization = `${authType} ${options.token}`;
}
} else if (
options.hostType &&
GITEA_API_USING_HOST_TYPES.includes(options.hostType)
) {
@@ -61,14 +68,7 @@ export function applyAuthorization<GotOptions extends AuthGotOptions>(
options.headers.authorization = `Bearer ${options.token}`;
}
} else {
// Custom Auth type, eg `Basic XXXX_TOKEN`
const type = options.context?.authType ?? 'Bearer';

if (type === 'Token-Only') {
options.headers.authorization = options.token;
} else {
options.headers.authorization = `${type} ${options.token}`;
}
options.headers.authorization = `Bearer ${options.token}`;
}
delete options.token;
} else if (options.password !== undefined) {
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -152,15 +152,15 @@
"@breejs/later": "4.2.0",
"@cdktf/hcl2json": "0.20.6",
"@opentelemetry/api": "1.8.0",
"@opentelemetry/context-async-hooks": "1.22.0",
"@opentelemetry/exporter-trace-otlp-http": "0.49.1",
"@opentelemetry/instrumentation": "0.49.1",
"@opentelemetry/context-async-hooks": "1.23.0",
"@opentelemetry/exporter-trace-otlp-http": "0.50.0",
"@opentelemetry/instrumentation": "0.50.0",
"@opentelemetry/instrumentation-bunyan": "0.36.0",
"@opentelemetry/instrumentation-http": "0.49.1",
"@opentelemetry/resources": "1.22.0",
"@opentelemetry/sdk-trace-base": "1.22.0",
"@opentelemetry/sdk-trace-node": "1.22.0",
"@opentelemetry/semantic-conventions": "1.22.0",
"@opentelemetry/instrumentation-http": "0.50.0",
"@opentelemetry/resources": "1.23.0",
"@opentelemetry/sdk-trace-base": "1.23.0",
"@opentelemetry/sdk-trace-node": "1.23.0",
"@opentelemetry/semantic-conventions": "1.23.0",
"@qnighy/marshal": "0.1.3",
"@renovatebot/osv-offline": "1.5.3",
"@renovatebot/pep440": "3.0.19",
@@ -343,7 +343,7 @@
"tmp-promise": "3.0.3",
"ts-jest": "29.1.2",
"ts-node": "10.9.2",
"type-fest": "4.14.0",
"type-fest": "4.15.0",
"typescript": "5.3.3",
"unified": "9.2.2"
},
Loading