This Github Action allows you to easily integrate OpenAI API into your workflow. With just a few steps, you can use OpenAI's language model to generate responses for your project.
In your Github Actions workflow, add the following YAML code to utilize the action:
- name: OpenAI
uses: riccardolinares/openai-commit@v0.0.1
with:
openai-api-key: ${{ secrets.OPENAI_API_KEY }}
openai-prompt: <your-prompt>
model: <model-id>
id: openai
The action requires the following inputs:
openai-api-key
: Your OpenAI API key. This should be stored as a secret in your Github repository.openai-prompt
: The text prompt to be passed to the OpenAI API.model
: The ID of the OpenAI model to be used. (optional, default is text-davinci-003)
The output of the action is a response generated by OpenAI API. You can access the response by logging the output of the action.
${{ steps.openai.outputs.text}}
- Create a new Github repository or navigate to an existing one.
- Go to the "Actions" tab and click on "Set up a workflow yourself".
- Copy and paste the code below into the workflow file.
name: OpenAI Action
on:
push:
branches:
- main
jobs:
deploy:
name: OpenAI
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: 14
- name: OpenAI
uses: riccardolinares/openai-commit@v0.0.1
with:
openai-api-key: ${{ secrets.OPENAI_API_KEY }}
openai-prompt: "Write a description for this git commit: \n${{ github.event.head_commit.message }}"
id: openai
- Go to the "Settings" tab and click on "Secrets".
- Add a new secret named
OPENAI_API_KEY
with your OpenAI API key. - Use the following code to access the response generated by OpenAI API.
- Commit the changes to your repository.
The action is limited by the usage limits of your OpenAI API key.
If you have any questions or need help with this Github Action, please open an issue in the repository.
If you find any bugs or have suggestions for improvements, feel free to open an issue or create a pull request.