Answer: You can run Copilot CLI programmatically by using the copilot command with the -p or --prompt command-line option followed by your prompt, or by piping a prompt to the copilot command. Status: Confirmed Entry: tool/github-copilot/agents-and-automation/run-cli-programmatically-2 Revision: 1 Digest: sha256:ee24d4bf2868fa32 (changes whenever the content changes) Timeline: Created: 2026-11-13T03:23:45Z Last changed: 2026-11-13T03:23:45Z Last verified: 2026-11-20T13:01:54Z Next check: 2026-11-21T13:01:54Z Check interval: Daily Expected change: No fixed schedule Data: Field | Value | Source | As of prompt option | -p or --prompt | [1] | 2026-11-20 example command | copilot -p "Explain this file: ./complex.ts" | [1] | 2026-11-20 piped input example | echo "Explain this file: ./complex.ts" | copilot | [1] | 2026-11-20 piped input note | Piped input is ignored if you also provide a prompt with the -p or --prompt option. | [1] | 2026-11-20 Sources: [1] GitHub. "Running GitHub Copilot CLI programmatically - GitHub Docs". https://docs.github.com/en/copilot/how-tos/copilot-cli/automate-copilot-cli/run-cli-programmatically Role: primary. Accessed: 2026-11-20T13:01:54Z Quote: "Use the copilot command with the -p or --prompt command-line option, followed by your prompt" (Supports: prompt option) Quote: "copilot -p "Explain this file: ./complex.ts"" (Supports: example command) Quote: "echo "Explain this file: ./complex.ts" | copilot" (Supports: piped input example) Quote: "Piped input is ignored if you also provide a prompt with the -p or --prompt option." (Supports: piped input note) Snapshot SHA-256: 64285b720a1209bcc8a8356ad5bcdd8299d37e9da079d9bd7474ff7b77e131c4 (captured 2026-11-18T12:56:07Z) Verification: Method: Automated extraction from [1] with deepseek-flash (JSON output, thinking disabled). Every value was checked by code to appear verbatim in a quoted passage of [1]. On this check the text of [1] was unchanged since 2026-11-18T12:56:05Z, so the values verified then were kept. Cross-check: not-available at 2026-11-20T13:01:54Z. No independent second source is configured for this entry Last successful check: 2026-11-20T13:01:54Z Last attempt: 2026-11-20T13:01:54Z Notes and limitations: Extracted automatically from a single official source (section "Introduction"). Related: https://latestn.com/tool/github-copilot/agents-and-automation/run-copilot-cli-in-actions How do I run GitHub Copilot CLI in a GitHub Actions workflow? https://latestn.com/tool/github-copilot/agents-and-automation/run-dynamic-workflow-cli How do I run a GitHub Copilot dynamic workflow from the command line? https://latestn.com/tool/github-copilot/agents-and-automation/save-session-state-for-resume How do I save GitHub Copilot SDK session state so it can be resumed later? https://latestn.com/tool/github-copilot/agents-and-automation/review-suggestions-approvals-panel How do I review GitHub Copilot suggestions in the approvals panel? https://latestn.com/tool/github-copilot/agents-and-automation/rubber-duck-second-opinion How do I get a second opinion using the GitHub Copilot rubber duck agent? https://latestn.com/tool/github-copilot/agents-and-automation/run-cli-programmatically How do I run GitHub Copilot CLI programmatically? https://latestn.com/tool/ All entries in AI tools Change log: Time | Event | Change | Source 2026-11-13T03:23:45Z | added | Entry created | — Changes for this entry as a feed: https://latestn.com/tool/github-copilot/agents-and-automation/run-cli-programmatically-2/latest Challenge this entry: Open challenges: None How: If a value here is wrong or out of date, send what is wrong and a link to evidence. Challenges are queued and checked against the evidence; they do not change the entry by themselves. If the entry changes as a result, the change log says so. Form: https://latestn.com/dispute/tool/github-copilot/agents-and-automation/run-cli-programmatically-2 POST: https://latestn.com/dispute/tool/github-copilot/agents-and-automation/run-cli-programmatically-2 with claim, evidence_url, and optionally field and contact (form-encoded or JSON) GET: https://latestn.com/dispute/tool/github-copilot/agents-and-automation/run-cli-programmatically-2?claim={what is wrong}&evidence_url={link} How to cite: LatestN. (2026). How do I run GitHub Copilot CLI programmatically in scripts or CI/CD? Revision 1, last verified 2026-11-20T13:01:54Z. https://latestn.com/tool/github-copilot/agents-and-automation/run-cli-programmatically-2 (accessed 2026-11-21T09:53:09Z). @misc{LatestN_tool_github_copilot_agents_and_automation_run_cli_programmatically_2_r1, title = {How do I run GitHub Copilot CLI programmatically in scripts or CI/CD?}, author = {{LatestN}}, year = {2026}, howpublished = {\url{https://latestn.com/tool/github-copilot/agents-and-automation/run-cli-programmatically-2}}, note = {Revision 1; digest sha256:ee24d4bf2868fa32; last verified 2026-11-20T13:01:54Z; accessed 2026-11-21T09:53:09Z} } Reuse: License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) Attribution: Copying and adapting are allowed, including commercially, if you credit LatestN and link to the entry you used. Each entry ends with a ready-made citation. URL: https://latestn.com/tool/github-copilot/agents-and-automation/run-cli-programmatically-2