<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://johnwick.cc/index.php?action=history&amp;feed=atom&amp;title=Automating_GitHub_Weekly_Labels%3A_My_New_Rust_Tool</id>
	<title>Automating GitHub Weekly Labels: My New Rust Tool - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://johnwick.cc/index.php?action=history&amp;feed=atom&amp;title=Automating_GitHub_Weekly_Labels%3A_My_New_Rust_Tool"/>
	<link rel="alternate" type="text/html" href="https://johnwick.cc/index.php?title=Automating_GitHub_Weekly_Labels:_My_New_Rust_Tool&amp;action=history"/>
	<updated>2026-05-07T03:34:27Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.1</generator>
	<entry>
		<id>https://johnwick.cc/index.php?title=Automating_GitHub_Weekly_Labels:_My_New_Rust_Tool&amp;diff=1110&amp;oldid=prev</id>
		<title>PC: Created page with &quot;If you’ve ever spent time managing GitHub repositories, you know that labels can make or break your workflow. They help organize issues, track progress, and make project dashboards readable at a glance. But let’s be honest: manually creating labels for every repository in an organization — especially weekly labels — can quickly become tedious. That’s why I decided to automate the process.  500px  Enter my latest side...&quot;</title>
		<link rel="alternate" type="text/html" href="https://johnwick.cc/index.php?title=Automating_GitHub_Weekly_Labels:_My_New_Rust_Tool&amp;diff=1110&amp;oldid=prev"/>
		<updated>2025-11-23T17:38:17Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;If you’ve ever spent time managing GitHub repositories, you know that labels can make or break your workflow. They help organize issues, track progress, and make project dashboards readable at a glance. But let’s be honest: manually creating labels for every repository in an organization — especially weekly labels — can quickly become tedious. That’s why I decided to automate the process.  &lt;a href=&quot;/index.php?title=File:Automating_GitHub_Weekly_Labels.jpg&quot; title=&quot;File:Automating GitHub Weekly Labels.jpg&quot;&gt;500px&lt;/a&gt;  Enter my latest side...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;If you’ve ever spent time managing GitHub repositories, you know that labels can make or break your workflow. They help organize issues, track progress, and make project dashboards readable at a glance. But let’s be honest: manually creating labels for every repository in an organization — especially weekly labels — can quickly become tedious. That’s why I decided to automate the process.&lt;br /&gt;
&lt;br /&gt;
[[file:Automating_GitHub_Weekly_Labels.jpg|500px]]&lt;br /&gt;
&lt;br /&gt;
Enter my latest side project: a Rust CLI tool that generates weekly labels and applies them to all repositories in a GitHub organization, complete with a color gradient that visualizes the progression from week 1 to week 52.&lt;br /&gt;
Check out my GitHub repo: https://github.com/ReneKrewinkel/gen-weeks&lt;br /&gt;
&lt;br /&gt;
Why I Built This&lt;br /&gt;
&lt;br /&gt;
I love the command line. I love automating repetitive tasks. And I love seeing things happen programmatically instead of clicking around in a web interface. Managing labels manually ticked all the boxes for “tedious, error-prone, and time-consuming.”&lt;br /&gt;
Instead of adding week-2025-47, week-2025-48, … by hand across all repos, I wanted a tool that:&lt;br /&gt;
* 		Creates weekly labels automatically.&lt;br /&gt;
* 		Assigns consistent colors so you can glance at a week and immediately know where it fits in the year.&lt;br /&gt;
* 		Forces labels to exist: if a label already exists, it updates it with the new color/description.&lt;br /&gt;
* 		Works across all existing repositories without extra manual effort.&lt;br /&gt;
* 		Integrates directly with GitHub Projects, allowing me to use views to filter issues by week.&lt;br /&gt;
Rust was a natural choice because I like typed safety, fast compilation, and powerful HTTP libraries. Using reqwest for GitHub API calls and chrono for week calculations made the tool clean, minimal, and robust.&lt;br /&gt;
How It Works&lt;br /&gt;
&lt;br /&gt;
The tool does a few simple things:&lt;br /&gt;
* 		Reads a configuration JSON with your GitHub token and organization name.&lt;br /&gt;
* 		Calculates the ISO week numbers for the next N weeks (default 26, or half a year).&lt;br /&gt;
* 		Generates a color for each week along a gradient from light yellow to dark purple.&lt;br /&gt;
* 		Projects integration: Using GitHub Projects views, I can filter issues by week label to track progress in a visual, organized way.&lt;br /&gt;
* 		Loops through all repositories in the organization:&lt;br /&gt;
* 		If a label does not exist, it creates it.&lt;br /&gt;
* 		If a label exists, it updates the color and description to keep everything consistent.&lt;br /&gt;
&lt;br /&gt;
Here’s a snippet showing how the color gradient is calculated:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pub fn week_color(week: u32) -&amp;gt; String {&lt;br /&gt;
    let week = week.clamp(1, 52);&lt;br /&gt;
    let start_hue = 200.0;   // light blue&lt;br /&gt;
    let end_hue = 270.0;    // purple&lt;br /&gt;
    let hue = start_hue + (end_hue - start_hue) * ((week - 1) as f32 / 51.0);&lt;br /&gt;
    let s = 0.65;&lt;br /&gt;
    let l = 0.55;&lt;br /&gt;
    let (r, g, b) = hsl_to_rgb(hue, s, l);&lt;br /&gt;
    format!(&amp;quot;{:02x}{:02x}{:02x}&amp;quot;, (r * 255.0) as u8, (g * 255.0) as u8, (b * 255.0) as u8)&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And this is how the tool forces labels to exist or updates them if they already do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
let resp = client&lt;br /&gt;
    .post(&amp;amp;format!(&amp;quot;https://api.github.com/repos/{}/{}/labels&amp;quot;, org_name, repo_name))&lt;br /&gt;
    .bearer_auth(&amp;amp;github_token)&lt;br /&gt;
    .header(&amp;quot;User-Agent&amp;quot;, &amp;quot;week-labeler&amp;quot;)&lt;br /&gt;
    .json(&amp;amp;body)&lt;br /&gt;
    .send();&lt;br /&gt;
&lt;br /&gt;
match resp {&lt;br /&gt;
    Ok(r) if r.status().is_success() =&amp;gt; println!(&amp;quot;Created label {}&amp;quot;, label_name),&lt;br /&gt;
    Ok(r) if r.status().as_u16() == 422 =&amp;gt; {&lt;br /&gt;
        // Label exists, update it&lt;br /&gt;
        client&lt;br /&gt;
            .patch(&amp;amp;format!(&amp;quot;https://api.github.com/repos/{}/{}/labels/{}&amp;quot;, org_name, repo_name, label_name))&lt;br /&gt;
            .bearer_auth(&amp;amp;github_token)&lt;br /&gt;
            .header(&amp;quot;User-Agent&amp;quot;, &amp;quot;week-labeler&amp;quot;)&lt;br /&gt;
            .json(&amp;amp;body)&lt;br /&gt;
            .send()&lt;br /&gt;
            .unwrap();&lt;br /&gt;
        println!(&amp;quot;Updated existing label {}&amp;quot;, label_name);&lt;br /&gt;
    }&lt;br /&gt;
    Ok(r) =&amp;gt; eprintln!(&amp;quot;Failed to create label {}: {:?}&amp;quot;, label_name, r.text()),&lt;br /&gt;
    Err(e) =&amp;gt; eprintln!(&amp;quot;Request failed for label {}: {:?}&amp;quot;, label_name, e),&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Why I Love This Approach&lt;br /&gt;
* 		Predictable and consistent: All labels for the same week share the same color.&lt;br /&gt;
* 		Re-runnable: Run the tool next week, and it updates existing labels without duplicating them.&lt;br /&gt;
* 		Minimalist design: Just one CLI, one config file, no external dependencies beyond GitHub.&lt;br /&gt;
* 		Scalable: Works for any organization size, regardless of how many repos you have.&lt;br /&gt;
* 		Projects-friendly: Weekly labels integrate directly with GitHub Projects views for easy filtering.&lt;br /&gt;
The Color Gradient&lt;br /&gt;
* 		Week 1 → light blue&lt;br /&gt;
* 		Week 52 → dark purple&lt;br /&gt;
This allows your team to instantly see how issues relate to the week of the year, across all repositories and project boards.&lt;br /&gt;
&lt;br /&gt;
What’s Next&lt;br /&gt;
&lt;br /&gt;
I’m thinking of adding a GitHub Actions workflow so that new repositories automatically inherit the weekly labels when they’re created. Another improvement would be a visual CLI dashboard showing which weeks have labels already applied across the org.&lt;br /&gt;
&lt;br /&gt;
If you spend any significant amount of time managing multiple repos, I can’t recommend automating label creation enough. It’s one of those little quality-of-life improvements that makes you fall in love with the command line all over again, especially when combined with GitHub Projects views.&lt;br /&gt;
&lt;br /&gt;
Contributing&lt;br /&gt;
Feel free to open issues or submit pull requests for new features, such as:&lt;br /&gt;
* 		GitHub Actions integration&lt;br /&gt;
* 		Parallelized label updates&lt;br /&gt;
* 		Custom color gradients&lt;br /&gt;
Repo: https://github.com/ReneKrewinkel/gen-weeks&lt;br /&gt;
&lt;br /&gt;
Read the full article here: https://blog.krewinkel.studio/automating-github-weekly-labels-my-new-rust-tool-98ad71346f37&lt;/div&gt;</summary>
		<author><name>PC</name></author>
	</entry>
</feed>