@@ -50,15 +50,25 @@ jobs:
5050 helm package . -d docs
5151 helm repo index ./docs/ --url https://cortexproject.github.io/cortex-helm-chart
5252
53- - name : Create Pull Request
53+ - name : Create or Update Pull Request
5454 env :
5555 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
5656 run : |
5757 git checkout -b release-${{ steps.version.outputs.new_version }}
5858 git add Chart.yaml README.md CHANGELOG.md docs/
5959 git commit -s -m "Release ${{ steps.version.outputs.new_version }}"
6060 git push --force origin release-${{ steps.version.outputs.new_version }}
61- gh pr create --title "Release ${{ steps.version.outputs.new_version }}" \
62- --body "Automated release PR for version ${{ steps.version.outputs.new_version }}" \
63- --base ${{ github.ref_name }} \
64- --head release-${{ steps.version.outputs.new_version }}
61+
62+ # Check if a PR already exists for this head branch
63+ existing_pr=$(gh pr list --head release-${{ steps.version.outputs.new_version }} --json number --jq '.[0].number')
64+ if [ -n "$existing_pr" ]; then
65+ echo "PR #$existing_pr already exists — updating title/body"
66+ gh pr edit "$existing_pr" \
67+ --title "Release ${{ steps.version.outputs.new_version }}" \
68+ --body "Automated release PR for version ${{ steps.version.outputs.new_version }}"
69+ else
70+ gh pr create \
71+ --title "Release ${{ steps.version.outputs.new_version }}" \
72+ --body "Automated release PR for version ${{ steps.version.outputs.new_version }}" \
73+ --base ${{ github.ref_name }} \
74+ --head release-${{ steps.version.outputs.new_version }}
0 commit comments