Skip to content

ENH: Resolve pressure_ISA discretization bounds TODO #49

ENH: Resolve pressure_ISA discretization bounds TODO

ENH: Resolve pressure_ISA discretization bounds TODO #49

Workflow file for this run

name: Populate Changelog
on:
pull_request:
types: [closed]
branches:
- develop
permissions:
contents: write
jobs:
Changelog:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Clone RocketPy
uses: actions/checkout@v4
with:
repository: RocketPy-Team/RocketPy
ref: develop
token: ${{ secrets.RELEASE_TOKEN }}
# Full history so the retry loop below can rebase onto the latest
# develop when another merge lands while this job runs.
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: python -m pip install --upgrade pip "google-genai>=1.0.0"
- name: Update Changelog
env:
# PR title/body are untrusted input, so they are passed via the
# environment and consumed inside Python (never interpolated into the
# shell). The script asks Gemini to format and place the entry, then
# validates the result; if the key is missing or the model output is
# rejected, it falls back to a safe deterministic insert.
PR_TITLE: ${{ github.event.pull_request.title }}
PR_NUMBER: ${{ github.event.pull_request.number }}
PR_LABELS: ${{ join(github.event.pull_request.labels.*.name, ',') }}
PR_BODY: ${{ github.event.pull_request.body }}
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
run: python .github/scripts/update_changelog.py
- name: Push Changes
run: |
if git diff --quiet -- CHANGELOG.md; then
echo "CHANGELOG.md unchanged (duplicate or no-op) — nothing to commit."
exit 0
fi
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add CHANGELOG.md
git commit -m "DOC: update changelog for PR #${{ github.event.pull_request.number }}"
# Survive races: if another PR merged into develop after our checkout,
# the first push is rejected (non-fast-forward). Rebase and retry.
for attempt in 1 2 3 4 5; do
if git push origin HEAD:develop; then
echo "Pushed changelog update on attempt ${attempt}."
exit 0
fi
echo "Push rejected (attempt ${attempt}); rebasing onto latest develop..."
git pull --rebase origin develop
done
echo "::error::Failed to push changelog update after 5 attempts."
exit 1