Skip to content

'endpoint_provider' value has no field or method 'post_issue_comment' #135

@politician

Description

@politician

I would like to post a comment on the initial pull request after it's been merged in the SoT repo.

My copy.bara.sky:

github_api_obj = git.github_api("politician/test2", checker = None)

core.workflow(
    name = "pr",
    origin = git.github_pr_origin(
        url = "git@github.com:politician/test2.git",
        branch = "main",
    ),
    destination = git.github_pr_destination(
        url = "git@github.com:politician/test.git",
        destination_ref = "main",
        integrates = [],
    ),
    origin_files = glob(["**"]),
    authoring = authoring.pass_thru(default = "Github Actions <actions@github.com>"),
    mode = "CHANGE_REQUEST",
    set_rev_id = False,
    transformations = [
        metadata.save_author("ORIGINAL_AUTHOR"),
        metadata.expose_label("GITHUB_PR_NUMBER", new_name = "Closes", separator = " politician/test2#"),
    ],
)

core.workflow(
    name = "push",
    origin = git.origin(
        url = "file:///usr/src/app",
        ref = "main",
    ),
    destination = git.github_destination(
        url = "git@github.com:politician/test2.git",
        push = "main",
    ),
    origin_files = glob(["**"]),
    authoring = authoring.pass_thru(default = "Github Actions <actions@github.com>"),
    mode = "ITERATIVE",
    transformations = [
        metadata.restore_author("ORIGINAL_AUTHOR", search_all_changes = True),
        metadata.expose_label("COPYBARA_INTEGRATE_REVIEW"),
    ],
    after_workflow = [
        github_api_obj.post_issue_comment("GITHUB_PR_NUMBER", "This pull request has been merged from another repository."),
    ],
)

Then I get the error Error: 'endpoint_provider' value has no field or method 'post_issue_comment' when running the push workflow.

Could you please tell me where and how I am supposed to use it to achieve the desired behaviour? Also, I don't need it to run it if there is no label GITHUB_PR_NUMBER defined

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions