Skip to content
This repository has been archived by the owner on Jan 19, 2024. It is now read-only.

Commit

Permalink
Read GHSTACK_OAUTH_TOKEN from ~/.gh-stack
Browse files Browse the repository at this point in the history
  • Loading branch information
timothyandrew committed Dec 4, 2020
1 parent 45e54e9 commit d092b05
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ git2 = "0.13"
dialoguer = "0.6.2"
clap = "2.33"
console = "0.11"
dotenv = "0.15"
10 changes: 3 additions & 7 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use git2::Repository;
use std::collections::HashMap;
use std::env;
use console::style;
use std::error::Error;
Expand Down Expand Up @@ -84,13 +83,10 @@ async fn build_pr_stack(pattern: &str, credentials: &Credentials) -> Result<Flat

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
let env: HashMap<String, String> = env::vars().collect();
dotenv::from_filename(".gh-stack").ok();

let token = env
.get("GHSTACK_OAUTH_TOKEN")
.expect("You didn't pass `GHSTACK_OAUTH_TOKEN`");

let credentials = Credentials::new(token);
let token = env::var("GHSTACK_OAUTH_TOKEN").expect("You didn't pass `GHSTACK_OAUTH_TOKEN`");
let credentials = Credentials::new(&token);
let matches = clap().get_matches();

match matches.subcommand() {
Expand Down

0 comments on commit d092b05

Please sign in to comment.