Skip to content

fix(actions): skip duplicate builds and deploy Pages only after changes - #8

Draft
hoangsvit wants to merge 11 commits into
mainfrom
fix/actions-deduplicate-builds-and-publish
Draft

hoangsvit wants to merge 11 commits into
mainfrom
fix/actions-deduplicate-builds-and-publish

Conversation

@hoangsvit

Copy link
Copy Markdown
Member

Hiện trạng

  • CI chạy lặp lại trên PR và push main; Pages staging cũng build trên main.
  • Pages publisher chạy theo workflow_run: completed kể cả khi staging không thay đổi gh-pages.
  • Các sự kiện merge, đóng PR, push main gần nhau tạo nhiều lượt publish; marker commit chưa có.
  • Catalog bootstrap từng lỗi non-fast-forward khi main thay đổi.

Cơ chế mới

  1. CI: PR only; concurrency hủy lượt kiểm thử của commit PR cũ. Main vẫn được build/test bởi Pages staging.
  2. Stage: serialize toàn bộ thao tác ghi gh-pages, queue: max để không rớt việc dọn preview; kiểm tra HEAD mới nhất + marker .eplus-preview-sha / .eplus-production-sha trước khi cài dependency. Check lại HEAD trước lúc push để không phục hồi preview đã đóng / ghi đè production cũ.
  3. Publish: đổi từ workflow_run sang workflow_dispatch. Chỉ dispatch sau khi có thay đổi thực sự trên gh-pages, không dispatch khi staging no-op. Giữ khóa deploy một lúc một job. Có tương thích ngược khi PR chưa merge (default branch vẫn dùng workflow_run).
  4. Catalog mỗi ngày: bỏ lượt fetch thứ hai nếu snapshot đã cập nhật cùng ngày Việt Nam; manual force=true cho phép chạy lại. Trước khi push bot fetch/rebase main, retry tối đa 3 lần, không force push; fail closed nếu conflict. Chỉ dispatch staging sau khi push thành công.
  5. Kiểm thử: scripts/check-actions-dedup.mjs xác nhận các điều kiện an toàn của cả bốn workflows.

Kiểm tra

  • PR CI + Pages staging thành công
  • Pages preview publish theo cơ chế tương thích hiện tại
  • Sau merge: một lần thay đổi gh-pages dẫn đến một lần workflow_dispatch, no-op không publish
  • Kiểm tra catalog schedule và lỗi non-fast-forward khi chạy trên main

Không auto-merge.

@coderabbitai

coderabbitai Bot commented Nov 10, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant