macro_rules! repository {
() => {
"water-rs/stow"
};
}
macro_rules! workflow_file {
() => {
"build-crate.yml"
};
}
macro_rules! index_workflow_file {
() => {
"index-publish.yml"
};
}
macro_rules! branch {
() => {
"main"
};
}
pub const REPOSITORY: &str = repository!();
pub const WORKFLOW_FILE: &str = workflow_file!();
pub const BRANCH: &str = branch!();
pub const CERTIFICATE_IDENTITY: &str = concat!(
"https://github.com/",
repository!(),
"/.github/workflows/",
workflow_file!(),
"@refs/heads/",
branch!()
);
pub const CERTIFICATE_ISSUER: &str = "https://token.actions.githubusercontent.com";
pub const INDEX_WORKFLOW_FILE: &str = index_workflow_file!();
pub const INDEX_CERTIFICATE_IDENTITY: &str = concat!(
"https://github.com/",
repository!(),
"/.github/workflows/",
index_workflow_file!(),
"@refs/heads/",
branch!()
);
#[cfg(test)]
mod tests {
use super::{CERTIFICATE_IDENTITY, INDEX_CERTIFICATE_IDENTITY};
#[test]
fn certificate_identity_composes_repository_workflow_and_ref() {
assert_eq!(
CERTIFICATE_IDENTITY,
"https://github.com/water-rs/stow/.github/workflows/build-crate.yml@refs/heads/main"
);
}
#[test]
fn index_certificate_identity_composes_repository_workflow_and_ref() {
assert_eq!(
INDEX_CERTIFICATE_IDENTITY,
"https://github.com/water-rs/stow/.github/workflows/index-publish.yml@refs/heads/main"
);
}
}