Skip to content

Commit 4fac213

Browse files
authored
Merge pull request #299 from capralifecycle/cals-1247-rename-cals-github-token
CALS-1247: Rename github token
2 parents 2fe63c7 + 947c7d0 commit 4fac213

4 files changed

Lines changed: 7 additions & 21 deletions

File tree

Makefile

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,3 @@ clean-all: clean
5454
.PHONY: upgrade-deps
5555
upgrade-deps:
5656
npm run upgrade-deps
57-
58-
# Manual test targets (requires CALS_GITHUB_TOKEN env var)
59-
.PHONY: test-repos
60-
test-repos:
61-
CALS_GITHUB_TOKEN=$(CALS_GITHUB_TOKEN) node lib/cals-cli.mjs repos --org capralifecycle --compact
62-
63-
.PHONY: test-clone
64-
test-clone:
65-
CALS_GITHUB_TOKEN=$(CALS_GITHUB_TOKEN) node lib/cals-cli.mjs clone --org capralifecycle --all | head -5
66-
67-
.PHONY: test-help
68-
test-help:
69-
node lib/cals-cli.mjs --help

src/cli/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,10 @@ Before using, authenticate with: cals auth`)
5656
.command(topics)
5757
.version(version)
5858
.demandCommand()
59-
.option("no-cache", {
60-
describe: "Bypass cache and fetch fresh data",
59+
.option("cache", {
60+
describe: "Use cached data",
6161
type: "boolean",
62+
default: true,
6263
})
6364
.example("cals auth", "Set GitHub token")
6465
.example("cals repos", "List repositories")

src/cli/util.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export function createCacheProvider(
1212
): CacheProvider {
1313
const cache = new CacheProvider(config)
1414

15-
if (argv.noCache === true) {
15+
if (argv.cache === false) {
1616
cache.mustValidate = true
1717
}
1818

src/github/token.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,16 @@ export class GitHubTokenCliProvider implements GitHubTokenProvider {
1111
private keyringAccount = "github-token"
1212

1313
async getToken(): Promise<string | undefined> {
14-
if (process.env.CALS_GITHUB_TOKEN) {
15-
return process.env.CALS_GITHUB_TOKEN
14+
if (process.env.GITHUB_TOKEN) {
15+
return process.env.GITHUB_TOKEN
1616
}
1717

1818
const result = await keytar.getPassword(
1919
this.keyringService,
2020
this.keyringAccount,
2121
)
2222
if (result == null) {
23-
process.stderr.write(
24-
"No token found. Register using `cals github set-token`\n",
25-
)
23+
process.stderr.write("No token found. Register using `cals auth`\n")
2624
return undefined
2725
}
2826

0 commit comments

Comments
 (0)