TXA. Kho gói phần mềmPackage index

Bot riêng cho kho: GitHub App txa-repoYour own repository bot: the txa-repo GitHub App

Trang này đọc trực tiếp từ thư mục docs của kho nên luôn khớp với bản trên GitHub.This page is read straight from the repository's docs folder, so it always matches what is on GitHub. Sửa trên GitHubEdit on GitHub

Mặc định bot comment bằng github-actions[bot]. Tạo một GitHub App thì comment, nhãn và status hiện dưới tên riêng (txa-repo[bot]) với logo riêng. Không bắt buộc: chưa cài App thì workflow tự dùng token mặc định, mọi thứ vẫn chạy.

1. Tạo App

  1. Mở https://github.com/settings/apps/new (đang đăng nhập bằng tài khoản TXAVL).

  2. Điền:

    • GitHub App name: txa-repo (tên toàn cầu, nếu bị trùng thì dùng txa-repo-bot).
    • Homepage URL: https://github.com/TXAVL/txa-repo
    • Webhook: bỏ chọn Active (App này không cần nhận webhook).
  3. Repository permissions (để mọi thứ khác là No access):

    QuyềnMứcDùng để
    ActionsRead and writechạy lại kiểm tra sau khi chấp nhận agreement
    ChecksRead and write16 check đánh số trong khung merge
    Commit statusesRead and writetxa/verified, txa/agreement
    ContentsRead and writebật tự gộp (auto-merge)
    IssuesRead and writecomment, nhãn, xoá comment @txa-repo agree
    Pull requestsRead and writeđọc PR, tự gộp
    MetadataRead-only(tự có)
  4. Where can this GitHub App be installed? → Only on this account. Bấm Create GitHub App.

  5. Trang App mới mở: ghi lại App ID; kéo xuống Private keys → Generate a private key (tải về file .pem). Ở mục Display information tải logo lên.

2. Cài App vào kho

Trang App → Install App → TXAVL → Only select repositories → chọn txa-repo → Install.

3. Đưa khoá vào secret (không để lộ khoá)

.\scripts\setup-app.ps1 -AppId 1234567 -KeyFile C:\Users\admin\Downloads\txa-repo.2026-10-27.private-key.pem

Script chỉ chạy gh secret set TXA_APP_ID và gh secret set TXA_APP_PRIVATE_KEY (đọc khoá từ file, không in ra màn hình). Xong hãy xoá file .pem khỏi máy.

4. Kiểm tra

Mở một PR mới: comment của bot phải hiện tên txa-repo kèm nhãn bot. Nếu vẫn hiện github-actions, kiểm tra hai secret đã có chưa (gh secret list) và App đã được cài vào txa-repo.

Bonus: vì App gộp PR bằng quyền của nó, lần gộp đó tính như một push thật và tự kích hoạt TXA Publish API.

5. Kho mới, nhớ người đã đồng ý ở kho khác

Kho chạy bot TXA mà bạn dựng (fork) có thể nhớ người đã đồng ý Thỏa thuận Người đóng góp ở kho khác, giống cách winget-pkgs làm với CLA. Trong kho đó, tạo biến repository TXA_AGREEMENT_REPOS (Settings → Secrets and variables → Actions → Variables) với danh sách kho tin cậy, cách nhau bằng dấu phẩy, ví dụ TXAVL/txa-repo. Để trống thì bot chỉ tin TXAVL/txa-repo (và chính kho đó).

Ai đã có PR được gộp, có comment đồng ý đúng phiên bản thỏa thuận hiện hành ở một kho trong danh sách, sẽ không bị hỏi lại; PR của họ vào thẳng bước tick checklist. Muốn bắt mọi người comment lại thì đặt RECOGNISE_RETURNING = False trong tools/src/txa/ci/agreement.py.

By default the bot comments as github-actions[bot]. Create a GitHub App and the comments, labels and statuses appear under their own name (txa-repo[bot]) with their own logo. It is optional: until the App is installed the workflow uses the default token and everything keeps working.

1. Create the App

  1. Open https://github.com/settings/apps/new (signed in as the TXAVL account).

  2. Fill in:

    • GitHub App name: txa-repo (names are global; if it is taken use txa-repo-bot).
    • Homepage URL: https://github.com/TXAVL/txa-repo
    • Webhook: untick Active (this App does not need to receive webhooks).
  3. Repository permissions (leave everything else as No access):

    PermissionLevelUsed for
    ActionsRead and writere-running the checks after the agreement is accepted
    ChecksRead and writethe 16 numbered checks in the merge box
    Commit statusesRead and writetxa/verified, txa/agreement
    ContentsRead and writeturning on auto-merge
    IssuesRead and writecomments, labels, deleting the @txa-repo agree comment
    Pull requestsRead and writereading PRs, merging them
    MetadataRead-only(granted automatically)
  4. Where can this GitHub App be installed? → Only on this account. Press Create GitHub App.

  5. On the new App page note the App ID; scroll to Private keys → Generate a private key (a .pem file is downloaded). Under Display information upload the logo.

2. Install the App on the repository

App page → Install App → TXAVL → Only select repositories → choose txa-repo → Install.

3. Put the key into secrets (without exposing it)

.\scripts\setup-app.ps1 -AppId 1234567 -KeyFile C:\Users\admin\Downloads\txa-repo.2026-10-27.private-key.pem

The script only runs gh secret set TXA_APP_ID and gh secret set TXA_APP_PRIVATE_KEY (it reads the key from the file and never prints it). Delete the .pem file from your PC afterwards.

4. Check it

Open a new PR: the bot's comment must show the name txa-repo with a bot label. If it still shows github-actions, check that both secrets exist (gh secret list) and that the App is installed on txa-repo.

Bonus: because the App merges PRs with its own permissions, that merge counts as a real push and triggers TXA Publish API by itself.

5. A new repository remembers people who agreed in another one

A repository you build (a fork) that runs the TXA bot can remember people who already accepted the Contributor Agreement elsewhere, the way winget-pkgs does with its CLA. In that repository create the repository variable TXA_AGREEMENT_REPOS (Settings → Secrets and variables → Actions → Variables) holding the trusted repositories, comma separated, for example TXAVL/txa-repo. Left empty the bot trusts only TXAVL/txa-repo (and the repository itself).

Anyone with a merged PR and an accepted-agreement comment of the current agreement version in a listed repository is not asked again; their PR goes straight to ticking the checklist. To make everyone comment again, set RECOGNISE_RETURNING = False in tools/src/txa/ci/agreement.py.