Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/util/changelogs.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { z } from "astro:schema";
import { getCollection } from "astro:content";
import { type CollectionEntry } from "astro:content";
import { readFile } from "fs/promises";

export async function getChangelogs(opts?: {
filter?: Parameters<typeof getCollection<"changelogs">>[1];
Expand Down Expand Up @@ -60,8 +61,21 @@ export async function getChangelogs(opts?: {
export async function getWranglerChangelog(): Promise<
CollectionEntry<"changelogs">
> {
let authHeaders = {};

readFile("assets/secrets/github_tokens.txt", { encoding: "utf8" })
.then((data) => {
authHeaders = { Authorization: `Bearer ${data.trim()}` };
})
.catch((_) => {
// console.log(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably not worth to output anything here.

// "[GetWranglerChangelog] Info: No GitHub token found.",
// );
});

const response = await fetch(
"https://api.github.com/repos/cloudflare/workers-sdk/releases",
{ headers: authHeaders },
);

if (!response.ok) {
Expand Down
Loading