Skip to content
Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

29 Commits

GitHub licenseGitHub release tag * GitHub repository stargazers

Prompt GitHub AI Models via GitHub Action

Tip

Prompt GitHub AI Models using inference request via GitHub Action API.


Usage Examples

Compare available AI models to choose the best one for your use-case.

Summarize GitHub Issues

on:
issues:
types: openedjobs:
summary:
runs-on: ubuntu-latestpermissions:
issues: writemodels: readsteps:
- name: Summarize issueid: promptuses: op5dev/prompt-ai@v2with:
user-prompt: | Concisely summarize the GitHub issue with title '${{ github.event.issue.title }}' and body: ${{ github.event.issue.body }}max_tokens: 250
- name: Comment summaryrun: gh issue comment $NUMBER --body "$SUMMARY"env:
GH_TOKEN: ${{ github.token }}NUMBER: ${{ github.event.issue.number }}SUMMARY: ${{ steps.prompt.outputs.response }}

Troubleshoot Terraform Infrastructure-as-Code

on:
pull_request:
push:
branches: mainjobs:
provision:
runs-on: ubuntu-latestpermissions:
actions: readchecks: writecontents: readpull-requests: writemodels: readsteps:
- name: Checkout repositoryuses: actions/checkout@v4
- name: Setup Terraformuses: hashicorp/setup-terraform@v3
- name: Provision Terraformid: provisionuses: op5dev/tf-via-pr@v13with:
working-directory: env/devcommand: ${{ github.event_name == 'push' && 'apply' || 'plan' }}
- name: Troubleshoot Terraformif: failure()uses: op5dev/prompt-ai@v2with:
model: openai/gpt-4.1-minisystem-prompt: You are a helpful DevOps assistant and expert at troubleshooting Terraform errors.user-prompt: Troubleshoot the following Terraform output; ${{ steps.provision.outputs.result }}max-tokens: 500

Debug Nomad-Pack Deployment

on:
pull_request:
push:
branches: mainjobs:
deploy:
runs-on: ubuntu-latestpermissions:
contents: readmodels: readsteps:
- name: Checkout repositoryuses: actions/checkout@v4
- name: Setup Nomad-Packuses: hashicorp/setup-nomad-pack@main
- name: Run Nomad-Packid: nomadrun: | nomad-pack run . --verbose 2>&1 | tee log.txt status=${PIPESTATUS[0]} if [[ $status -ne 0 ]]; then echo "log<<EOH" >> "$GITHUB_OUTPUT" cat log.txt >> "$GITHUB_OUTPUT" echo "EOH" >> "$GITHUB_OUTPUT" fi exit $status - name: Debug Nomad-Packif: failure()uses: op5dev/prompt-ai@v2with:
model: openai/gpt-4.1-minisystem-prompt: You are a helpful DevOps assistant and expert at debugging Nomad-Pack deployments.user-prompt: Debug the following Nomad-Pack deployment log; ${{ steps.nomad.outputs.log }}temperature: 0.7top-p: 0.9

Inputs

The only required input is user-prompt, while every parameter can be tuned per documentation.

TypeNameDescription
CommonmodelModel ID to use for the inference request.
(e.g., openai/gpt-4.1-mini)
Commonsystem-promptPrompt associated with the system role.
(e.g., You are a helpful software engineering assistant)
Commonuser-promptPrompt associated with the user role.
(e.g., List best practices for workflows with GitHub Actions)
Commonmax-tokensThe maximum number of tokens to generate in the completion. The token count of your prompt plus max-tokens cannot exceed the model's context length.
(e.g., 100)
CommontemperatureThe sampling temperature to use that controls the apparent creativity of generated completions. Higher values will make output more random while lower values will make results more focused and deterministic.
(e.g., range is [0, 1])
Commontop-pAn alternative to sampling with temperature called nucleus sampling. This value causes the model to consider the results of tokens with the provided probability mass.
(e.g., range is [0, 1])
Additionalfrequency-penaltyA value that influences the probability of generated tokens appearing based on their cumulative frequency in generated text.
(e.g., range is [-2, 2])
AdditionalmodalitiesThe modalities that the model is allowed to use for the chat completions response.
(e.g., from text and audio)
AdditionalorgOrganization to which the request is to be attributed.
(e.g., github.repository_owner)
Additionalpresence-penaltyA value that influences the probability of generated tokens appearing based on their existing presence in generated text.
(e.g., range is [-2, 2])
AdditionalseedIf specified, the system will make a best effort to sample deterministically such that repeated requests with the same seed and parameters should return the same result.
(e.g., 123456789)
AdditionalstopA collection of textual sequences that will end completion generation.
(e.g., ["\n\n", "END"])
AdditionalstreamA value indicating whether chat completions should be streamed for this request.
(e.g., false)
Additionalstream-include-usageWhether to include usage information in the response.
(e.g., false)
Additionaltool-choiceIf specified, the model will configure which of the provided tools it can use for the chat completions response.
(e.g., 'auto', 'required', or 'none')
PayloadpayloadBody parameters of the inference request in JSON format.
(e.g., {"model"…)
Payloadpayload-filePath to a JSON file containing the body parameters of the inference request.
(e.g., ./payload.json)
Payloadshow-payloadWhether to show the body parameters in the workflow log.
(e.g., false)
Payloadshow-responseWhether to show the response content in the workflow log.
(e.g., true)
GitHubgithub-api-versionGitHub API version.
(e.g., 2022-11-28)
GitHubgithub-tokenGitHub token for authorization.
(e.g., github.token)

Outputs

Due to GitHub's API limitations, the response content is truncated to 262,144 (2^18) characters so the complete, raw response is saved to response-file.

NameDescription
responseResponse content from the inference request.
response-fileFile path containing the complete, raw response in JSON format.
payloadBody parameters of the inference request in JSON format.

Security

View security policy and reporting instructions.

Tip

Pin your GitHub Action to a commit SHA to harden your CI/CD pipeline security against supply chain attacks.


Changelog

View all notable changes to this project in Keep a Changelog format, which adheres to Semantic Versioning.

Tip

All forms of contribution are very welcome and deeply appreciated for fostering open-source projects.


License

About

AI inference request GitHub Models via this GitHub Action.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

7 stars

Watchers

2 watching

Forks

Releases

Sponsor this project

Used by

Contributors