Initial stabilization #1
3 changed files with 36 additions and 1 deletions
commit
c498dd20a0
16
Cargo.lock
generated
16
Cargo.lock
generated
|
|
@ -51,6 +51,7 @@ version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anode",
|
"anode",
|
||||||
"anode-build",
|
"anode-build",
|
||||||
|
"secrecy",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
@ -106,6 +107,15 @@ version = "1.0.23"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f"
|
checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "secrecy"
|
||||||
|
version = "0.10.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e891af845473308773346dc847b2c23ee78fe442e0472ac50e22a18a93d3ae5a"
|
||||||
|
dependencies = [
|
||||||
|
"zeroize",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde"
|
name = "serde"
|
||||||
version = "1.0.228"
|
version = "1.0.228"
|
||||||
|
|
@ -191,3 +201,9 @@ dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
"unsafe-libyaml",
|
"unsafe-libyaml",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "zeroize"
|
||||||
|
version = "1.8.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0"
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
anode = { git = "https://git.dzuchun.ing/dzu/anode.git", version = "0.1.0" }
|
anode = { git = "https://git.dzuchun.ing/dzu/anode.git", version = "0.1.0" }
|
||||||
|
secrecy = "0.10.3"
|
||||||
thiserror = "2.0.18"
|
thiserror = "2.0.18"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
|
|
|
||||||
20
src/main.rs
20
src/main.rs
|
|
@ -1,5 +1,7 @@
|
||||||
use std::{ffi::OsString, path::PathBuf, str::FromStr, string::FromUtf8Error};
|
use std::{ffi::OsString, path::PathBuf, str::FromStr, string::FromUtf8Error};
|
||||||
|
|
||||||
|
use secrecy::SecretString;
|
||||||
|
|
||||||
fn paths_parser(input: OsString) -> Result<Vec<PathBuf>, FromUtf8Error> {
|
fn paths_parser(input: OsString) -> Result<Vec<PathBuf>, FromUtf8Error> {
|
||||||
let input = String::from_utf8(input.into_encoded_bytes())?;
|
let input = String::from_utf8(input.into_encoded_bytes())?;
|
||||||
let mut paths = Vec::new();
|
let mut paths = Vec::new();
|
||||||
|
|
@ -56,7 +58,23 @@ struct Input {
|
||||||
key: CacheKey,
|
key: CacheKey,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, thiserror::Error)]
|
||||||
|
enum ActionsTokenError {
|
||||||
|
#[error("Could not find action runtime token")]
|
||||||
|
NotPresent,
|
||||||
|
#[error("Action runtime token was not UTF-8 -encoded")]
|
||||||
|
NotUtf8,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn actions_token() -> Result<SecretString, ActionsTokenError> {
|
||||||
|
let os_str = std::env::var_os("ACTIONS_RUNTIME_TOKEN").ok_or(ActionsTokenError::NotPresent)?;
|
||||||
|
let str =
|
||||||
|
String::from_utf8(os_str.into_encoded_bytes()).map_err(|_| ActionsTokenError::NotUtf8)?;
|
||||||
|
Ok(SecretString::new(str.into_boxed_str()))
|
||||||
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let input = Input::get();
|
let input = Input::get();
|
||||||
println!("Inputs: {input:#?}");
|
let actions_token = actions_token().unwrap();
|
||||||
|
println!("Inputs: {input:#?}, token: {actions_token:?}");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue