ci: ตรวจ template ทุกไฟล์ก่อน merge เข้า main - #1
Merged
Conversation
repo นี้แจก template ให้ทีมเอาไปใช้ แต่ที่ผ่านมาไม่มีอะไรกันไม่ให้ template ที่พังหลุดออกไป — ถ้า ci-*.yml เสียหรือ gate job ชื่อ 'ci' หายไป คนที่ก๊อปไปตั้ง branch protection จะเจอ PR ค้างโดยไม่รู้สาเหตุ เพิ่ม scripts/validate.sh ที่ CI และเครื่อง dev เรียกตัวเดียวกัน ตรวจ: - YAML/JSON ใน templates/ parse ได้ - ทุก ci-*.yml มี job ชื่อ 'ci' ที่รอครบทุก job และมี if: always() - scripts/*.sh ผ่าน shellcheck และมี executable bit - ลิงก์ภายในของ markdown ไม่ตาย - ไม่มี token หรืออีเมลจริงหลุดเข้า repo สาธารณะ Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dru5ECsrJrqhTfUhUvDsqw
Owner
Author
|
ปิดเพื่อ reopen ให้ Actions ยิง event ใหม่ (repo เพิ่งสร้าง ยังไม่เคยมี workflow run) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ทำไมต้องเปลี่ยน
repo นี้แจก template ให้ทีมเอาไปใช้กับ repo จริง แต่ตอนนี้ไม่มีอะไรกันไม่ให้ template ที่พังหลุดออกไป
กรณีที่เจ็บที่สุดคือถ้า gate job ชื่อ
ciในtemplates/github/workflows/ci-*.ymlหายไปหรือไม่ได้รอ job ครบคนที่ก๊อปไปตั้ง branch protection จะเจอ PR ค้างที่ "Expected — Waiting for status" โดยไม่รู้สาเหตุ
เปลี่ยนอะไร
scripts/validate.sh— ตัวตรวจที่ CI และเครื่อง dev เรียกตัวเดียวกัน (กันอาการ "บนเครื่องเขียว บน CI แดง").github/workflows/ci.yml— 3 job + gate job ชื่อciตามที่ handbook สอนไว้เองสิ่งที่ตรวจ:
templates/parse ได้ci-*.ymlมี jobciที่รอครบทุก job +if: always()scripts/*.shผ่าน shellcheck + มี executable bitทดสอบยังไง
./scripts/validate.sh # ต้องเขียวทั้งหมดทดสอบด้าน negative แล้วด้วย — ใส่
ci-*.ymlที่ gate job ไม่ได้รอ job อื่น และ JSON ที่พังเข้าไปvalidator จับได้ทั้งคู่และ exit 1 จากนั้นลบไฟล์ทดสอบออก
ผลกระทบ
ไม่กระทบใคร — เป็นการเพิ่ม CI ให้ repo ตัวเอง ยังไม่แตะ template ที่ทีมใช้อยู่
Checklist ก่อนขอรีวิว