Skip to content

Allow setting auto-merge on created PR/MRs #342

@ananace

Description

@ananace

At the moment, there's no way to enable automatic merge on the PR/MRs created by modulesync.

It would be nice if there was a --pr-automerge - or similar - option to support this use-case.

On GitHub this seems to still require using the GraphQL API, so probably something like;

pr = @api.create_pull_request(repo_path,
                              target_branch,
                              source_branch,
                              title,
                              message)
if pr_automerge
  gql_string = "mutation { enablePullRequestAutoMerge(input: { pullRequestId: \"#{pr.id}\", mergeMethod: MERGE }) }"
  @api.post('/graphql', { query: gql_string }.to_json)
end

GitLab has the API exposed already;

mr = @api.create_merge_request(repo_path,
                               title,
                               source_branch: source_branch,
                               target_branch: target_branch,
                               labels: labels)
@api.accept_merge_request(repo_path, mr.iid, auto_merge: true) if pr_automerge

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions