Skip to content

Commit f354d31

Browse files
Add funding.yml, closes #7
1 parent ba25b29 commit f354d31

File tree

3 files changed

+32
-1
lines changed

3 files changed

+32
-1
lines changed

.github/FUNDING.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
github: [fasterthanlime]
2+
patreon: fasterthanlime
3+
ko_fi: fasterthanlime

src/.github/FUNDING.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
github: [fasterthanlime]
2+
patreon: fasterthanlime
3+
ko_fi: fasterthanlime

src/main.rs

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use log::{debug, error, warn, Level, LevelFilter, Log, Metadata, Record};
1+
use log::{Level, LevelFilter, Log, Metadata, Record, debug, error, warn};
22
use owo_colors::{OwoColorize, Style};
33
use std::os::unix::fs::PermissionsExt;
44
use std::sync::mpsc;
@@ -319,6 +319,24 @@ fn enqueue_github_workflow_jobs(sender: std::sync::mpsc::Sender<Job>) {
319319
}
320320
}
321321

322+
static GITHUB_FUNDING_YML: &str = include_str!(".github/FUNDING.yml");
323+
324+
fn enqueue_github_funding_jobs(sender: std::sync::mpsc::Sender<Job>) {
325+
use std::fs;
326+
let funding_path = Path::new(".github/FUNDING.yml");
327+
let old_content = fs::read(funding_path).ok();
328+
let new_content = GITHUB_FUNDING_YML.as_bytes().to_vec();
329+
let job = Job {
330+
path: funding_path.to_path_buf(),
331+
old_content,
332+
new_content,
333+
executable: false,
334+
};
335+
if let Err(e) = sender.send(job) {
336+
error!("Failed to send GitHub funding job: {e}");
337+
}
338+
}
339+
322340
static CARGO_HUSKY_PRECOMMIT_HOOK: &str = include_str!(".cargo-husky/hooks/pre-commit");
323341

324342
fn enqueue_cargo_husky_precommit_hook_jobs(sender: std::sync::mpsc::Sender<Job>) {
@@ -475,6 +493,13 @@ fn main() {
475493
}
476494
}));
477495

496+
handles.push(std::thread::spawn({
497+
let sender = tx_job.clone();
498+
move || {
499+
enqueue_github_funding_jobs(sender);
500+
}
501+
}));
502+
478503
handles.push(std::thread::spawn({
479504
let sender = tx_job.clone();
480505
move || {

0 commit comments

Comments
 (0)