Skip to content

refactor: refactor to composite actions for better shared workflow#36

Merged
G36maid merged 7 commits into
mainfrom
refactor/composite-actions
Feb 14, 2026
Merged

refactor: refactor to composite actions for better shared workflow#36
G36maid merged 7 commits into
mainfrom
refactor/composite-actions

Conversation

@G36maid

@G36maid G36maid commented Feb 1, 2026

Copy link
Copy Markdown
Contributor

目的

本 PR 旨在解決 Shared Workflows 被外部專案引用時發生的 Script 路徑錯誤(No such file or directory),同時修正 CI Checkout 行為以確保測試的是 Merge Commit 而非 Branch Tip。此外,也藉此機會重構了架構,使其更模組化且符合最佳實踐。

方法/實作說明

  • 主要修改

    • 架構重構:將 basic, config, frontend, python 等檢查邏輯封裝為 Composite Actions(位於 .github/actions/),利用 ${{ github.action_path }} 解決路徑依賴問題。
    • Frontend Checks:將設定檔(Templates)與邏輯(Scripts)分離,提升可維護性。
  • 關鍵實作

    • Checkout 行為修正:移除所有 actions/checkout 中的 ref: ${{ github.head_ref }},改用預設行為(測試 Merge Commit),以更精準地抓出合併衝突與整合問題。
    • Dogfooding:在 .github/workflows/main.yml 中啟用 run-config-checks,確保本專案自身的設定檔與 Workflow 定義符合規範。
    • Template Injection:Frontend action 現在會動態檢查目標專案是否有設定檔,若無則從 Action 內部的 templates/ 複製預設設定。

關聯 Issue

Closes #34

附註

本次重構涉及檔案移動較大,建議使用 File changes 中的 Hide whitespace 功能進行 Review。

  • TODO:
    • 驗證所有 Composite Actions 在本 Repo (Dogfooding) 執行成功
    • 更新 README 與所有文件及架構說明
    • 移除舊的 .github/scripts 遺留檔案
    • 全部檔案皆通過 yamllint 格式檢查
    • 使用 act 進行本地測試通過
    • 其他 repo 沒有出現問題

@G36maid G36maid changed the title fefactor: Refactor to composite actions for better shared workflow refactor: Refactor to composite actions for better shared workflow Feb 1, 2026
@G36maid G36maid changed the title refactor: Refactor to composite actions for better shared workflow refactor: refactor to composite actions for better shared workflow Feb 1, 2026
@G36maid G36maid force-pushed the refactor/composite-actions branch 4 times, most recently from ce539fd to ed18098 Compare February 1, 2026 21:43
Move basic checks to local actions and update scripts to use POSIX-compliant regex for bett
     portability.
Migrate JSON,
     TOML, and YAML validation logic to dedicated composite actions.
Refactor frontend checks to separate logic from config using templates and local actions.
Modularize Go and Python workflows into reusable composite actions.
@G36maid G36maid force-pushed the refactor/composite-actions branch from bbb0d0b to 9a60f5b Compare February 1, 2026 23:05
Update `entrypoint.yml` to correctly find and delete all previous bot
comments before posting a new one. Also, enable configuration file
checks by default in `main.yml`.
This commit removes several shell scripts that were previously used for
various checks within the GitHub Actions workflows. These scripts are no
longer needed as their functionality has either been replaced or
integrated elsewhere.

@torrid-fish torrid-fish left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, but do we need AGENT.md here? I suggest to remove it.
done

- Refactor HOW_TO_ADD_WORKFLOWS.md: clearer step-by-step workflow architecture
- Rewrite README.md in Traditional Chinese with architecture diagrams
- Document output contracts and naming conventions
- Add local testing instructions with act and yamllint
@G36maid G36maid force-pushed the refactor/composite-actions branch from 3584984 to b41a9a0 Compare February 14, 2026 10:50
@G36maid G36maid added this pull request to the merge queue Feb 14, 2026
Merged via the queue into main with commit 4fae501 Feb 14, 2026
6 checks passed
@G36maid G36maid deleted the refactor/composite-actions branch February 14, 2026 11:02
@github-actions

Copy link
Copy Markdown

🛡️ PR Quality Check Summary

PR Title: Passed (Length: 66/75, Format: OK). refactor: refactor to composite actions for better shared workflow
Branch Name: Follows naming convention (refactor/composite-actions)
Commit Messages: All 0 commit(s) passed (Length, Format, Case)
Conflicts: No merge conflict markers found
YAML Files: All 12 file(s) passed validation
JSON Files: All 1 file(s) are valid
TOML Files: No TOML files found to check


🎉 All checks passed!

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.

fix checkout behavior to use merge commit & enable self-repository config checks

2 participants