Merge pull request #17 from omnisat/test #16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
branches: | |
- dev | |
- main | |
jobs: | |
generate-release-notes: | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/dev' && github.event_name != 'pull_request' | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Ensure full history is checked out | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 8.6.6 | |
- name: Install dependencies | |
run: pnpm install | |
# Setup Python and install openai module | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Install Python dependencies | |
run: | | |
python3 -m pip install --upgrade pip | |
pip install openai==0.28 | |
- name: Generate git diff | |
run: | | |
if [ "$(git rev-parse --is-shallow-repository)" = "true" ]; then | |
git fetch --unshallow | |
fi | |
PREV_COMMIT=$(git rev-parse HEAD^1 || echo "No previous commit") | |
if [ "$PREV_COMMIT" != "No previous commit" ]; then | |
git diff $PREV_COMMIT HEAD > changes.diff | |
else | |
echo "No previous commit, skipping diff" | |
echo "" > changes.diff # Empty diff if no previous commit | |
fi | |
# Generate release notes using the external Python script | |
- name: Generate Release Notes with GPT | |
run: | | |
python3 scripts/generate_release_notes.py > releases/dev_release_notes_$(date +'%Y-%m-%d').md # Store in releases directory | |
# Commit the release notes to the releases directory | |
- name: Commit Release Notes | |
run: | | |
git add releases/ | |
git commit -m "Added release notes for dev $(date +'%Y-%m-%d')" | |
git push | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |