Urgent.News

What's breaking now, across thousands of outlets.

Tech

Automating Bluesky JSON Payload Generation for Content‑Automation

Automating Bluesky JSON Payload Generation for Content‑Automation TL;DR: I fixed the bug that prevented the automatic creation of the Bluesky JSON payload and wired it into our daily content‑automation pipeline. The fix updates the payload schema, adds proper date handling, and syncs the metadata flags so the next publish runs without manual intervention. The Problem Our content‑automation repo…

Automating Bluesky JSON Payload Generation for Content-Automation

TL;DR: The author fixed the bug causing Bluesky JSON payload generation to fail, integrating the fix into the daily content-automation pipeline. The update ensures the payload schema is correct, includes proper date handling, and syncs metadata flags for seamless publishing to Bluesky without manual intervention.

Problem: The content-automation repository was publishing articles to Medium, Substack, and Bluesky daily. While Medium and Substack pipelines worked fine, the Bluesky step consistently failed with an error in CI logs: "JSON validation failed – property date is required." The bluesky_es.json file was either missing or incomplete, leaving the bluesky_published flag untouched in metadata.json. This meant the article never appeared on Bluesky.

Attempts: Initially, I attempted a quick-fix by manually setting the date field in the generated JSON file after the script ran. This resolved the validation error temporarily but led to a brittle workaround that failed when schema changes occurred. The original generateBlueskyPayload() function assumed the presence of a summary field, which was optional in markdown front-matter. When summary was missing, it returned undefined for the text property, causing validation errors due to undefined values.

Implementation:

1. Refactored the payload builder: I modified generateBlueskyPayload() to use mdMeta.excerpt as a fallback for the text property and provided a default string when neither summary nor excerpt were available. This ensured text was always defined, eliminating undefined values that caused validation failures.

2. Updated the JSON schema validator: The validator was expanded to require type, text, date, and language fields. This ensured the JSON payload adhered to the expected structure, allowing the script to fail fast and provide clear error messages if any required field was missing.

3. Integrated the generator into the daily run: I added a new step in the GitHub Actions workflow that runs the Bluesky generator after Medium and Substack publishing steps. The step generates the payload JSON, commits it to the repository, and updates metadata.json to indicate that Bluesky generation has occurred.

4. Synced metadata flags: I added a bluesky_generated boolean to metadata.json, which is set to true after the JSON file is written. This ensured that the bluesky_published flag in metadata.json accurately reflected the status of Bluesky posts.

5. Verified the changes: I committed the relevant diffs, confirming that the fixes addressed the root cause of the Bluesky JSON generation issue and integrated smoothly into the existing daily content-automation pipeline.

The implementation resolved the Bluesky JSON generation bug, ensuring that articles now publish correctly to Bluesky without requiring manual intervention.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Design notes for a touch UI that controls a motor next to TIG high-frequency start

I built a welding positioner (a motorized rotator for pipe and round work) and wrote its controller: an ESP32-P4 touchscreen board, LVGL 9.6, a NEMA 23 stepper and a PUL/DIR driver.

  • ESP32-P4 touchscreen board controls motorized rotor in welding positioner controller
  • High-frequency TIG welder noise interferes with touch input, mitigated by firmware design
  • Touch read errors due to HF noise handled with 150 ms active press duration

More from Sunday 15 November →