Skip to content

Commit 26ae232

Browse files
Srihari1192openshift-merge-robot
authored andcommitted
Release workflow opens PR with changes
1 parent c2a1e2d commit 26ae232

File tree

1 file changed

+31
-2
lines changed

1 file changed

+31
-2
lines changed

.github/workflows/instascale-release.yml

+31-2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ jobs:
2828
permissions:
2929
contents: write
3030

31+
env:
32+
PR_BRANCH: update-release-${{ github.event.inputs.tag }}
33+
3134
steps:
3235
- uses: actions/checkout@v3
3336

@@ -76,11 +79,38 @@ jobs:
7679
make image-push -e IMG=quay.io/${{ github.event.inputs.quay-organization }}/instascale-controller:stable
7780
7881
# Update dependencies
79-
- name: Commit go.mod and go.sum changes back to repository
82+
- name: Commit go.mod and go.sum changes to the branch
8083
uses: stefanzweifel/git-auto-commit-action@v4
8184
with:
8285
commit_message: Update go.mod and go.sum to MCAD ${{ github.event.inputs.mcad-version }}
8386
file_pattern: 'go.mod go.sum'
87+
create_branch: true
88+
branch: ${{ env.PR_BRANCH }}
89+
90+
- name: Create a Pull request with code changes
91+
run: |
92+
if git branch -a | grep "${{ env.PR_BRANCH }}"; then
93+
GIT_BRANCH=${GITHUB_REF#refs/heads/}
94+
gh pr create --base "$GIT_BRANCH" --fill --head "${{ env.PR_BRANCH }}" --label "lgtm" --label "approved"
95+
fi
96+
env:
97+
GITHUB_TOKEN: ${{ secrets.CODEFLARE_MACHINE_ACCOUNT_TOKEN }}
98+
99+
- name: Wait for PR to merge
100+
run: |
101+
if git branch -a | grep "${{ env.PR_BRANCH }}"; then
102+
timeout 3600 bash -c 'until [[ $(gh pr view '${{ env.PR_BRANCH }}' --json state --jq .state) == "MERGED" ]]; do sleep 5 && echo "$(gh pr view '${{ env.PR_BRANCH }}' --json state --jq .state)"; done'
103+
fi
104+
env:
105+
GITHUB_TOKEN: ${{ github.TOKEN }}
106+
107+
- name: Delete the PR branch
108+
run: |
109+
if git branch -a | grep "${{ env.PR_BRANCH }}"; then
110+
git push origin --delete "${{ env.PR_BRANCH }}"
111+
fi
112+
env:
113+
GITHUB_TOKEN: ${{ secrets.CODEFLARE_MACHINE_ACCOUNT_TOKEN }}
84114

85115
# Create a release in InstaScale
86116
- name: Creates a release in GitHub
@@ -89,4 +119,3 @@ jobs:
89119
env:
90120
GITHUB_TOKEN: ${{ github.TOKEN }}
91121
shell: bash
92-

0 commit comments

Comments
 (0)