fix(actions): retry PR creation on rerun when branch exists without open PR

This commit is contained in:
Cursor Agent 2026-07-21 21:55:09 +00:00
parent 486fbe8080
commit 01c7436877
No known key found for this signature in database

View file

@ -32,9 +32,11 @@ jobs:
BRANCH_NAME="auto-update-price-and-context-window-$(date +'%Y-%m-%d')"
git fetch origin "${BASE_BRANCH}" "${BRANCH_NAME}" || true
if git show-ref --verify --quiet "refs/remotes/origin/${BRANCH_NAME}"; then
BRANCH_EXISTED=1
git checkout -B "${BRANCH_NAME}" "origin/${BRANCH_NAME}"
git merge --no-edit "origin/${BASE_BRANCH}"
else
BRANCH_EXISTED=0
git checkout -b "${BRANCH_NAME}" "origin/${BASE_BRANCH}"
fi
uv run --frozen --with 'aiohttp==3.13.3' python ".github/workflows/auto_update_price_and_context_window_file.py"
@ -44,6 +46,9 @@ jobs:
else
git commit -m "Update model_prices_and_context_window.json file: $(date +'%Y-%m-%d')"
git push "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" "${BRANCH_NAME}"
BRANCH_EXISTED=1
fi
if [ "${BRANCH_EXISTED}" -eq 1 ]; then
if [ "$(gh pr list --head "${BRANCH_NAME}" --state open --json number --jq 'length')" -gt 0 ]; then
echo "PR already exists for ${BRANCH_NAME}."
else