Skip to content

Commit b01eacd

Browse files
committed
feat: Update to Action code
1 parent 039fce7 commit b01eacd

File tree

4 files changed

+41
-13
lines changed

4 files changed

+41
-13
lines changed

Cargo.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ dotenvy = "0.15"
2323
ghactions = { version = "^0.14.1", features = ["dotenvy", "log", "generate", "octocrab", "toolcache"] }
2424
ghastoolkit = "0.5"
2525
# GitHub API
26-
octocrab = "0.43"
26+
octocrab = "^0.43"
2727
openssl = { version = "0.10", features = ["vendored"] }

action.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,17 @@ branding:
99
inputs:
1010
token:
1111
description: GitHub Token
12-
extractor_repository:
12+
extractor:
1313
description: GitHub Repository where the extractor is located
14-
outputs: {}
14+
required: true
15+
attestation:
16+
description: Attestation
17+
default: 'false'
18+
outputs:
19+
version:
20+
description: Version of the extractor to use
21+
extractor_path:
22+
description: Path to the extractor
1523
runs:
1624
using: docker
1725
image: ./action.Dockerfile

src/action.rs

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![allow(dead_code)]
12
use anyhow::Result;
23
use ghactions::prelude::*;
34
use ghastoolkit::Repository;
@@ -24,23 +25,42 @@ pub struct Action {
2425
token: String,
2526

2627
/// GitHub Repository where the extractor is located
27-
#[input(description = "GitHub Repository where the extractor is located")]
28-
extractor_repository: String,
28+
#[input(
29+
description = "GitHub Repository where the extractor is located",
30+
required = true
31+
)]
32+
extractor: String,
33+
34+
/// Attestation
35+
#[input(description = "Attestation", default = "false")]
36+
attestation: bool,
37+
38+
39+
/// Version of the extractor to use
40+
#[output(description = "Version of the extractor to use")]
41+
version: String,
42+
/// Path to the extractor
43+
#[output(description = "Path to the extractor")]
44+
extractor_path: String,
2945
}
3046

3147
impl Action {
3248
/// Gets the repository to use for the extractor. If the repository is not provided,
3349
/// it will use the repository that the action is running in.
3450
pub fn extractor_repository(&self) -> Result<Repository> {
35-
let repo = if self.extractor_repository.is_empty() {
51+
let repo = if self.extractor.is_empty() {
3652
log::debug!("No extractor repository provided, using the current repository");
3753
self.get_repository()?
3854
} else {
3955
log::debug!("Using the provided extractor repository");
40-
self.extractor_repository.clone()
56+
self.extractor.clone()
4157
};
4258
log::info!("Extractor Repository :: {}", repo);
4359

4460
Ok(Repository::parse(&repo)?)
4561
}
62+
63+
pub fn attestation(&self) -> bool {
64+
self.attestation
65+
}
4666
}

0 commit comments

Comments
 (0)