Skip to content
Merged
Show file tree
Hide file tree
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
13 changes: 0 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,3 @@ clean-all: clean
.PHONY: upgrade-deps
upgrade-deps:
npm run upgrade-deps

# Manual test targets (requires CALS_GITHUB_TOKEN env var)
.PHONY: test-repos
test-repos:
CALS_GITHUB_TOKEN=$(CALS_GITHUB_TOKEN) node lib/cals-cli.mjs repos --org capralifecycle --compact

.PHONY: test-clone
test-clone:
CALS_GITHUB_TOKEN=$(CALS_GITHUB_TOKEN) node lib/cals-cli.mjs clone --org capralifecycle --all | head -5

.PHONY: test-help
test-help:
node lib/cals-cli.mjs --help
5 changes: 3 additions & 2 deletions src/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@ Before using, authenticate with: cals auth`)
.command(topics)
.version(version)
.demandCommand()
.option("no-cache", {
describe: "Bypass cache and fetch fresh data",
.option("cache", {
describe: "Use cached data",
type: "boolean",
default: true,
})
.example("cals auth", "Set GitHub token")
.example("cals repos", "List repositories")
Expand Down
2 changes: 1 addition & 1 deletion src/cli/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function createCacheProvider(
): CacheProvider {
const cache = new CacheProvider(config)

if (argv.noCache === true) {
if (argv.cache === false) {
cache.mustValidate = true
}

Expand Down
8 changes: 3 additions & 5 deletions src/github/token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,16 @@ export class GitHubTokenCliProvider implements GitHubTokenProvider {
private keyringAccount = "github-token"

async getToken(): Promise<string | undefined> {
if (process.env.CALS_GITHUB_TOKEN) {
return process.env.CALS_GITHUB_TOKEN
if (process.env.GITHUB_TOKEN) {
return process.env.GITHUB_TOKEN
}

const result = await keytar.getPassword(
this.keyringService,
this.keyringAccount,
)
if (result == null) {
process.stderr.write(
"No token found. Register using `cals github set-token`\n",
)
process.stderr.write("No token found. Register using `cals auth`\n")
return undefined
}

Expand Down