Skip to content

Commit ff9c0fc

Browse files
authored
Merge pull request #32 from ileodo/working
Some Improvements
2 parents deda61b + 295d7bf commit ff9c0fc

File tree

9 files changed

+368
-165
lines changed

9 files changed

+368
-165
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
*.alfredworkflow
22
build/
33
coverage/
4+
out/
5+
tmp/

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,24 @@ This command works the same as the previous one (`gh <query>`) but it limits the
3232

3333
This command searches within the Pull Requests that you're involved in.
3434

35+
If you want to limit the search to be under your organisations, please remove `PR_ALL_INVOLVE_ME` environment variable
36+
3537
### Open notifications: `gh-notifications`
3638

3739
This command just opens your [Github notification][notifications-page] page.
3840

41+
## Config Cache TTL
42+
43+
You can customise the TTL for the internal caches of Repos/Organisations/PullRequests by seting the following
44+
environment variables. (all in seconds)
45+
46+
```
47+
> CACHE_TTL_SEC_ORG default: 86400
48+
> CACHE_TTL_SEC_PR default: 300
49+
> CACHE_TTL_SEC_REPO default: 86400
50+
```
51+
52+
3953
## Configuring host for Enterprise
4054

4155
If you're using an Enterprise account, you can call the `gh-host <host>` command.

app.rb

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,14 @@ class App
1515
class << self
1616
def client
1717
DataSource::Client::Github.new(
18-
host: ENV['GITHUB_HOST'] || 'api.github.com',
18+
host: ENV['GITHUB_API_HOST'],
1919
access_token: ENV['GITHUB_ACCESS_TOKEN'],
20-
cache_dir: ENV['alfred_workflow_cache']
20+
me_account: ENV['GITHUB_ME_ACCOUNT'],
21+
pr_all_involve_me: bool_env('PR_ALL_INVOLVE_ME'),
22+
cache_dir: ENV['alfred_workflow_cache'],
23+
cache_ttl_sec_repo: ENV['CACHE_TTL_SEC_REPO'].to_i,
24+
cache_ttl_sec_org: ENV['CACHE_TTL_SEC_ORG'].to_i,
25+
cache_ttl_sec_pr: ENV['CACHE_TTL_SEC_PR'].to_i
2126
)
2227
end
2328

@@ -44,5 +49,10 @@ def user_repos
4449
def user_pulls
4550
Commands::UserPulls.new(pull_requests: pull_requests)
4651
end
52+
53+
private
54+
def bool_env(env_var_name)
55+
ENV.fetch(env_var_name, 'false').downcase == 'true'
56+
end
4757
end
4858
end

0 commit comments

Comments
 (0)