Automation - James Montemagno https://montemagno.com/tag/automation/ https://montemagno.com/content/images/2017/08/MonogramIcon_Orange_NoBuffer.png Automation - James Montemagno https://montemagno.com/tag/automation/ Hugo -- gohugo.io Wed, 02 Dec 2026 09:32:01 GMT 60 How I automated my podcast workflow with GitHub Copilot, VS Code, and Blazor https://montemagno.com/how-i-automated-my-podcast-workflow-with-github-copilot-vs-code-and-blazor/ https://montemagno.com/how-i-automated-my-podcast-workflow-with-github-copilot-vs-code-and-blazor/ Sun, 22 Nov 2026 19:00:00 GMT

Every week, Frank and I record Merge Conflict, and Zencastr hands me a ZIP with a transcript, an MP3, and a video. That part is great! What comes next is about an hour of busywork, by hand, every week: renaming files, making a thumbnail and captions, and uploading everything to YouTube, Patreon, and our podcast host...

So I sat down with GitHub Copilot in VS Code (specifically the Agents window) and built a little dashboard to do it for me. Now I drop in the ZIP, review what it came up with, and click one button. That's about five minutes of my time.

A diagram titled Now: about 5 minutes of my time, with four steps: drop in the ZIP, review and tweak, click Approve, and finish the last bits. Below them, a note says the app handles the numbering, captions, text, uploads, and scheduling.

One thing up front: it isn't all automated (yet). There are still a few steps I do myself, and I'll show you which ones. Want to see it in action first? Here's the full demo:

Now let's take a look at how it all works!

The hour I wanted back

Here's what publishing an episode used to look like:

A diagram titled Before: about an hour, every week, with seven manual steps: get text from OutroKit, rename the MP3, upload to Patreon, make a thumbnail, make captions, upload to YouTube, and upload to Fireside. An eighth dashed box says next week, do it all again.

None of it is hard. It's just a lot of steps, every single week. So I typed that list into Copilot, attached that week's ZIP and our thumbnail overlay, and ended with one question:

What could we build to automate this all for me?

That was at 8:01 AM. I stepped away, and when I came back around 8:24 AM, the app had already imported that real ZIP! Then I took a 12-hour break to enjoy the day, came back, and approved everything within minutes. All told, it took about an hour of hands-on time to go from idea to production, and now I have a repeatable process I can use every week.

What we built

It's a local dashboard that runs on any OS, built with Blazor on .NET 10. Why Blazor? I love .NET, OutroKit is all .NET, and it gives me the most flexibility in my workflow.

You start by dropping in the ZIP:

The Episodes page of the dashboard, with a large area to drop a ZIP file and a list of three sample episodes showing their status and size on disk.
The episode list. All of the app screenshots in this post use sample data.

The app then does the prep work. It suggests the next number from the feed and any Fireside drafts, makes the numbered MP3, converts the captions, gets the text from OutroKit, and sets the release to next Monday.

The review page for a sample episode 603, showing the suggested episode number and where it came from, the release date of Monday at 12:00 AM Pacific, and a list of title options to choose from.
Everything is ready for me to review and change.

Nothing goes public while it does that. I still read it all, pick a title, and make the thumbnail. The transcript does go to Copilot, because that's how OutroKit writes the text.

One click, and what it promises

Here's how it all fits together:

A flow diagram. A Zencastr ZIP is prepared and then reviewed. Approving freezes the final text, media hashes, release time, and destinations. Patreon goes to paid members right away. YouTube and Fireside are each staged privately, and once both are ready they are scheduled and read back. Underneath, a local Blazor app with a background job queue saves each step's progress in SQLite.
The whole flow, from ZIP to release.

This is the heart of the app. One button is going to send something out to three different places, so that button had better mean something. The approve button stays disabled until the episode is actually ready:

A panel titled Before you can approve, listing five remaining tasks such as choosing a title and creating the thumbnail, next to a disabled Approve and publish button.
The app tells me exactly what's left.

When I do click it, the app freezes a snapshot of the final text, the media file hashes, the release time, and the destinations. Then, every time a publishing run starts or restarts, it builds that snapshot again and compares:

var current = await approvals.BuildSnapshotAsync(episode, settings, cancellationToken);
if (ApprovalService.Hash(current) != episode.Approval.SnapshotHash)
{
    await store.UpdateAsync(id, e =>
    {
        e.Approval = null;
        e.AddLog("Stopped: the episode changed after approval, so nothing further was sent. Review and approve it again.", isError: true);
    });
    return;
}

So if the text, a media file, or the release time no longer matches what I approved, it stops and asks me again. A few YouTube settings like tags, category, and the playlist sit outside the snapshot, so changing those won't cancel anything.

From there, YouTube and Fireside are both staged privately, and neither gets scheduled until both are ready. Long uploads run in a background job, and each step saves its progress, so a restart picks up where it left off. API keys stay in the operating system's secure storage.

The app also doesn't take "success" for an answer. After it schedules a video, it asks YouTube what it actually saved:

await youTube.SchedulePublishAsync(videoId, snapshot.ReleaseAtUtc, settings.YouTubeMadeForKids, cancellationToken);

var video = await youTube.GetVideoAsync(videoId, cancellationToken);
if (video?.Privacy != "private" || video.PublishAt?.ToUniversalTime() != snapshot.ReleaseAtUtc.ToUniversalTime())
{
    throw new UserFacingException("YouTube accepted the schedule but didn't report it back correctly. Check YouTube Studio.");
}

Fireside gets the same treatment. When you're scheduling something that goes out at midnight while you're asleep, you really want that check.

A real episode found two OutroKit bugs

OutroKit is my own open source .NET tool that writes the titles, descriptions, chapters, and subtitles for an episode, using the GitHub Copilot SDK. So hooking it up was the easy part. The app runs a pinned version as a local tool and reads back its JSON:

public async Task<IReadOnlyList<string>> ConvertToSrtAsync(string transcript, string output, CancellationToken cancellationToken)
{
    var outcome = await RunAsync(["srt", "convert", transcript, "--output", output, "--overwrite"], cancellationToken);
    if (outcome.ExitCode != 0 || !outcome.Success)
    {
        throw new UserFacingException($"Caption conversion failed: {outcome.ErrorMessage}");
    }
    return outcome.Result.TryGetProperty("warnings", out var warnings)
        ? warnings.EnumerateArray().Select(warning => warning.GetString() ?? "").ToList()
        : [];
}

public async Task<CaptionReport> FixCaptionsAsync(string input, string output, CancellationToken cancellationToken)
{
    var outcome = await RunAsync(["captions", "fix", input, "--output", output, "--overwrite"], cancellationToken);
    // Exit 4 means the fixed file was saved and readability findings remain for review.
    if (outcome.ExitCode is not (0 or 4))
    {
        throw new UserFacingException($"Caption check failed: {outcome.ErrorMessage}");
    }
    return ParseCaptionReport(outcome);
}

Then a real transcript showed up and found two bugs. When Frank and I talk over each other, Zencastr's timestamps land slightly out of order, and that pushed the captions about 3 minutes late by the end of the episode. OutroKit also dropped a line that just said "Like this," because it looked like a speaker's name.

The app worked around both for episode 540, correcting 24 out-of-order turns and saving that one line. I then fixed both in OutroKit itself, which is exactly why you run your tools on real data!

The YouTube captions card for a sample episode, showing the caption count, safe fixes, and readability warnings grouped by type, with a checkbox to confirm they've been reviewed.
The captions card, with made-up numbers. The real episode came in at 1,016 captions with 276 safe fixes and 411 readability warnings left for me to review.

This is also why the review step matters. OutroKit gave me 10 title options that week, and one of them said ".NET Conf 2024." Close!

Now for the thumbnails. Here's what I told Copilot: "For the image generation, I never want people and have a specific look." The app uses image generation on Microsoft Foundry to make only the background. It then adds our real overlay and episode badge on top, right on my machine, so the branding is always exactly right.

The Merge Conflict episode 540 thumbnail: a glowing orb between two phones and floating app icons in a watercolor pixel style, with the show's logo in the corners and a red EP. 540 badge.
The real episode 540 thumbnail, rendered through the app. The art is AI, and the logo and badge are not.

Every prompt asks for no people, text, or logos. Image models don't always listen, though, so I still check each one.

I also wanted more variety: "We should also include the episode title and description so it is unique." So there are five built-in styles, and each prompt gets that episode's details.

The YouTube thumbnail card, with a style dropdown set to Watercolor pixel, a text box describing the look, and buttons to generate or upload a background.
Pick a style, tweak the wording, and generate. I only pay when I click.

The wins, and what's still on me

So what does all of this get me? Here's everything I don't do by hand anymore:

  • The episode number: the app finds the next one from the feed and Fireside, names the MP3 to match, and stops me if a number is already taken.
  • The writing: titles, descriptions, and chapters are waiting for me when I open the episode.
  • The captions: they get converted, cleaned up, and checked for readability.
  • The thumbnail: fresh art in the style I pick, with the real logo and badge added for me.
  • YouTube: the video, details, thumbnail, captions, and playlist are all handled, scheduled for Monday at 12:00 AM Pacific, and checked.
  • Fireside: the draft, details, audio, and transcript are all handled, scheduled for the same time, and checked.
  • The X post: it's written and ready to go in the composer.
  • Cleanup: after the release, one click frees up the big video and audio files.

And here's what's still on me:

  • Reviewing everything and clicking Approve. That one's on purpose!
  • Publishing the post on Patreon.
  • Adding header image in Fireside.
  • Scheduling the post on X.

Episode 540 went out at midnight, right on time. Not bad for a little dashboard!

Wrapping up

An hour down to about five minutes. I'll take it!

The thing I keep coming back to is how much of this came from using it. The first version came together fast, but the best parts showed up when a real episode hit something weird and I could just say so. If you have a chore you do every single week, give it to GitHub Copilot as a real task and see what you build together. Keep a human in the loop for the part that goes out to the world, and make your app check its own work.

Want to see the result? Check out episode 540 of Merge Conflict, and take a look at OutroKit if you make a podcast too. Happy publishing!

]]>
Randomizing Lists in Power Automate Flow https://montemagno.com/randomizing-lists-in-power-automate-flow/ 5f7b5ca27db8330039562737 Mon, 05 Oct 2020 20:20:01 GMT

Every Monday at 9:15 my team and I gather for our weekly team meeting to talk about our achievements from the previous week and what are plans are for the current week.  Traditionally during status updates people just go around the room, but in a virtual standup it is easy just to go down the list alphabetically. I don't feel like this is very fair to members in the meeting. When I became a new manager and setup the weekly meeting I knew I wanted to do something a bit different. That is why each week I have randomized the speaking order. At first it was by reverse name, city, state, length at Microsoft, but then I ran out of ideas and ran to random.org's list randomizer.

A list of names randomized by random.org

This was fine, but I had to remember every Monday morning to enter this list, copy and paste it, and hope it is random enough. I knew there must be a better way.... and Power Automate (Flow) has been my go to recently for automating all of the tedious stuff I don't want to do. I have it send reminder emails, put stuff on Planner, and even approve upcoming Xamarin Shows!

Randomizer Flow

The flow that I decided to create is triggered every Monday at 9AM. It will randomize the list and then post it to our Teams channel. So, to get started we will a scheduled flow that repeats at 9AM:

A new flow that is set to repeat weekly at 9AM

Initialize Variables

I love that Flow has variables that you can use over and over and update. We need to create two string variables. The first will be our final ordered team list named Ordered Team:

A string variable named Ordered Team

The next will be a named Team which will be a JSON array (with an Id and a Name) blob that we will use later to randomize the list. I have Flow randomly generate a random Id by using the guid() function and then specify the name:

Another string variable with a json list of names

[
  { "Id": "@{guid()}", "Name": "Abdullah Hamed" },
  { "Id": "@{guid()}", "Name": "James Montemagno" },
  { "Id": "@{guid()}", "Name": "Jayme Singleton" },
  { "Id": "@{guid()}", "Name": "Jeff Fritz" },
  { "Id": "@{guid()}", "Name": "Jon Galloway" },
  { "Id": "@{guid()}", "Name": "Nish Anil" },
]

Now, you may be wondering... why are we using a JSON blob and why not an array that we can magically sort. Well... from all of my searching there is no built in Sort or Shuffle inside of Power Automate. If there was or when there is this will make it easier. For now however, we will turn to a custom Azure Function to randomize our list!

Azure Functions to the Rescue

Now, I know that it sounds a bit silly to use a function for this, but why not! The nice thing is once it is published I will never have to update it again as I can update the flow if I have new members join the team. I can also automate sending the message to teams via flow and also adjust the schedule. It is a nice combo!

This is probably the easiest Azure Function in the world as it is just a HTTP function that takes in a JSON body that we specified and order's the Ids (which are always random GUIDs).

public class Item
{
    public Guid Id { get; set; }
    public string Name { get; set; }
}
public static class Function1
{
    [FunctionName("SortListFunction")]
    public static async Task<HttpResponseMessage> Run(
        [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req,
        ILogger log)
    {
        string requestBody = await new StreamReader(req.Body).ReadToEndAsync();
        var data = JsonConvert.DeserializeObject<Item[]>(requestBody);
        data = data.OrderBy(i => i.Id).ToArray();
        var json = JsonConvert.SerializeObject(data);
        return new HttpResponseMessage(HttpStatusCode.OK)
        {
            Content = new StringContent(json, Encoding.UTF8, "application/json")
        };
    }
}

5 lines of code! DONE!

Calling the Function & Parsing Data

Now it is time to head back over to our Flow and make an HTTP POST to our function and pass it the Team data as the Body. If you desire to use my function I will let you :)

An HTTP POST calling the Azure Function and passing in the Team as the Body

When the Flow calls this function it will get return data, which is the new JSON list of randomized team members! Under the Data Operations you will find a parse JSON action. Here we will pass in the Body from the HTTP action and then the schema.

Parsing JSON Data from the HTTP Post

You can have it generate it from sample data or use mine:

{
    "type": "array",
    "items": {
        "type": "object",
        "properties": {
            "Id": {
                "type": "string"
            },
            "Name": {
                "type": "string"
            }
        },
        "required": [
            "Id",
            "Name"
        ]
    }
}

Post to Teams

For me I want to post the list to my Teams channel every Monday, so we need to create a tiny bit of HTML to post. We can do this by Appending to string variable each name in the list followed by a <br> tag on the Ordered Team variable we created earlier. This is a loop operation so the easiest thing to do is to add an action for Appending to string variable and select the Body from the Parse JSON action. This will automatically put it inside of an Apply to each loop where we can append Name and <br> to the string:

Apply each name and break tag to the ordered team

Finally, we can post to the team channel:

Post the ordered list to the teams channel

There you have it! Combining Power Automate Flow and Azure Functions together to simplify sorting and organizing lists. I love this type of automation to really streamline the small tedious things throughout the work day. I hope you enjoyed! <3

]]>