Skip to content

Commit 75d28cc

Browse files
authored
Merge pull request #97 from TencentCloud/hotfix/sync-workflow-run
fix(ci): trigger Sync Main Into Develop via workflow_run
2 parents 5276dee + b228ed3 commit 75d28cc

1 file changed

Lines changed: 19 additions & 4 deletions

File tree

.github/workflows/sync-main-to-develop.yml

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
name: Sync Main Into Develop
22

3-
# After a GitHub Release is published (Release workflow: PyPI → github-release),
4-
# open a main → develop sync PR and merge it when possible.
3+
# After Release succeeds, sync main → develop.
4+
#
5+
# Do NOT rely only on `release: published`: when the Release workflow creates a
6+
# GitHub Release with GITHUB_TOKEN, GitHub does not start other `release`
7+
# workflows. `workflow_run` does fire for GITHUB_TOKEN-triggered workflows.
8+
# `workflow_dispatch` allows a manual catch-up from the Actions tab.
59
on:
10+
workflow_run:
11+
workflows:
12+
- Release
13+
types:
14+
- completed
15+
workflow_dispatch:
616
release:
717
types:
818
- published
@@ -14,7 +24,12 @@ permissions:
1424
jobs:
1525
sync:
1626
name: Sync main into develop
17-
if: startsWith(github.event.release.tag_name, 'v')
27+
if: >
28+
github.event_name == 'workflow_dispatch' ||
29+
(github.event_name == 'release' && startsWith(github.event.release.tag_name, 'v')) ||
30+
(github.event_name == 'workflow_run' &&
31+
github.event.workflow_run.conclusion == 'success' &&
32+
startsWith(github.event.workflow_run.head_branch, 'v'))
1833
runs-on: ubuntu-latest
1934
steps:
2035
- name: Checkout
@@ -25,7 +40,7 @@ jobs:
2540
- name: Open or merge sync PR
2641
env:
2742
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28-
TAG: ${{ github.event.release.tag_name }}
43+
TAG: ${{ github.event.release.tag_name || github.event.workflow_run.head_branch || 'manual' }}
2944
run: |
3045
set -euo pipefail
3146
version="${TAG#v}"

0 commit comments

Comments
 (0)