Skip to content

Commit

Permalink
warn if no github token
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanatkn committed Dec 13, 2023
1 parent 58ff835 commit caf585c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/happy-kangaroos-tell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@grogarden/gro": patch
---

warn if no github token
7 changes: 5 additions & 2 deletions src/lib/changelog.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ import {readFile, writeFile} from 'fs/promises';
import {update_changelog} from './changelog.js';
import {load_from_env} from './env.js';

const token = await load_from_env('GITHUB_TOKEN_SECRET');

const log = new Logger();

const token = await load_from_env('GITHUB_TOKEN_SECRET');
if (!token) {
log.warn('the env var GITHUB_TOKEN_SECRET was not found, so API calls with be unauthorized');
}

const fixture_path = 'src/fixtures/changelog_example.md';

// TODO ideally this is just a ts file, but there's a problem where building outputs a `.d.ts` file (fix in SvelteKit/Vite/tsconfig?)
Expand Down
5 changes: 5 additions & 0 deletions src/lib/publish.task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ export const task: Task<Args> = {

if (!preserve_changelog) {
const token = await load_from_env('GITHUB_TOKEN_SECRET');
if (!token) {
log.warn(
'the env var GITHUB_TOKEN_SECRET was not found, so API calls with be unauthorized',
);
}
await update_changelog(parsed_repo_url.owner, parsed_repo_url.repo, changelog, token, log);
}

Expand Down

0 comments on commit caf585c

Please sign in to comment.