Skip to main content

semver_common/tools/git/
auth.rs

1pub mod github;
2
3use r_log::Logger;
4use serde::{Deserialize, Serialize};
5use std::collections::HashMap;
6
7use crate::Alert;
8
9#[derive(Serialize, Deserialize, PartialEq, Debug)]
10pub enum Auth {
11    GITHUB,
12}
13
14impl Auth {
15    /// Performs authentication with repository service based on which state Auth is.
16    /// Supplies the environment variables from the running environment.
17    pub fn authenticate(
18        &self,
19        env: &HashMap<String, String>,
20        logger: &Logger,
21    ) -> Result<(), Alert> {
22        match self {
23            Auth::GITHUB => {
24                github::set_remote(env, logger)?;
25            }
26        }
27        Ok(())
28    }
29}