Skip to content

Commit 2964eee

Browse files
committed
fix(autoupdate): wait for pr-checks before merge, dispatch deploy after merge
1 parent d945662 commit 2964eee

1 file changed

Lines changed: 26 additions & 9 deletions

File tree

.github/workflows/autoupdate.yml

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
update:
1919
name: Autoupdate dependencies
2020
runs-on: ubuntu-latest
21-
timeout-minutes: 30
21+
timeout-minutes: 60
2222
env:
2323
SERVICE_ACCOUNT: ${{ secrets.SERVICE_ACCOUNT }}
2424
GOOGLE_APPLICATION_CREDENTIALS: ${{ github.workspace }}/serviceAccount.json
@@ -128,14 +128,6 @@ jobs:
128128
--assignee siarheidudko \
129129
--reviewer siarheidudko)
130130
echo "pr_url=$PR_URL" >> "$GITHUB_OUTPUT"
131-
- name: Enable auto-merge on success PR
132-
if: steps.pr_success.outputs.pr_url != ''
133-
env:
134-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
135-
PR_URL: ${{ steps.pr_success.outputs.pr_url }}
136-
run: |
137-
gh api repos/${{ github.repository }} --method PATCH -f allow_auto_merge=true || true
138-
gh pr merge "$PR_URL" --auto --squash || true
139131
- name: Open PR (autoupdater failed)
140132
id: pr_failure
141133
if: steps.autoupdate.outcome == 'failure' && steps.diff.outputs.has_diff == 'true'
@@ -172,6 +164,31 @@ jobs:
172164
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
173165
run: |
174166
gh workflow run pr-checks.yml --ref "$AUTOUPDATE_BRANCH" || true
167+
- name: Wait for PR checks and merge (autoupdater succeeded)
168+
id: merge_pr
169+
if: steps.pr_success.outputs.pr_url != ''
170+
continue-on-error: true
171+
env:
172+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
173+
PR_URL: ${{ steps.pr_success.outputs.pr_url }}
174+
run: |
175+
for i in $(seq 1 10); do
176+
COUNT=$(gh pr checks "$PR_URL" 2>/dev/null | grep -c '\S' || true)
177+
[ "$COUNT" -gt 0 ] && break
178+
sleep 30
179+
done
180+
gh pr checks "$PR_URL" --watch
181+
gh pr merge "$PR_URL" --squash --delete-branch
182+
- name: Tag release commit and dispatch deploy
183+
if: steps.merge_pr.outcome == 'success' && steps.pkg.outputs.version != ''
184+
env:
185+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
186+
run: |
187+
git fetch origin main
188+
git tag -f "v${{ steps.pkg.outputs.version }}" "$(git rev-parse origin/main)"
189+
git push --force origin "v${{ steps.pkg.outputs.version }}"
190+
gh workflow run build-and-deploy.yml --ref main \
191+
-f tag="v${{ steps.pkg.outputs.version }}" || true
175192
- name: Dispatch Claude to fix the failed autoupdate
176193
if: steps.pr_failure.outputs.pr_url != ''
177194
env:

0 commit comments

Comments
 (0)