Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Suyu
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
many-archive
Suyu
Commits
ab8d1223
There was an error fetching the commit references. Please try again later.
Commit
ab8d1223
authored
5 years ago
by
Zach Hilman
Browse files
Options
Downloads
Patches
Plain Diff
ci: Add private mergebot script
Uses Azure instead of GitHub
parent
376f1a44
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
.ci/scripts/merge/apply-patches-by-label-private.py
+41
-0
41 additions, 0 deletions
.ci/scripts/merge/apply-patches-by-label-private.py
with
41 additions
and
0 deletions
.ci/scripts/merge/apply-patches-by-label-private.py
0 → 100644
+
41
−
0
View file @
ab8d1223
# Download all pull requests as patches that match a specific label
# Usage: python download-patches-by-label.py <Label to Match> <Root Path Folder to DL to>
import
requests
,
sys
,
json
,
urllib3
.
request
,
shutil
,
subprocess
,
os
,
traceback
org
=
os
.
getenv
(
"
PrivateMergeOrg
"
.
upper
(),
"
yuzu-emu
"
)
repo
=
os
.
getenv
(
"
PrivateMergeRepo
"
.
upper
(),
"
yuzu-private
"
)
tagline
=
os
.
getenv
(
"
MergeTaglinePrivate
"
.
upper
(),
""
)
user
=
sys
.
argv
[
1
]
http
=
urllib3
.
PoolManager
()
dl_list
=
{}
def
check_individual
(
repo_id
,
pr_id
):
url
=
'
https://%sdev.azure.com/%s/%s/_apis/git/repositories/%s/pullRequests/%s/labels?api-version=5.1-preview.1
'
%
(
user
,
org
,
repo
,
repo_id
,
pr_id
)
response
=
requests
.
get
(
url
)
if
(
response
.
ok
):
j
=
json
.
loads
(
response
.
content
)
for
tg
in
j
[
'
value
'
]:
if
(
tg
[
'
name
'
]
==
sys
.
argv
[
2
]):
return
True
return
False
try
:
url
=
'
https://%sdev.azure.com/%s/%s/_apis/git/pullrequests?api-version=5.1
'
%
(
user
,
org
,
repo
)
response
=
requests
.
get
(
url
)
if
(
response
.
ok
):
j
=
json
.
loads
(
response
.
content
)
for
pr
in
j
[
"
value
"
]:
repo_id
=
pr
[
'
repository
'
][
'
id
'
]
pr_id
=
pr
[
'
pullRequestId
'
]
if
(
check_individual
(
repo_id
,
pr_id
)):
pn
=
pr_id
ref
=
pr
[
'
sourceRefName
'
]
print
(
"
Matched PR# %s
"
%
pn
)
print
(
subprocess
.
check_output
([
"
git
"
,
"
fetch
"
,
"
https://%sdev.azure.com/%s/_git/%s
"
%
(
user
,
org
,
repo
),
ref
,
"
-f
"
]))
print
(
subprocess
.
check_output
([
"
git
"
,
"
merge
"
,
"
--squash
"
,
'
origin/
'
+
ref
.
replace
(
'
refs/heads/
'
,
''
)]))
print
(
subprocess
.
check_output
([
"
git
"
,
"
commit
"
,
"
-m
\"
Merge %s PR %s
\"
"
%
(
tagline
,
pn
)]))
except
:
traceback
.
print_exc
(
file
=
sys
.
stdout
)
sys
.
exit
(
-
1
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment