Skip to content

Commit 8fd5d5d

Browse files
committed
Refactor auto-merge step in build-and-release workflow to use dedicated action for improved clarity and maintainability
Signed-off-by: Lee Calcote <[email protected]>
1 parent 4706f1e commit 8fd5d5d

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

.github/workflows/build-and-release.yml

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -129,17 +129,11 @@ jobs:
129129
labels: academy
130130
delete-branch: true
131131

132-
- name: Auto-merge PR in meshery-cloud repo
133-
if: github.event.inputs.version != ''
134-
run: |
135-
PR_NUMBER="${{ steps.cpr.outputs.pull-request-number }}"
136-
if [ -n "$PR_NUMBER" ] && [ "$PR_NUMBER" != "null" ] && [ "$PR_NUMBER" != "" ]; then
137-
echo "Auto-merging PR #$PR_NUMBER"
138-
gh pr merge "$PR_NUMBER" --merge --repo layer5io/meshery-cloud --delete-branch
139-
echo "Successfully merged PR #$PR_NUMBER"
140-
else
141-
echo "No PR number found, skipping auto-merge."
142-
exit 1
143-
fi
144-
env:
145-
GH_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
132+
- name: Enable auto-merge for PR in meshery-cloud repo
133+
if: github.event.inputs.version != '' && steps.cpr.outputs.pull-request-number != ''
134+
uses: peter-evans/enable-pull-request-automerge@v3
135+
with:
136+
token: ${{ secrets.GH_ACCESS_TOKEN }}
137+
pull-request-number: ${{ steps.cpr.outputs.pull-request-number }}
138+
merge-method: merge
139+
repository: layer5io/meshery-cloud

0 commit comments

Comments
 (0)