PullPrompt comments on a Pull Request with a message generated from a user-given prompt. Under the hood, it uses Google’s Gemini API to generate the text.
- Model Selection: Choose from a variety of models to generate the text.
- Model Temperature: Set the temperature of the model to control the creativity of the text.
- Word Limit and Language: Set the word limit and language of the generated text.
The Action multiple inputs, some are required and some are optional:
github-token
(Required) – The GitHub token used for authentication.
"Share an open-source tip in 2 to 3 lines to help developers improve their workflow." You can find this in theaction.yml
file.gemini-api-key
(Required) – The Gemini API key used for authentication and text generation. You can obtain it from the Gemini API page.user-prompt
(Optional) – The prompt used to generate the text. The default is:gemini-model
(Optional) – The model used to generate the text. The default is:gemini-2.0-flash
. We can use other Gemini models likegemini-1.5-flash
,gemini-1.5-flash-8b
,gemini-1.5-pro
,gemini-1.0-pro
. A complete list of models can be found here.word-limit
(Optional) – The word limit for the generated text. The default is 200.output-language
(Optional) – The language of the generated text. The default isenglish
.model-temp
(Optional) – The temperature of the model. The default is 0.5. We can set the temperature between 0.1 to 1.0. The lower the temperature, the more deterministic the model will be. The higher the temperature, the more creative the model will be.
Once you have the API key, add it to your repository secrets:
- Go to Repository Settings → Secrets → Actions.
- Click New Repository Secret.
- Name it
GEMINI_API_KEY
and paste the API key as the value.
PullPrompt only works on pull request events. It will not trigger on any other event.
on:
pull_request: # Works only on pull requests
Below is an example of how to use PullPrompt in a GitHub Actions workflow:
Important
Before using the below code, check the pullprompt
action version in the uses
field from the GitHub Marketplace for the latest version.
name: PullPrompt
on:
pull_request: # Works only on pull requests
jobs:
pull_prompt:
runs-on: ubuntu-latest
permissions:
contents: read # Required for reading files
pull-requests: write # Required for commenting on PRs
steps:
- name: Checkout the code
uses: actions/checkout@v4
- name: Running PullPrompt
uses: Pradumnasaraf/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }} # Required
gemini-api-key: ${{ secrets.GEMINI_API_KEY }} # Required
user-prompt: "How to become a better developer?" # Optional
gemini-model: "gemini-2.0-flash" # Optional
output-language: "spanish" # Optional
word-limit: 250 # Optional
model-temp: 0.5 # Optional
If you have suggestions for improving PullPrompt or want to report a bug, feel free to open an issue! We welcome all contributions.
For more details, check out the Contributing Guide.
This project is licensed under the GNU General Public License v3.0.
For information on reporting security vulnerabilities, please refer to the Security Policy.