Use the person triggering the release workflow as the conductor
This commit is contained in:
parent
b386fd4443
commit
81827d3fc6
2 changed files with 11 additions and 13 deletions
21
.github/update-release-branch.py
vendored
21
.github/update-release-branch.py
vendored
|
|
@ -30,7 +30,7 @@ def branch_exists_on_remote(branch_name):
|
||||||
return run_git('ls-remote', '--heads', ORIGIN, branch_name).strip() != ''
|
return run_git('ls-remote', '--heads', ORIGIN, branch_name).strip() != ''
|
||||||
|
|
||||||
# Opens a PR from the given branch to the release branch
|
# Opens a PR from the given branch to the release branch
|
||||||
def open_pr(repo, all_commits, short_main_sha, new_branch_name, source_branch, target_branch):
|
def open_pr(repo, all_commits, short_main_sha, new_branch_name, source_branch, target_branch, conductor):
|
||||||
# Sort the commits into the pull requests that introduced them,
|
# Sort the commits into the pull requests that introduced them,
|
||||||
# and any commits that don't have a pull request
|
# and any commits that don't have a pull request
|
||||||
pull_requests = []
|
pull_requests = []
|
||||||
|
|
@ -54,7 +54,6 @@ def open_pr(repo, all_commits, short_main_sha, new_branch_name, source_branch, t
|
||||||
body = []
|
body = []
|
||||||
body.append('Merging ' + short_main_sha + ' into ' + target_branch)
|
body.append('Merging ' + short_main_sha + ' into ' + target_branch)
|
||||||
|
|
||||||
conductor = get_conductor(repo, pull_requests, commits_without_pull_requests)
|
|
||||||
body.append('')
|
body.append('')
|
||||||
body.append('Conductor for this PR is @' + conductor)
|
body.append('Conductor for this PR is @' + conductor)
|
||||||
|
|
||||||
|
|
@ -93,15 +92,6 @@ def open_pr(repo, all_commits, short_main_sha, new_branch_name, source_branch, t
|
||||||
pr.add_to_assignees(conductor)
|
pr.add_to_assignees(conductor)
|
||||||
print('Assigned PR to ' + conductor)
|
print('Assigned PR to ' + conductor)
|
||||||
|
|
||||||
# Gets the person who should be in charge of the mergeback PR
|
|
||||||
def get_conductor(repo, pull_requests, other_commits):
|
|
||||||
# If there are any PRs then use whoever merged the last one
|
|
||||||
if len(pull_requests) > 0:
|
|
||||||
return get_merger_of_pr(repo, pull_requests[-1])
|
|
||||||
|
|
||||||
# Otherwise take the author of the latest commit
|
|
||||||
return other_commits[-1].author.login
|
|
||||||
|
|
||||||
# Gets a list of the SHAs of all commits that have happened on main
|
# Gets a list of the SHAs of all commits that have happened on main
|
||||||
# since the release branched off.
|
# since the release branched off.
|
||||||
# This will not include any commits that exist on the release branch
|
# This will not include any commits that exist on the release branch
|
||||||
|
|
@ -196,6 +186,12 @@ def main():
|
||||||
required=True,
|
required=True,
|
||||||
help='The branch being merged into, typically "v2" for a v2 release or "v1" for a v1 release.'
|
help='The branch being merged into, typically "v2" for a v2 release or "v1" for a v1 release.'
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
'--conductor',
|
||||||
|
type=str,
|
||||||
|
required=True,
|
||||||
|
help='The GitHub handle of the person who is conducting the release process.'
|
||||||
|
)
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
|
@ -245,7 +241,8 @@ def main():
|
||||||
short_main_sha,
|
short_main_sha,
|
||||||
new_branch_name,
|
new_branch_name,
|
||||||
source_branch=args.source_branch,
|
source_branch=args.source_branch,
|
||||||
target_branch=args.target_branch
|
target_branch=args.target_branch,
|
||||||
|
conductor=args.conductor
|
||||||
)
|
)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
||||||
3
.github/workflows/update-release-branch.yml
vendored
3
.github/workflows/update-release-branch.yml
vendored
|
|
@ -33,4 +33,5 @@ jobs:
|
||||||
--github-token ${{ secrets.GITHUB_TOKEN }} \
|
--github-token ${{ secrets.GITHUB_TOKEN }} \
|
||||||
--repository-nwo ${{ github.repository }} \
|
--repository-nwo ${{ github.repository }} \
|
||||||
--source-branch main \
|
--source-branch main \
|
||||||
--target-branch v1
|
--target-branch v1 \
|
||||||
|
--conductor ${GITHUB_ACTOR}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue