Skip to content

Create field_import_export.js #11

Create field_import_export.js

Create field_import_export.js #11

name: Update Changelog
on:
push:
branches:
- master # Replace with your default branch name
jobs:
generate-summary:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.x
- name: Install Python Dependencies
run: pip install openai # Install the OpenAI Python library
- name: Get Last Commit SHA
id: last_commit
run: echo "::set-output name=commit_sha::$(git log -1 --pretty=%H)"
- name: Get Last Commit Diff
id: commit_diff
run: |
commit_sha="${{ steps.last_commit.outputs.commit_sha }}"
diff=$(curl -s "https://api.github.com/repos/${{ github.repository }}/commits/$commit_sha" | jq -r '.files[].patch')
echo "::set-output name=commit_diff::$diff"
- name: Set ChatGPT API Key
run: echo "export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}" >> $GITHUB_ENV
- name: Generate Summary
id: generate_summary
run: |
# Get the commit diff
commit_diff="${{ steps.commit_diff.outputs.commit_diff }}"
# Generate a summary using ChatGPT
summary=$(echo "$commit_diff" | openai api completions.create --model text-davinci-002 | jq -r '.choices[0].text')
echo "::set-output name=summary::$summary"
- name: Update Changelog
run: |
# Append the generated summary to your changelog file (e.g., CHANGELOG.md)
summary="${{ steps.generate_summary.outputs.summary }}"
echo "$summary" >> CHANGELOG.md
- name: Commit and Push
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add CHANGELOG.md
git commit -m "Update changelog"
git push