11. Cancelling and Skipping Jobs
Cancelling Jobs
Jobs จะยกเลิกก็ต่อเมื่อ
- มีบาง step ที่ทำงานไม่สำเร็จ (failed)
- จะถือว่าทั้่ง Job failed เลยถ้าเกิดว่ามีแค่ 1 step ที่ failed
- ยกเลิกเองด้วยมือ
Skipping Jobs
โดยปกติถ้าไม่เข้าเงื่อนไขที่เขียนไว้ใน Workflow มันก็ไม่ทำงานอยู่แล้ว
แต่ถ้าเราอยากให้มันข้ามก็สามารถกำหนดได้ด้วยการใส่คำบางคำในท้ายสุดของ commit message
คำว่าอะไรบ้างที่ทำให้ Workflow ข้ามการทำงาน

ตัวอย่างสถานการณ์ที่เรามักจะใช้ Skip ci
ตัวอย่างสถานการณ์ที่เราควรใช้ skip-ci
ใน GitHub Actions:
- การอัปเดต Document เช่น ไฟล์ Markdown
git commit -m "docs: update README.md [skip ci]"git commit -m "docs: fix typo in documentation [ci skip]"
- การแก้ไขไฟล์ที่ไม่เกี่ยวกับโค้ด
เช่นแก้ไข package.json
ที่ไม่เกี่ยวกับ dependencies
git commit -m "chore: update .gitignore [skip ci]"git commit -m "style: fix code formatting [skip ci]"git commit -m "chore: update package.json metadata [ci skip]"
- การอัปเดต CI/CD Configuration
git commit -m "ci: update workflow configuration [skip ci]"git commit -m "ci: add new environment variables [ci skip]"
- การทำงานกับ Assets/Media
git commit -m "assets: add new images for documentation [skip ci]"git commit -m "media: update logo files [ci skip]"
- Version Bumps (บางกรณี)
git commit -m "chore: bump version to 1.2.3 [skip ci]"git commit -m "release: prepare v2.0.0 [ci skip]"
- การแก้ไข Commit Messages
git commit -m "fix: correct previous commit message [skip ci]"
- การทดสอบ Workflow
เพื่อที่จะไปสั่งรันด้วยมือ
git commit -m "test: experiment with new feature [skip ci]"