mirror of
https://github.com/oven-sh/bun
synced 2026-02-12 20:09:04 +00:00
fix flaky bun-create.test.ts with git templates (#10662)
This commit is contained in:
@@ -207,8 +207,8 @@ After cloning a template, `bun create` will automatically remove the `"bun-creat
|
||||
|
||||
---
|
||||
|
||||
- `GITHUB_ACCESS_TOKEN`
|
||||
- This lets `bun create` work with private repositories or if you get rate-limited
|
||||
- `GITHUB_TOKEN` (or `GITHUB_ACCESS_TOKEN`)
|
||||
- This lets `bun create` work with private repositories or if you get rate-limited. `GITHUB_TOKEN` is chosen over `GITHUB_ACCESS_TOKEN` if both exist.
|
||||
|
||||
{% /table %}
|
||||
|
||||
|
||||
@@ -2206,7 +2206,7 @@ pub const Command = struct {
|
||||
\\ <b><green>bun create<r> <blue>\<username/repo\><r> <cyan>[...flags]<r> <blue>[dest]<r>
|
||||
\\
|
||||
\\<b>Environment variables:<r>
|
||||
\\ <cyan>GITHUB_ACCESS_TOKEN<r> <d>Supply a token to download code from GitHub with a higher rate limit<r>
|
||||
\\ <cyan>GITHUB_TOKEN<r> <d>Supply a token to download code from GitHub with a higher rate limit<r>
|
||||
\\ <cyan>GITHUB_API_DOMAIN<r> <d>Configure custom/enterprise GitHub domain. Default "api.github.com".<r>
|
||||
\\ <cyan>NPM_CLIENT<r> <d>Absolute path to the npm client executable<r>
|
||||
;
|
||||
|
||||
@@ -1851,7 +1851,7 @@ pub const Example = struct {
|
||||
var header_entries: Headers.Entries = .{};
|
||||
var headers_buf: string = "";
|
||||
|
||||
if (env_loader.map.get("GITHUB_ACCESS_TOKEN")) |access_token| {
|
||||
if (env_loader.map.get("GITHUB_TOKEN") orelse env_loader.map.get("GITHUB_ACCESS_TOKEN")) |access_token| {
|
||||
if (access_token.len > 0) {
|
||||
headers_buf = try std.fmt.allocPrint(ctx.allocator, "AuthorizationBearer {s}", .{access_token});
|
||||
try header_entries.append(
|
||||
|
||||
@@ -211,19 +211,19 @@ pub const UpgradeCommand = struct {
|
||||
),
|
||||
);
|
||||
|
||||
if (env_loader.map.get("GITHUB_ACCESS_TOKEN")) |access_token| {
|
||||
if (env_loader.map.get("GITHUB_TOKEN") orelse env_loader.map.get("GITHUB_ACCESS_TOKEN")) |access_token| {
|
||||
if (access_token.len > 0) {
|
||||
headers_buf = try std.fmt.allocPrint(allocator, default_github_headers ++ "Access-TokenBearer {s}", .{access_token});
|
||||
headers_buf = try std.fmt.allocPrint(allocator, default_github_headers ++ "AuthorizationBearer {s}", .{access_token});
|
||||
try header_entries.append(
|
||||
allocator,
|
||||
Headers.Kv{
|
||||
.name = Api.StringPointer{
|
||||
.offset = accept.value.length + accept.value.offset,
|
||||
.length = @as(u32, @intCast("Access-Token".len)),
|
||||
.offset = accept.value.offset + accept.value.length,
|
||||
.length = @as(u32, @intCast("Authorization".len)),
|
||||
},
|
||||
.value = Api.StringPointer{
|
||||
.offset = @as(u32, @intCast(accept.value.length + accept.value.offset + "Access-Token".len)),
|
||||
.length = @as(u32, @intCast(access_token.len)),
|
||||
.offset = @as(u32, @intCast(accept.value.offset + accept.value.length + "Authorization".len)),
|
||||
.length = @as(u32, @intCast("Bearer ".len + access_token.len)),
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user