@@ -17,6 +17,9 @@ concurrency:
17
17
group : ${{ github.workflow }}-${{ inputs.branch_name }}
18
18
cancel-in-progress : true
19
19
20
+ env :
21
+ POETRY_VERSION : 2.1.2
22
+
20
23
jobs :
21
24
sync :
22
25
name : Sync PR
@@ -43,12 +46,37 @@ jobs:
43
46
repository : HumanSignal/actions-hub
44
47
path : ./.github/actions-hub
45
48
49
+ - name : Team details
50
+ id : team_details
51
+ uses : ./.github/actions-hub/actions/team-details
52
+ with :
53
+ jira-server : " ${{ vars.JIRA_SERVER }}"
54
+ jira-username : " ${{ secrets.JIRA_USERNAME }}"
55
+ jira-token : " ${{ secrets.JIRA_TOKEN }}"
56
+ github_token : " ${{ secrets.GIT_PAT }}"
57
+ continue-on-error : true
58
+
59
+ - name : Git Configure
60
+ uses : ./.github/actions-hub/actions/git-configure
61
+ with :
62
+ username : " ${{ steps.team_details.outputs.github-username }}"
63
+
64
+ - name : Get Upstream PRs
65
+ uses : ./.github/actions-hub/actions/follow-merge-upstream-prs
66
+ id : upstream-prs
67
+ with :
68
+ branch_name : " ${{ inputs.branch_name }}"
69
+ poetry_repositories : " label-studio-sdk"
70
+ infra_repositories : " "
71
+ github_token : " ${{ secrets.GIT_PAT }}"
72
+
46
73
- name : Find or Create branch
47
74
uses : ./.github/actions-hub/actions/github-find-or-create-branch
48
75
id : get-branch
49
76
with :
50
77
github_token : ${{ secrets.GIT_PAT }}
51
- branch_name : " ${{ inputs.branch_name }}"
78
+ base_branch_name : " ${{ steps.upstream-prs.outputs.base_branch_name }}"
79
+ branch_name : " ${{ steps.upstream-prs.outputs.branch_name }}"
52
80
53
81
- name : Checkout
54
82
uses : actions/checkout@v4
64
92
repository : HumanSignal/actions-hub
65
93
path : ./.github/actions-hub
66
94
67
- - name : Get Upstream PRs
68
- uses : ./.github/actions-hub/actions/follow-merge-upstream-prs
69
- id : upstream-prs
70
- with :
71
- branch_name : " ${{ inputs.branch_name }}"
72
- poetry_repositories : " label-studio-sdk"
73
- infra_repositories : " "
74
- github_token : " ${{ secrets.GIT_PAT }}"
75
-
76
- - name : Git Configure
77
- uses : ./.github/actions-hub/actions/git-configure
78
- with :
79
- username : ${{ github.event.client_payload.actor || steps.upstream-prs.outputs.author_username }}
80
-
81
- - name : Git Merge
82
- id : merge
83
- continue-on-error : true
84
- uses : ./.github/actions-hub/actions/git-merge
85
- with :
86
- base_branch : ${{ steps.upstream-prs.outputs.base_branch_name }}
87
- head_branch : ${{ steps.get-branch.outputs.branch_name }}
88
- our_files : " pyproject.toml poetry.lock web/package.json web/yarn.lock"
89
-
90
95
- name : " Install poetry"
91
- env :
92
- POETRY_VERSION : ${{ vars.POETRY_VERSION }}
93
- run : pipx install "poetry==${POETRY_VERSION}"
96
+ run : pipx install "poetry==${{ env.POETRY_VERSION }}"
94
97
95
98
- name : " Set up Python"
96
99
id : setup_python
@@ -119,6 +122,15 @@ jobs:
119
122
git status -s
120
123
git commit --allow-empty -m "${COMMIT_MESSAGE}" -m "${COMMIT_MESSAGE_WORKFLOW_LINK}"
121
124
125
+ - name : Git Merge
126
+ id : merge
127
+ continue-on-error : true
128
+ uses : ./.github/actions-hub/actions/git-merge
129
+ with :
130
+ base_branch : ${{ steps.upstream-prs.outputs.base_branch_name }}
131
+ head_branch : ${{ steps.get-branch.outputs.branch_name }}
132
+ our_files : " pyproject.toml poetry.lock web/package.json web/yarn.lock"
133
+
122
134
- name : Git Push
123
135
uses : ./.github/actions-hub/actions/git-push
124
136
@@ -150,27 +162,12 @@ jobs:
150
162
pullrequest_number : " ${{ steps.get-pr.outputs.number }}"
151
163
labels : " FM Stale"
152
164
153
- - name : Merge Stale PR (Dry run)
154
- if : steps.upstream-prs.outputs.status == 'stale'
155
- continue-on-error : true
156
- shell : bash
157
- env :
158
- GIT_PAT : ${{ secrets.GIT_PAT }}
159
- BRANCH_NAME : " origin/${{ steps.get-branch.outputs.branch_name }}"
160
- BASE_BRANCH_NAME : " origin/${{ steps.upstream-prs.outputs.base_branch_name }}"
161
- run : |
162
- if git diff --quiet "${BASE_BRANCH_NAME}..${BRANCH_NAME}"; then
163
- echo "No changes detected."
164
- else
165
- echo "Changes detected in PR."
166
- fi
167
-
168
165
- name : Convert to ready for review
169
- if : steps.upstream-prs.outputs.status == 'merged'
166
+ if : steps.upstream-prs.outputs.status == 'merged' || steps.upstream-prs.outputs.status == 'stale'
170
167
id : ready-for-review-pr
171
168
shell : bash
172
169
env :
173
- GIT_PAT : ${{ secrets.GIT_PAT }}
170
+ GIT_PAT : " ${{ secrets.GIT_PAT }}"
174
171
run : |
175
172
echo "$GIT_PAT" | gh auth login --with-token
176
173
gh api graphql -F id='${{ steps.get-pr.outputs.node_id }}' -f query='
@@ -183,6 +180,26 @@ jobs:
183
180
}
184
181
'
185
182
183
+ - name : Merge Stale PR
184
+ if : steps.upstream-prs.outputs.status == 'stale'
185
+ continue-on-error : true
186
+ shell : bash
187
+ env :
188
+ GIT_PAT : " ${{ secrets.GIT_PAT }}"
189
+ BRANCH_NAME : " origin/${{ steps.get-branch.outputs.branch_name }}"
190
+ BASE_BRANCH_NAME : " origin/${{ steps.upstream-prs.outputs.base_branch_name }}"
191
+ PR_NUMBER : " ${{ steps.get-pr.outputs.number }}"
192
+ TITLE : " ${{ steps.get-pr.outputs.title }}"
193
+ run : |
194
+ if git diff --quiet "${BASE_BRANCH_NAME}..${BRANCH_NAME}"; then
195
+ echo "No changes detected."
196
+ echo "Merging PR as a Stale."
197
+ echo "$GIT_PAT" | gh auth login --with-token
198
+ gh pr merge "${PR_NUMBER}" --squash --admin --subject "${TITLE} (stale) (#${PR_NUMBER})"
199
+ else
200
+ echo "Changes detected in PR."
201
+ fi
202
+
186
203
- name : Enable AutoMerge
187
204
if : steps.upstream-prs.outputs.status == 'merged'
188
205
continue-on-error : true
0 commit comments