Automating a weekly devlog sounds like a writing problem, but a useful publishing workflow has to connect a few separate pieces: a schedule, a Markdown document, credentials, and the publishing API. This week’s commits put that small workflow in place and then made an important cleanup to how local configuration is treated.
What changed
The initial commit added two workflow components. The Python publisher reads drafts/weekly-post.md as Markdown with front matter, takes its title, publication status, tags, and body, and sends an article request to the DEV Community API. It obtains the API key from the DEVTO_API_KEY environment variable rather than embedding that value in the request code. The script also limits the tags it sends to four and prints the URL and ID returned by the API after a successful response.
Alongside the publisher, the repository gained an automation descriptor with a cron schedule of 0 9 * * 1 and the local time zone. Its instruction is to draft or polish the weekly Markdown post and run the publishing script. Keeping the schedule and action in one place makes the intended cadence visible: prepare the article, then hand it to the publisher.
The follow-up commit changed the configuration boundary. It removed .env.txt from the current project files and added .env to .gitignore. That is a small diff, but it reinforces a useful rule: local credentials belong in local configuration, not in files intended to travel with the project. An ignore rule helps keep a local .env out of future commits; it does not erase a file from earlier Git history, so a real credential should never be committed in the first place.
Why keep the publisher simple?
The publisher has a narrow responsibility. It reads a prepared Markdown file, maps its front matter into the fields expected by the API, makes one HTTP request, and raises an error if that request fails. It does not derive an article from Git history or generate its own prose. That separation is valuable: content generation and review can happen before the publishing step, while the script stays focused on sending the document and reporting the result.
It also makes the boundary between configuration and content easier to reason about. The post supplies editorial metadata and body text; the environment supplies the API credential. The automation descriptor supplies the schedule and instruction. Keeping those roles distinct avoids mixing secrets into article content or making the publishing code responsible for scheduling.
There is an operational detail worth remembering: the script reads DEVTO_API_KEY directly from the process environment. Although .env is ignored, the publisher does not load it itself. A scheduled run therefore needs its environment configured before Python starts. A missing variable will fail immediately rather than silently publishing without authentication, which is preferable to a misleading success.
Lessons and next steps
The main lesson is that a minimal publishing integration still needs a careful credential lifecycle. Add an ignore rule before creating local secrets, and verify the repository history if a sensitive value may already have been committed. The other practical lesson is to make the publishing contract explicit: front matter carries the title, published flag, and a short list of tags, while the Markdown body carries the article.
The next useful improvements would be to document how the scheduled environment receives DEVTO_API_KEY, and to add a safe validation or preview step before publication. Those are follow-up ideas, not behavior added by these commits. For now, the code establishes a small, understandable route from a reviewed Markdown draft to the DEV Community API, with local configuration excluded from the working project files.
Top comments (0)