testing #10
Workflow file for this run
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 | |
pull_request: | |
branches: | |
- dev # Ensure we run the workflow for PRs targeting the dev branch | |
jobs: | |
# This job will run for every PR to the dev branch, ensuring tests are run | |
test-pr-to-dev: | |
runs-on: ubuntu-latest | |
if: github.event_name == 'pull_request' && github.base_ref == 'dev' | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- 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 | |
# Run tests | |
- name: Run Tests | |
run: pnpm test | |
# This job generates release notes when PRs are merged into dev | |
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 | |
- 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 | |
- name: Generate git diff | |
run: | | |
PREV_COMMIT=$(git rev-parse HEAD^1) | |
git diff $PREV_COMMIT HEAD > changes.diff | |
- name: Generate Release Notes with GPT | |
run: | | |
python3 scripts/generate_release_notes.py > RELEASE_NOTES.md | |
- name: Commit Release Notes | |
run: | | |
git add RELEASE_NOTES.md | |
git commit -m "Generated release notes for dev" | |
git push | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
summarize-release-notes: | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' | |
needs: generate-release-notes | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- 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 | |
- name: Aggregate Release Notes | |
run: | | |
git log --oneline --grep="Generated release notes for dev" --pretty=format:"%s%n%b" > release_notes_aggregated.txt | |
- name: Summarize Release Notes with GPT | |
run: | | |
python3 scripts/summarize_release_notes.py > SUMMARY_RELEASE_NOTES.md | |
- name: Commit Summarized Release Notes | |
run: | | |
git add SUMMARY_RELEASE_NOTES.md | |
git commit -m "Summarized release notes for main" | |
git push | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |