Skip to content

Commit

Permalink
Merge pull request #32 from ileodo/working
Browse files Browse the repository at this point in the history
Some Improvements
  • Loading branch information
edgarjs authored Feb 14, 2021
2 parents deda61b + 295d7bf commit ff9c0fc
Show file tree
Hide file tree
Showing 9 changed files with 368 additions and 165 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
*.alfredworkflow
build/
coverage/
out/
tmp/
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,24 @@ This command works the same as the previous one (`gh <query>`) but it limits the

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

If you want to limit the search to be under your organisations, please remove `PR_ALL_INVOLVE_ME` environment variable

### Open notifications: `gh-notifications`

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

## Config Cache TTL

You can customise the TTL for the internal caches of Repos/Organisations/PullRequests by seting the following
environment variables. (all in seconds)

```
> CACHE_TTL_SEC_ORG default: 86400
> CACHE_TTL_SEC_PR default: 300
> CACHE_TTL_SEC_REPO default: 86400
```


## Configuring host for Enterprise

If you're using an Enterprise account, you can call the `gh-host <host>` command.
Expand Down
14 changes: 12 additions & 2 deletions app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,14 @@ class App
class << self
def client
DataSource::Client::Github.new(
host: ENV['GITHUB_HOST'] || 'api.github.com',
host: ENV['GITHUB_API_HOST'],
access_token: ENV['GITHUB_ACCESS_TOKEN'],
cache_dir: ENV['alfred_workflow_cache']
me_account: ENV['GITHUB_ME_ACCOUNT'],
pr_all_involve_me: bool_env('PR_ALL_INVOLVE_ME'),
cache_dir: ENV['alfred_workflow_cache'],
cache_ttl_sec_repo: ENV['CACHE_TTL_SEC_REPO'].to_i,
cache_ttl_sec_org: ENV['CACHE_TTL_SEC_ORG'].to_i,
cache_ttl_sec_pr: ENV['CACHE_TTL_SEC_PR'].to_i
)
end

Expand All @@ -44,5 +49,10 @@ def user_repos
def user_pulls
Commands::UserPulls.new(pull_requests: pull_requests)
end

private
def bool_env(env_var_name)
ENV.fetch(env_var_name, 'false').downcase == 'true'
end
end
end
Loading

0 comments on commit ff9c0fc

Please sign in to comment.