Saving state
2025-12-14 17:46:18 +01:00 by Mark Smith
Very important thing state. And saving state, well that’s doubly important. I thought the auto-poster was up and running, and I wasn’t wrong. But it turns our the final job in the workflow that saves the state of the feed reader, wasn’t running and the result of that was that unknown to me, everyday all posts since I started running it, were getting posted again. Thankfully I noticed it this morning.
After a deep dive into figuring out what was going on, it seems like the if statement I was using for that job was causing an issue. According to Gemini the logic wasn’t flawed, but it was quite complex and apparently Github Actions can sometimes run into issues with complex ifs. hat I was trying to do was only save the sate if any of the post jobs succeeded. But that was trying to be too clever.
I’ve refactored and have come up with a simpler way. Instead of trying to figure out if any posts succeeded, now when I find new posts, I just always save the state no matter what, but then I have a extra job at the end that throws an error if any of the post jobs failed. Hopefully I will thus always avoid double posting, but also there will be an errored job if something goes wrong, which hopefully I will notice.
All this to say that it really should be operational now. If you see this post on my socials tomorrow on it’s own you know the change worked, and if it’s accompanied by a load of old posts, then I am probably pulling my hair out and staring at VSCode. #