Skip to content

Gemini chat Action

Actions
Chat with Gemini from your Actions
init
Latest
Star (2)

Tags

 (2)

Gemini Chat GitHub Action

This action allows you to interact with Google's Gemini API directly from your GitHub Actions workflows. You can send text prompts and system instructions to the Gemini model and receive its generated answer.

Features

  • Sends text prompts to the Gemini API (model gemini-2.5-flash via v1beta endpoint).
  • Supports optional system-level instructions to guide the model's behavior.
  • Validates required inputs (gemini-api-key, text).
  • Ensures curl and jq are available in the runner environment, installing them if necessary (on Debian/Ubuntu and Alpine-based images).
  • Outputs the generated answer from Gemini.
  • Provides detailed console output including the full JSON response from the API (for debugging) and the extracted answer.

Inputs

  • gemini-api-key
    • Description: Your API key for the Google Gemini API.
    • Required: true
  • text
    • Description: The main text prompt to send to the Gemini model.
    • Required: true
  • system-instruction
    • Description: Optional system-level instructions to steer the model's behavior. This can include context, desired format, or examples.
    • Required: false
    • Default: ""

Outputs

  • answer
    • Description: The text answer generated by Gemini.

Usage Example

name: Ask Gemini

on: [push]

jobs:
  chat_with_gemini:
    runs-on: ubuntu-latest
    steps:

      - name: Call Gemini Action
        id: gemini_response
        uses: ViRGiL175/gemini-chat-action@main
        with:
          gemini-api-key: ${{ secrets.GEMINI_API_KEY }}
          text: "Translate 'Hello, world!' to Spanish."
          system-instruction: "You are a helpful translation assistant."

      - name: Show Gemini's Answer
        run: echo "Gemini says: ${{ steps.gemini_response.outputs.answer }}"

Development

The action is a composite action, defined in action.yml. It uses curl to make requests to the Gemini API and jq to parse the JSON response.

Dependencies:

  • curl
  • jq

The action attempts to install these if they are not found on the runner, supporting apt-get (Debian/Ubuntu) and apk (Alpine). For other systems, ensure these tools are pre-installed on your runner.

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a pull request or open an issue.

Disclaimer

This is an unofficial action and is not affiliated with Google. Use the Gemini API in accordance with Google's terms of service.

Gemini chat Action is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

Chat with Gemini from your Actions
init
Latest

Tags

 (2)

Gemini chat Action is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.