usage

GitHub CLI 2.87.0

工具與目錄
在這頁

新功能 9 項

01

發布時一併整理授權資訊

下載 gh 的新版本時,授權資訊現在會在發布階段一併打包。授權條款是說明程式碼能如何使用與散布的規則;把它們跟著成品整理好,使用者或公司在檢查這套工具包含哪些授權時,不必再另外拼湊資料。這不會改變你下指令的方式,而是讓每一份發布品的文件更完整,也方便保存與交接。就像買電器時,保固與使用說明直接放進盒子,不必回頭向不同廠商索取。

官方原文

Bundle licenses at release time by @williammartin in https://github.com/cli/cli/pull/12625

02

專案項目清單可用查詢條件篩選

整理 GitHub 專案看板時,gh project item-list 現在可加上 --query 旗標(指令後用來指定做法的選項),用查詢條件挑出想看的項目,不必先把整張清單都撈出來再自己找。這特別適合待辦很多、只想聚焦某類項目的看板。隨後也整理了這項查詢功能加入時的程式碼,讓它維持一致。就像圖書館目錄多了一個搜尋欄,你先寫好條件,再拿到需要的那排書。

官方原文

Add --query flag to project item-list by @williammartin in https://github.com/cli/cli/pull/12696

Clean up project item-list query addition changes by @williammartin in https://github.com/cli/cli/pull/12714

03

可取得手動觸發工作流程的執行詳情

你手動啟動 GitHub Actions 工作流程(workflow,依步驟自動執行工作的設定)後,gh 現在能取得這次手動觸發執行的詳細資料。以前看執行紀錄時,手動按下啟動的那一趟可能少了可追查的資訊;現在工具會把它當成可辨識的一次執行來讀取。這讓你檢查部署、測試或其他自動化工作時,更容易確認剛剛啟動的是哪一次。就像叫了外送後能看到那一張訂單,而不是只知道店家曾經出餐。

官方原文

feat(workflow run): retrieve workflow dispatch run details by @babakks in https://github.com/cli/cli/pull/12695

04

REST API 固定使用指定版本

用 gh 與 GitHub 溝通時,REST API(讓程式透過網址交換資料的介面)現在固定使用 2022-11-28 這個版本。API 若隨服務端預設版本變動,原本可用的指令回應可能在沒有改動你的情況下改變;明確指定版本,工具就知道要依哪一套規則交談。這不是讓你多背一個日期,而是替日常指令減少不預期的差異。就像填表時固定拿同一版表格,不會今天欄位忽然換了位置。

官方原文

Pin REST API version to 2022-11-28 by @williammartin in https://github.com/cli/cli/pull/12680

05

查看工作流程日誌時正確回傳失敗狀態

檢查工作流程執行結果時,就算你同時要求顯示完整日誌或只顯示失敗日誌,gh run view 的 --exit-status 旗標(讓指令以成功或失敗結果結束的選項)現在也會照實回傳結果。以前加上 --log 或 --log-failed 後,這個判斷可能沒有被遵守,讓腳本看錯執行是否失敗。現在你既能讀日誌,也能讓自動化據此停下或繼續。就像警報紀錄可查看,警示燈也仍會亮起。

官方原文

Respect --exit-status with --log and --log-failed in run view by @williammartin in https://github.com/cli/cli/pull/12679

06

建立 PR 時分叉只複製預設分支

用 gh pr create 建立提取請求(PR,把你的修改送去請專案合併的申請)而需要分叉(fork,複製別人的專案到自己的帳號)時,gh 現在只會分叉預設分支,不再一口氣複製所有分支。你要送出的改動通常是從預設分支開始,這樣做能把建立 PR 時搬運的範圍縮小到真正需要的部分。原專案的其他分支不會因此被當成這次建立 PR 必須帶走的內容。就像只影印辦事所需的主文件,不把整個檔案櫃都搬回家。

官方原文

Fork with default branch only during pr create by @williammartin in https://github.com/cli/cli/pull/12673

07

編輯 PR 時可搜尋指派人與邀請 Copilot 審查

編輯提取請求(PR,把修改送去請專案合併的申請)時,你現在能在互動式提示裡挑選指派人,並可搜尋後把 Copilot 加為審查者。互動式提示是指令一步步問你要選什麼的畫面,因此不必自己記住每個帳號再手打。這兩處也改善了操作速度與無障礙功能,讓使用輔助工具的人更容易完成選擇。就像填會議邀請時,可在名單中找人、勾選 AI 助手,欄位也更好操作。

官方原文

gh pr edit: Add support for Copilot as reviewer with search capability, performance and accessibility improvements by @BagToad in https://github.com/cli/cli/pull/12567

gh pr edit: new interactive prompt for assignee selection, performance and accessibility improvements by @BagToad in https://github.com/cli/cli/pull/12526

08

上傳發布檔與編輯 gist 的說明更清楚

上傳發布檔時,gh release upload 對 --clobber 旗標的說明更明白:它會先刪除既有資產,再重新上傳,而不是直接覆蓋得像沒發生過事。gh gist edit 也加入使用範例,方便你編輯 gist(用來分享短程式碼或文字片段的 GitHub 貼文)。另外修正一處英文拼字。這些改動不改指令功能,卻把可能誤操作的地方先講清楚。就像搬新檔前先在按鈕旁寫明「會先清空舊櫃」。

官方原文

gh release upload: Clarify --clobber flag deletes assets before re-uploading by @BagToad in https://github.com/cli/cli/pull/12711

Add usage examples to gh gist edit command by @BagToad in https://github.com/cli/cli/pull/12710

typo: dont to don't by @cuiweixie in https://github.com/cli/cli/pull/12554

@cuiweixie made their first contribution in https://github.com/cli/cli/pull/12554

09

內部維護更新,讓後續發布與開發更穩定

這一批也整理了 gh 的內部維護:移除回饋 issue 範本、把 issue 與 PR 分流流程搬到共用工作流程、補上功能偵測註解,並讓升級 Go 的工作流程可手動啟動;程式碼錯誤格式與文件來源也做了修正。底層同時更新 Go、OAuth、文字、終端機、簽章與發布相關依賴套件,另記錄一位新貢獻者。這些不是新增給你下的新指令,而是維持開發、測試與發布鏈條。就像店面不添新菜,先把廚房管線和備料流程整理好。

官方原文

Remove feedback issue template by @BagToad in https://github.com/cli/cli/pull/12708

Migrate issue triage workflows to shared workflows by @BagToad in https://github.com/cli/cli/pull/12677

Migrate PR triage workflows to shared workflows by @BagToad in https://github.com/cli/cli/pull/12707

Add missing TODO comments for featuredetection if-statements by @BagToad in https://github.com/cli/cli/pull/12701

Add manual dispatch to bump-go workflow by @BagToad in https://github.com/cli/cli/pull/12631

Fix fmt.Errorf format argument in ParseFullReference by @mikelolasagasti in https://github.com/cli/cli/pull/12516

Lint source.md by @Sethispr in https://github.com/cli/cli/pull/12521

chore(deps): bump golang.org/x/text from 0.32.0 to 0.33.0 by @dependabot[bot] in https://github.com/cli/cli/pull/12468

chore(deps): bump golang.org/x/term from 0.38.0 to 0.39.0 by @dependabot[bot] in https://github.com/cli/cli/pull/12616

Bump go to 1.25.7 by @BagToad in https://github.com/cli/cli/pull/12630

chore(deps): bump golang.org/x/crypto from 0.46.0 to 0.47.0 by @dependabot[bot] in https://github.com/cli/cli/pull/12629

chore: bump cli/oauth to v1.2.2 by @babakks in https://github.com/cli/cli/pull/12573

update Go to 1.25.6 by @BagToad in https://github.com/cli/cli/pull/12580

chore(deps): bump actions/attest-build-provenance from 3.1.0 to 3.2.0 by @dependabot[bot] in https://github.com/cli/cli/pull/12558

chore(deps): bump github.com/sigstore/rekor from 1.4.3 to 1.5.0 by @dependabot[bot] in https://github.com/cli/cli/pull/12524

chore(deps): bump github.com/theupdateframework/go-tuf/v2 from 2.3.1 to 2.4.1 by @dependabot[bot] in https://github.com/cli/cli/pull/12555

chore(deps): bump github.com/gdamore/tcell/v2 from 2.13.4 to 2.13.7 by @dependabot[bot] in https://github.com/cli/cli/pull/12469

chore(deps): bump github.com/sigstore/sigstore from 1.10.0 to 1.10.4 by @dependabot[bot] in https://github.com/cli/cli/pull/12525

chore(deps): bump github.com/theupdateframework/go-tuf/v2 from 2.3.0 to 2.3.1 by @dependabot[bot] in https://github.com/cli/cli/pull/12515

chore(deps): bump actions/download-artifact from 6 to 7 by @dependabot[bot] in https://github.com/cli/cli/pull/12314

chore(deps): bump actions/upload-artifact from 5 to 6 by @dependabot[bot] in https://github.com/cli/cli/pull/12315

chore(deps): bump goreleaser/goreleaser-action from 6.0.0 to 6.4.0 by @dependabot[bot] in https://github.com/cli/cli/pull/12354

@Sethispr made their first contribution in https://github.com/cli/cli/pull/12521