Skip to content

Commit 9c0136d

Browse files
chore(ci): Fix update-platform-branch to properly set platform.branch and update PR details (#342)
Updates the CI workflow that syncs platform.branch by ensuring PR bodies include protocol release notes and that existing PRs get updated instead of only creating new ones. Properly set the platform.branch. Changes: Add a step to fetch protocol release notes and write a pr_body.txt. Add a step to edit an existing PR’s title/body when one already exists. Move PR body generation earlier so both “edit PR” and “create PR” share it. Fix how were setting the platform.branch #308
1 parent 69d6a53 commit 9c0136d

1 file changed

Lines changed: 21 additions & 4 deletions

File tree

.github/workflows/update-platform-branch.yaml

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ jobs:
8989
if: steps.check-update.outputs.no_updates != 'true'
9090
id: update-platform-branch
9191
run: |
92-
find . -name "pom.xml" -exec sed -i.bak "s|<platform.branch>.*</platform.branch>|<platform.branch>${LATEST_TAG}</platform.branch>|g" {} \;
92+
find . -name "pom.xml" -exec sed -i.bak "s|<platform.branch>.*</platform.branch>|<platform.branch>protocol/go/${LATEST_TAG}</platform.branch>|g" {} \;
9393
CHANGED_FILES=$(find . -name "pom.xml" -exec diff -u {} {}.bak \;)
9494
if [ -z "$CHANGED_FILES" ]; then
9595
echo "No changes detected in pom.xml files." | tee -a $GITHUB_STEP_SUMMARY
@@ -137,11 +137,11 @@ jobs:
137137
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
138138
BRANCH_NAME: update-platform-branch
139139

140-
- name: Create New PR
141-
if: steps.check-pr.outputs.EXISTING_PR == '' && steps.update-platform-branch.outputs.changes == 'true'
140+
141+
- name: Get protocol release notes
142+
if: steps.update-platform-branch.outputs.changes == 'true'
142143
env:
143144
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
144-
BRANCH_NAME: update-platform-branch
145145
run: |
146146
RELEASE_NOTES=$(gh release view protocol/go/$LATEST_TAG --repo opentdf/platform --json body --jq '.body')
147147
cat <<EOF > pr_body.txt
@@ -152,6 +152,23 @@ jobs:
152152
Release Notes:
153153
$RELEASE_NOTES
154154
EOF
155+
156+
- name: Update existing PR Title and description
157+
if: steps.check-pr.outputs.EXISTING_PR != '' && steps.update-platform-branch.outputs.changes == 'true'
158+
env:
159+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
160+
BRANCH_NAME: update-platform-branch
161+
run: |
162+
gh pr edit ${{ steps.check-pr.outputs.EXISTING_PR }} \
163+
--title "fix(sdk): Updates to proto version $LATEST_TAG" \
164+
--body-file pr_body.txt
165+
166+
- name: Create New PR
167+
if: steps.check-pr.outputs.EXISTING_PR == '' && steps.update-platform-branch.outputs.changes == 'true'
168+
env:
169+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
170+
BRANCH_NAME: update-platform-branch
171+
run: |
155172
gh pr create \
156173
--title "fix(sdk): Updates to proto version $LATEST_TAG" \
157174
--body-file pr_body.txt \

0 commit comments

Comments
 (0)