-
-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (36 loc) · 1.44 KB
/
generate_commit_message.yml
File metadata and controls
45 lines (36 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
name: Generate Commit Message
# Trigger the workflow on a push event to the main branch.
on:
push:
branches:
- master
jobs:
generate_message:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
fetch-depth: 2 # Fetch the last two commits to perform a diff later.
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.11 # Specify Python version.
- name: Install OpenAI
run: pip install openai # Install the necessary OpenAI library.
# Set the Git user so that commits from this action are attributed to github-actions[bot].
- name: Set up Git user
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Generate Commit Message
run: python .github/actions/generate_commit_message.py # Run the commit message script.
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} # Provide the OpenAI API key from GitHub secrets.
# Configure Git to push using the provided token.
- name: Set up Git for push
run: |
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/tdenimal/tdenimal.github.io.git
# Push the amended commit to the master branch.
- name: Push changes
run: git push origin master --force-with-lease