Initial stabilization #1

Merged
dzu merged 22 commits from stabilize-v1 into main 2026-02-21 04:54:42 +01:00
3 changed files with 36 additions and 1 deletions
Showing only changes of commit c498dd20a0 - Show all commits

add runtime action token parsing
All checks were successful
Build and update the action / build-and-upload (push) Successful in 54s

Artem Diachenko 2026-02-15 18:12:03 +00:00

16
Cargo.lock generated
View file

@ -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"

View file

@ -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]

View file

@ -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:?}");
} }