• TypeScript 82.9%
  • Shell 12.1%
  • JavaScript 5%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Sean Goedecke 41caef41a7
Merge pull request #272 from actions/sgoedecke/remediate-vulnerabilities
Remediate esbuild and undici vulnerabilities
2026-09-01 17:29:58 +10:00
.devcontainer fix: linter happy now?? 2025-05-27 13:39:43 +10:00
.github fix: restore lint checks 2026-09-01 17:16:38 +10:00
.licenses/npm Refresh Licensed cache 2026-07-29 21:46:06 +00:00
.vscode Initial commit 2025-04-04 07:27:58 +11:00
__fixtures__ 🔒 [security fix] Mask sensitive tokens in GitHub Actions logs 2026-03-10 22:44:58 +00:00
__tests__ feat: remove github-models support and make copilot the only provider 2026-06-10 18:54:41 +00:00
dist fix: restore lint checks 2026-09-01 17:16:38 +10:00
script Fix local actions test with mock Copilot CLI 2026-07-29 21:58:47 +00:00
src feat: remove github-models support and make copilot the only provider 2026-06-10 18:54:41 +00:00
.env.example update ci.yml 2025-04-06 23:24:55 +00:00
.gitattributes Initial commit 2025-04-04 07:27:58 +11:00
.gitignore Initial commit 2025-04-04 07:27:58 +11:00
.licensed.yml licensed 2025-07-16 03:06:59 +00:00
.node-version node 24 2025-08-01 12:13:15 +01:00
.prettierignore Initial commit 2025-04-04 07:27:58 +11:00
action.yml feat: remove github-models support and make copilot the only provider 2026-06-10 18:54:41 +00:00
CODE_OF_CONDUCT.md Fixup linting 2025-04-07 00:58:35 +00:00
CODEOWNERS update codeowners 2025-04-10 21:37:11 +00:00
CONTRIBUTING.md read prompt from file and print output to file 2025-04-17 17:41:35 +00:00
eslint.config.mjs make it work with new eslint 2026-03-13 11:35:29 -10:00
LICENSE Initial commit 2025-04-04 07:27:58 +11:00
package-lock.json fix: restore lint checks 2026-09-01 17:16:38 +10:00
package.json fix: restore lint checks 2026-09-01 17:16:38 +10:00
README.md run prettier on README.md 2026-07-22 19:45:54 +00:00
rollup.config.ts chore: use github's shared prettier-config 2025-07-24 19:11:15 +10:00
SECURITY.md Add security and support docs 2025-04-10 03:02:10 +00:00
SUPPORT.md Add security and support docs 2025-04-10 03:02:10 +00:00
tsconfig.base.json Initial commit 2025-04-04 07:27:58 +11:00
tsconfig.eslint.json chore: use github's shared prettier-config 2025-07-24 19:11:15 +10:00
tsconfig.json Initial commit 2025-04-04 07:27:58 +11:00

AI Inference in GitHub Actions

GitHub Super-Linter CI Check dist/ CodeQL

Run AI inference in workflows using the GitHub Copilot CLI.

Usage

The action is Copilot-only. The provider input defaults to copilot, and copilot is the only supported value.

Because the Copilot CLI is not pre-installed on GitHub-hosted runners, install and authenticate it before invoking this action.

name: AI inference
on: workflow_dispatch

jobs:
  inference:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6

      - uses: actions/setup-node@v6

      - name: Install Copilot CLI
        run: npm install -g @github/copilot

      - name: Run AI Inference via Copilot
        id: inference
        uses: actions/ai-inference@v1
        with:
          prompt: Summarize the latest changes in this repository.
          model: gpt-4.1
        env:
          COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_PAT }}

      - name: Print output
        run: echo "${{ steps.inference.outputs.response }}"

Prompt Files

You can provide prompt content inline or from files.

Text prompt file

steps:
  - name: Run AI Inference with Text File
    id: inference
    uses: actions/ai-inference@v1
    with:
      prompt-file: ./.github/prompts/prompt.txt

Structured .prompt.yml file

steps:
  - name: Run AI Inference with Prompt YAML
    id: inference
    uses: actions/ai-inference@v1
    with:
      prompt-file: ./.github/prompts/sample.prompt.yml
      input: |
        repo: actions/ai-inference
      file_input: |
        diff: ./artifacts/diff.txt

Example:

messages:
  - role: system
    content: Be concise and concrete.
  - role: user
    content: Summarize changes for {{repo}} using this diff:\n{{diff}}
model: gpt-4.1

System Prompt File

steps:
  - name: Run AI Inference with System Prompt File
    id: inference
    uses: actions/ai-inference@v1
    with:
      prompt: Hello
      system-prompt-file: ./.github/prompts/system.txt

Response File Output

The action writes the model response to a temporary file and exposes the path via response-file.

steps:
  - name: Run AI Inference
    id: inference
    uses: actions/ai-inference@v1
    with:
      prompt: Hello

  - name: Use Response File
    run: |
      echo "Response saved to: ${{ steps.inference.outputs.response-file }}"
      cat "${{ steps.inference.outputs.response-file }}"

Inputs

Inputs are defined in action.yml.

Name Description Default
prompt Inline user prompt. ""
prompt-file Path to prompt file (.txt or .prompt.yml). When both are set, this takes precedence over prompt. ""
input YAML template variables for .prompt.yml files. ""
file_input YAML map of template variable names to file paths; file contents are injected into templates. ""
model Model to pass to Copilot CLI (for example gpt-4.1, claude-sonnet-4.5). Set empty to let CLI choose its default. gpt-4.1
system-prompt Inline system prompt. You are a helpful assistant
system-prompt-file Path to system prompt file. When both are set, this takes precedence over system-prompt. ""
token Token value masked by the action. Defaults to github.token. github.token
provider Inference provider. Only copilot is supported. copilot
copilot-cli-path Path to Copilot CLI binary. If empty, uses copilot on PATH. ""
copilot-allow-tools Comma-separated list of --allow-tool values passed to Copilot CLI. ""

Outputs

Name Description
response Model response text.
response-file Path to temp file containing the response text.

Notes

  • The action invokes Copilot CLI with -p <prompt> -s --no-ask-user.
  • No --allow-tool flags are passed unless you set copilot-allow-tools.
  • Ensure Copilot CLI authentication is configured on the runner, typically via COPILOT_GITHUB_TOKEN.

Publishing a New Release

This project includes a helper script, script/release, to streamline tagging and pushing new releases for GitHub Actions. For more information, see Versioning in the GitHub Actions toolkit.