Skip to content

Commit 29bdf22

Browse files
committed
Support github action inputs
1 parent bdc320a commit 29bdf22

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

projects/publish-rs/src/commands/mod.rs

+16-4
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,24 @@ use crate::{
33
bindings::{Guest, export},
44
};
55

6-
pub struct GithubContext {}
6+
pub struct RunningContext {}
77

8-
impl Guest for GithubContext {
8+
impl Guest for RunningContext {
99
fn run_with_config(config: String) -> Result<(), GithubError> {
10-
todo!()
10+
tokio::runtime::Builder::new_current_thread().enable_all().build()?.block_on(async {
11+
let ctx = RunningContext {};
12+
ctx.run(config).await
13+
})
1114
}
1215
}
1316

14-
export!(GithubContext with_types_in bindings);
17+
impl RunningContext {
18+
async fn run(&self, config: String) -> Result<(), GithubError> {
19+
let args = std::env::args();
20+
println!("Args: {:?}", args);
21+
println!("Config: {}", config);
22+
Ok(())
23+
}
24+
}
25+
26+
export!(RunningContext with_types_in bindings);

projects/publish-rs/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ pub mod bindings;
22
mod commands;
33
mod errors;
44

5-
pub use crate::{bindings::GithubError, commands::GithubContext};
5+
pub use crate::{bindings::GithubError, commands::RunningContext};

projects/publish-wasm32-wasi/action.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ runs:
88
using: node20
99
main: rust-publish.js
1010
env:
11-
GITHUB_TOKEN: As provided by Github Actions
11+
GITHUB_TOKEN: Secret provided by github.com
12+
CRATES_TOKEN: Secret provided by crates.io
1213
inputs:
1314
config:
1415
description: Path of the config file
1516
required: true
16-
default: '{json}'
17+
default: .config/rust-publish.toml
1718
outputs:
1819
DEPLOYMENT_STATUS:
1920
description: 'The status of the deployment that indicates if the run failed or passed. Possible outputs include: success|failed|skipped'

0 commit comments

Comments
 (0)