Skip to content

feat: implement Obsidian publishing pipeline (export/sync/validate) and CI integration#5

Open
JayChou404 wants to merge 1 commit intomasterfrom
codex/create-publishing-pipeline-documentation
Open

feat: implement Obsidian publishing pipeline (export/sync/validate) and CI integration#5
JayChou404 wants to merge 1 commit intomasterfrom
codex/create-publishing-pipeline-documentation

Conversation

@JayChou404
Copy link
Owner

Motivation

  • Separate the Obsidian vault from Jekyll input to avoid accidental publishing of drafts and private notes.
  • Automate Obsidian→Chirpy export, link/asset conversion and front-matter normalization to make selective publishing one-step from the vault.
  • Add safety guards for a public repo by scanning for sensitive patterns and by only managing files that were generated by the tool.

Description

  • Add tools/publishing/publish.py implementing three subcommands: export (scan vault/20-Posts, require publish: true, convert wikilinks and embeds, copy assets, write site-content/.index.json), sync (sync site-content_posts and assets/img/posts while only deleting files/assets marked as generated), and validate (front matter checks, slug/post conflicts, unresolved links, missing embeds, sensitive-pattern scanning).
  • Add thin shell wrappers tools/publishing/{export.sh,sync-to-jekyll.sh,validate.sh} to standardize local/CI invocation and use a generated marker (generated_by front matter and an asset marker file) to avoid modifying manual content.
  • Integrate the pipeline into GitHub Actions by inserting validate -> export -> sync before bundle exec jekyll b, and update _config.yml and .gitignore to exclude vault and site-content from Jekyll and to ignore Obsidian metadata.
  • Add docs/publishing-pipeline.md explaining the recommended directory layout, publishing filter rules, export/sync paths, resource strategy, link rewriting approach and rollback guidance.

Testing

  • Ran python3 tools/publishing/publish.py --help which printed the CLI help successfully.
  • Ran python3 -m py_compile tools/publishing/publish.py which completed with no syntax errors.
  • Ran python3 tools/publishing/publish.py validate which returned "Validation passed for 0 post(s)" because there were no publishable notes in this environment.
  • Ran the pipeline end-to-end locally (validate, export, sync) which completed successfully and produced site-content (exported 0 posts in this repo context), confirming the commands execute in the repository environment.

Codex Task

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Feb 13, 2026

Deploying ajiew with  Cloudflare Pages  Cloudflare Pages

Latest commit: c59a74b
Status:🚫  Build failed.

View logs

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c59a74b113

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +332 to +334
for post_file in sorted(posts_dir.glob("*.md")):
if is_generated_post(post_file) and post_file.name not in managed_posts:
post_file.unlink()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Prevent deleting all generated posts on empty export

This deletion loop removes every generated _posts/*.md whenever managed_posts is empty, which occurs if export runs with no publishable vault notes (including CI runs where vault/20-Posts is absent). In that case the workflow still proceeds and deploys a site with all previously generated posts removed, even though repository _posts content may have been valid before running the pipeline.

Useful? React with 👍 / 👎.

if not dst.exists() or src.read_text(encoding="utf-8") != dst.read_text(encoding="utf-8"):
shutil.copy2(src, dst)

managed_asset_slugs = {Path(data["assets_dir"]).name for data in index.values()}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Delete stale asset dirs when a post drops embeds

managed_asset_slugs is built from .index.json entries for all posts, not from actual exported asset directories. If a post previously had embeds but now has none, its slug remains in the index so cleanup skips removing assets/img/posts/<slug>, and old files stay publicly served indefinitely.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant