Automatically Exporting Drupal Content to GitHub with a Custom Script

female-freelance-developer-coding-html-script-with-online-cloud-server-programming-firewall-security-learning-new-user-interface-terminal-window-with-code-language-application
DCStudio / Freepik

In a recent entry from his digital garden, Dries Buytaert outlines a lightweight publishing workflow that automatically exports content from his Drupal site to a GitHub repository. The process runs daily, converting published nodes into Markdown files, committing changes, and pushing updates to github.com/dbuytaert/website-content. The system also tracks deletions and delays export by two days to allow for typo fixes before posts are archived.

The workflow depends on SSH key-based deployment and a custom Drush command housed in a site-specific module. While not yet published, the module provides a drush node:export command that feeds into a shell script. This script clones the GitHub repository, removes existing files to track deletions, exports updated content, and commits only if changes are detected.

Dries provides the full script in the post, including configuration for SSH, Git user setup, and cleanup routines. To schedule the task, he uses Acquia Cloud’s infrastructure-level job scheduler, since his site runs on Kubernetes where traditional crontab access isn’t available.

While the tutorial isn’t turnkey, it offers a reusable pattern for developers seeking to version Drupal content outside the CMS. Dries notes that this entry is more of a personal reference note than a polished guide, but shares it publicly for those who might adapt the idea.

Disclosure: This content is produced with the assistance of AI.

Disclaimer: The opinions expressed in this story do not necessarily represent that of TheDropTimes. We regularly share third-party blog posts that feature Drupal in good faith. TDT recommends Reader's discretion while consuming such content, as the veracity/authenticity of the story depends on the blogger and their motives. 

Note: The vision of this web portal is to help promote news and stories around the Drupal community and promote and celebrate the people and organizations in the community. We strive to create and distribute our content based on these content policy. If you see any omission/variation on this please reach out to us at #thedroptimes channel on Drupal Slack and we will try to address the issue as best we can.

Related Organizations

Related People

Upcoming Events

Latest Opportunities