💸Save up to $132K/month in CI costs!👉 Try Free
Skip to main content
← Back to workflows

How to Generate Commit Messages with AI with GitHub Actions?

di-sukharev/opencommit -
GitHub Action
v1.0.2
5,983
Contributors
Contributor - di-sukharevContributor - avighnacContributor - malpou
Categories

Optimize Your CI/CD Pipeline

Get instant insights into your CI/CD performance and costs. Reduce build times by up to 45% and save on infrastructure costs.

45% Faster Builds
60% Cost Reduction
Usage
name: 'OpenCommit Action'

on:
push:
# This list of branches usually covers our needs,
# however, you can also exclude additional public branches if necessary.
branches-ignore: [main master dev development release]

jobs:
opencommit:
timeout-minutes: 10
name: OpenCommit
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: Setup Node Environment
uses: actions/setup-node@v2
with:
node-version: '16'
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: di-sukharev/opencommit@github-action-v1.0.4
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

env:
# set openAI api key in repo actions secrets,
# for openAI keys go to: https://platform.openai.com/account/api-keys
# for repo secret go to: <your_repo_url>/settings/secrets/actions
OCO_OPENAI_API_KEY: ${{ secrets.OCO_OPENAI_API_KEY }}

# customization
OCO_TOKENS_MAX_INPUT: 4096
OCO_TOKENS_MAX_OUTPUT: 500
OCO_OPENAI_BASE_PATH: ''
OCO_DESCRIPTION: false
OCO_EMOJI: false
OCO_MODEL: gpt-3.5-turbo
OCO_LANGUAGE: en
OCO_PROMPT_MODULE: conventional-commit

OpenCommit logo

OpenCommit

Auto-generate meaningful commits in a second


What is OpenCommit?

OpenCommit is automates the creation of meaningful commit messages using AI. All the commits in its repo are authored by OpenCommit, showing how it uses emojis and descriptions effectively. You can configure these settings to your preference.

OpenCommit allows users to customize its behavior according to their preferences. You can configure settings such as language, emoji usage, and model type either for each repository or globally for all repositories.

We can also set up OpenCommit as a GitHub Action. This means it'll automatically make our commit messages better whenever we push changes. This way, we avoid those vague commit messages like "fix1" or "done2" and keep everything clear and meaningful.


OpenCommit logo

Advanced Settings

We can tweak a lot of stuff in OpenCommit. For instance, we can change emoji use, how long the descriptions are, and even choose between different AI models, like GPT-4 or GPT-3.5. We can set these options for each of our repos individually or apply them across all projects globally. Plus, it supports multiple languages, so we can have commit messages in whatever language we prefer.

By using OpenCommit, we make our commit process smoother and keep our commit messages clear and consistent. It fits right into our workflow and can be customized to fit exactly what we need for our projects.