From 27313fc220561ef6b0d5edb485b29684b405c80b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Mon, 6 Feb 2023 11:17:01 +0100 Subject: [PATCH 01/16] Initial GitHub Workflow triggering archery bot --- .github/workflows/pr_bot.yml | 39 ++++++++++++++++++++++++++++++++++++ dev/archery/archery/cli.py | 14 ++++++++++--- 2 files changed, 50 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/pr_bot.yml diff --git a/.github/workflows/pr_bot.yml b/.github/workflows/pr_bot.yml new file mode 100644 index 0000000000000..f43f8cfa72bcd --- /dev/null +++ b/.github/workflows/pr_bot.yml @@ -0,0 +1,39 @@ +name: pr-bot +on: + pull_request: + types: + - opened + - converted_to_draft + - ready_for_review + pull_request_review: + types: + - submitted + push: + +jobs: + run-pr-bot: + permissions: + contents: read + pull-requests: write + runs-on: ubuntu-latest + steps: + - name: Checkout Arrow + uses: actions/checkout@v3 + with: + path: arrow + # fetch the tags for version number generation + fetch-depth: 0 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: 3.8 + - name: Install Archery and Crossbow dependencies + run: pip install -e arrow/dev/archery[bot] + - name: Handle PR workflow event + env: + ARROW_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CROSSBOW_GITHUB_TOKEN: ${{ secrets.CROSSBOW_GITHUB_TOKEN }} + run: | + archery trigger-bot \ + --event-name ${{ github.event_name }} \ + --event-payload ${{ github.event_path }} \ No newline at end of file diff --git a/dev/archery/archery/cli.py b/dev/archery/archery/cli.py index 105a64c0603dc..9d56fb5e7dc23 100644 --- a/dev/archery/archery/cli.py +++ b/dev/archery/archery/cli.py @@ -783,10 +783,18 @@ def integration(with_all=False, random_seed=12345, **args): def trigger_bot(event_name, event_payload, arrow_token): from .bot import CommentBot, actions - event_payload = json.loads(event_payload.read()) + class PullRequestWorkflowBot: + def handle(self, event_name, event_payload): + print(f"PullRequestWorkflowBot handle: {event_name} - {event_payload}") + - bot = CommentBot(name='github-actions', handler=actions, token=arrow_token) - bot.handle(event_name, event_payload) + event_payload = json.loads(event_payload.read()) + if 'comment' in event_name: + bot = CommentBot(name='github-actions', handler=actions, token=arrow_token) + bot.handle(event_name, event_payload) + else: + bot = PullRequestWorkflowBot() + bot.handle(event_name, event_payload) @archery.group("linking") From 0d855f00c2a986f306c5f00757a8415a98d6ff40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Fri, 10 Feb 2023 17:36:59 +0100 Subject: [PATCH 02/16] Implementation of workflow --- dev/archery/archery/bot.py | 123 ++++- dev/archery/archery/cli.py | 12 +- .../archery/tests/fixtures/commit-search.json | 80 +++ .../fixtures/event-pr-review-committer.json | 484 ++++++++++++++++++ .../event-pr-review-non-committer.json | 484 ++++++++++++++++++ ...ent-pull-request-opened-non-committer.json | 445 ++++++++++++++++ .../archery/tests/fixtures/event-push.json | 184 +++++++ .../label-awaiting-change-review.json | 11 + .../fixtures/label-awaiting-changes.json | 11 + .../tests/fixtures/label-awaiting-review.json | 11 + .../pull-request-26-awaiting-review.json | 329 ++++++++++++ dev/archery/archery/tests/test_bot.py | 243 ++++++++- 12 files changed, 2407 insertions(+), 10 deletions(-) create mode 100644 dev/archery/archery/tests/fixtures/commit-search.json create mode 100644 dev/archery/archery/tests/fixtures/event-pr-review-committer.json create mode 100644 dev/archery/archery/tests/fixtures/event-pr-review-non-committer.json create mode 100644 dev/archery/archery/tests/fixtures/event-pull-request-opened-non-committer.json create mode 100644 dev/archery/archery/tests/fixtures/event-push.json create mode 100644 dev/archery/archery/tests/fixtures/label-awaiting-change-review.json create mode 100644 dev/archery/archery/tests/fixtures/label-awaiting-changes.json create mode 100644 dev/archery/archery/tests/fixtures/label-awaiting-review.json create mode 100644 dev/archery/archery/tests/fixtures/pull-request-26-awaiting-review.json diff --git a/dev/archery/archery/bot.py b/dev/archery/archery/bot.py index 6a9b78cf16054..6482edebc4aa0 100644 --- a/dev/archery/archery/bot.py +++ b/dev/archery/archery/bot.py @@ -15,10 +15,11 @@ # specific language governing permissions and limitations # under the License. +import enum import os import shlex from pathlib import Path -from functools import partial +from functools import lru_cache, partial import tempfile import click @@ -29,6 +30,10 @@ from .crossbow import Repo, Queue, Config, Target, Job, CommentReport +def cached_property(fn): + return property(lru_cache(maxsize=1)(fn)) + + class EventError(Exception): pass @@ -82,6 +87,122 @@ def parse_args(self, ctx, args): group = partial(click.group, cls=Group) +LABEL_PREFIX = "awaiting" + + +@enum.unique +class PullRequestState(enum.Enum): + """State of a pull request.""" + + review = f"{LABEL_PREFIX} review" + committer_review = f"{LABEL_PREFIX} comitter review" + changes = f"{LABEL_PREFIX} changes" + change_review = f"{LABEL_PREFIX} change review" + merge = f"{LABEL_PREFIX} merge" + + +COMMITTER_ROLES = {'OWNER', 'MEMBER'} + + +class PullRequestWorkflowBot: + + def __init__(self, event_name, event_payload, token=None): + self.github = github.Github(token) + self.event_name = event_name + self.event_payload = event_payload + + @cached_property + def pull(self): + if self.event_name == 'push': + return self._get_pr_for_commit() + else: + return self.repo.get_pull(self.event_payload['pull_request']['number']) + + @cached_property + def repo(self): + return self.github.get_repo(self.event_payload['repository']['id'], lazy=True) + + def handle(self): + current_state = None + try: + current_state = self.get_current_state() + except EventError: + # In case of error (more than one state) we clear state labels + # only possible if a label has been manually added. + self.clear_current_state() + new_state = self.get_target_state(current_state) + if current_state != new_state.value: + if current_state: + self.clear_current_state() + self.set_state(new_state) + + def get_current_state(self): + states = [label.name for label in self.pull.get_labels() + if label.name.startswith(LABEL_PREFIX)] + if len(states) > 1: + raise EventError(f"PR cannot be on more than one states - {states}") + elif states: + return states[0] + + def clear_current_state(self): + for label in self.pull.get_labels(): + if label.name.startswith(LABEL_PREFIX): + self.pull.remove_from_labels(label) + + def get_target_state(self, current_state): + if (self.event_name == "pull_request" and + self.event_payload['action'] == 'opened'): + if (self.event_payload['pull_request']['author_association'] in + COMMITTER_ROLES): + return PullRequestState.committer_review + else: + return PullRequestState.review + elif (self.event_name == "pull_request_review" and + self.event_payload["action"] == "submitted"): + review_state = self.event_payload["review"]["state"].lower() + is_committer_review = (self.event_payload['review']['author_association'] + in COMMITTER_ROLES) + if not is_committer_review: + # Non-committer reviews cannot change state once committer has already + # reviewed and requested changes. + if current_state in ( + PullRequestState.change_review.value, + PullRequestState.changes.value): + return PullRequestState(current_state) + else: + return PullRequestState.committer_review + if review_state == 'approved': + return PullRequestState.merge + elif review_state in ("changes_requested", "commented"): + return PullRequestState.changes + elif (self.event_name == "push" and + current_state == PullRequestState.changes.value): + return PullRequestState.change_review + # TODO: Test push on awaiting review! + # TODO: Implement case of PRs already opened + return PullRequestState(current_state) + + def set_state(self, state): + self.pull.add_to_labels(state.value) + + def _get_pr_for_commit(self): + """Find the PR containing the specific commit hash.""" + sha = self.event_payload['commits'][-1]['id'] + # TODO: Validate this query is working on PR + prs_for_commit = self.github.search_issues( + "", + qualifiers={"type": "pr", + "repo": "raulcd/arrow", + "sha": sha} + ) + pull = None + try: + pull = self.repo.get_pull(prs_for_commit[0].number) + except IndexError: + pass + return pull + + class CommentBot: def __init__(self, name, handler, token=None): diff --git a/dev/archery/archery/cli.py b/dev/archery/archery/cli.py index 9d56fb5e7dc23..8baada6aa1959 100644 --- a/dev/archery/archery/cli.py +++ b/dev/archery/archery/cli.py @@ -781,20 +781,16 @@ def integration(with_all=False, random_seed=12345, **args): @click.option('--arrow-token', envvar='ARROW_GITHUB_TOKEN', help='OAuth token for responding comment in the arrow repo') def trigger_bot(event_name, event_payload, arrow_token): - from .bot import CommentBot, actions - - class PullRequestWorkflowBot: - def handle(self, event_name, event_payload): - print(f"PullRequestWorkflowBot handle: {event_name} - {event_payload}") - + from .bot import CommentBot, PullRequestWorkflowBot, actions event_payload = json.loads(event_payload.read()) if 'comment' in event_name: bot = CommentBot(name='github-actions', handler=actions, token=arrow_token) bot.handle(event_name, event_payload) else: - bot = PullRequestWorkflowBot() - bot.handle(event_name, event_payload) + # TODO: Make API for both classes more consistent + bot = PullRequestWorkflowBot(event_name, event_payload, token=arrow_token) + bot.handle() @archery.group("linking") diff --git a/dev/archery/archery/tests/fixtures/commit-search.json b/dev/archery/archery/tests/fixtures/commit-search.json new file mode 100644 index 0000000000000..e064163191f78 --- /dev/null +++ b/dev/archery/archery/tests/fixtures/commit-search.json @@ -0,0 +1,80 @@ +{ + "total_count": 1, + "incomplete_results": false, + "items": [ + { + "url": "https://api.github.com/repos/raulcd/arrow/issues/74", + "repository_url": "https://api.github.com/repos/raulcd/arrow", + "labels_url": "https://api.github.com/repos/raulcd/arrow/issues/74/labels{/name}", + "comments_url": "https://api.github.com/repos/raulcd/arrow/issues/74/comments", + "events_url": "https://api.github.com/repos/raulcd/arrow/issues/74/events", + "html_url": "https://github.com/raulcd/arrow/pull/74", + "id": 1572348024, + "node_id": "PR_kwDOHHgT285JU-KQ", + "number": 74, + "title": "Pr workflow automation poc", + "user": { + "login": "raulcd", + "id": 639755, + "node_id": "MDQ6VXNlcjYzOTc1NQ==", + "avatar_url": "https://avatars.githubusercontent.com/u/639755?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/raulcd", + "html_url": "https://github.com/raulcd", + "followers_url": "https://api.github.com/users/raulcd/followers", + "following_url": "https://api.github.com/users/raulcd/following{/other_user}", + "gists_url": "https://api.github.com/users/raulcd/gists{/gist_id}", + "starred_url": "https://api.github.com/users/raulcd/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/raulcd/subscriptions", + "organizations_url": "https://api.github.com/users/raulcd/orgs", + "repos_url": "https://api.github.com/users/raulcd/repos", + "events_url": "https://api.github.com/users/raulcd/events{/privacy}", + "received_events_url": "https://api.github.com/users/raulcd/received_events", + "type": "User", + "site_admin": false + }, + "labels": [ + + ], + "state": "open", + "locked": false, + "assignee": null, + "assignees": [ + + ], + "milestone": null, + "comments": 1, + "created_at": "2023-02-06T10:56:32Z", + "updated_at": "2023-02-10T11:30:31Z", + "closed_at": null, + "author_association": "OWNER", + "active_lock_reason": null, + "draft": true, + "pull_request": { + "url": "https://api.github.com/repos/raulcd/arrow/pulls/74", + "html_url": "https://github.com/raulcd/arrow/pull/74", + "diff_url": "https://github.com/raulcd/arrow/pull/74.diff", + "patch_url": "https://github.com/raulcd/arrow/pull/74.patch", + "merged_at": null + }, + "body": "\r\n\r\n### Rationale for this change\r\n\r\n\r\n\r\n### What changes are included in this PR?\r\n\r\n\r\n\r\n### Are these changes tested?\r\n\r\n\r\n\r\n### Are there any user-facing changes?\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n", + "reactions": { + "url": "https://api.github.com/repos/raulcd/arrow/issues/74/reactions", + "total_count": 0, + "+1": 0, + "-1": 0, + "laugh": 0, + "hooray": 0, + "confused": 0, + "heart": 0, + "rocket": 0, + "eyes": 0 + }, + "timeline_url": "https://api.github.com/repos/raulcd/arrow/issues/74/timeline", + "performed_via_github_app": null, + "state_reason": null, + "score": 1.0 + } + ] + } + \ No newline at end of file diff --git a/dev/archery/archery/tests/fixtures/event-pr-review-committer.json b/dev/archery/archery/tests/fixtures/event-pr-review-committer.json new file mode 100644 index 0000000000000..0022ced8a4f32 --- /dev/null +++ b/dev/archery/archery/tests/fixtures/event-pr-review-committer.json @@ -0,0 +1,484 @@ +{ + "action": "submitted", + "number": 26, + "pull_request": { + "url": "https://api.github.com/repos/ursa-labs/ursabot/pulls/26", + "id": 267785552, + "node_id": "MDExOlB1bGxSZXF1ZXN0MjY3Nzg1NTUy", + "html_url": "https://github.com/ursa-labs/ursabot/pull/26", + "diff_url": "https://github.com/ursa-labs/ursabot/pull/26.diff", + "patch_url": "https://github.com/ursa-labs/ursabot/pull/26.patch", + "issue_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/26", + "number": 26, + "state": "open", + "locked": false, + "title": "Unittests for GithubHook", + "user": { + "login": "kszucs", + "id": 961747, + "node_id": "MDQ6VXNlcjk2MTc0Nw==", + "avatar_url": "https://avatars1.githubusercontent.com/u/961747?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/kszucs", + "html_url": "https://github.com/kszucs", + "followers_url": "https://api.github.com/users/kszucs/followers", + "following_url": "https://api.github.com/users/kszucs/following{/other_user}", + "gists_url": "https://api.github.com/users/kszucs/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kszucs/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kszucs/subscriptions", + "organizations_url": "https://api.github.com/users/kszucs/orgs", + "repos_url": "https://api.github.com/users/kszucs/repos", + "events_url": "https://api.github.com/users/kszucs/events{/privacy}", + "received_events_url": "https://api.github.com/users/kszucs/received_events", + "type": "User", + "site_admin": false + }, + "body": "", + "created_at": "2019-04-05T11:22:15Z", + "updated_at": "2019-04-05T12:01:40Z", + "closed_at": null, + "merged_at": null, + "merge_commit_sha": "cc5dc3606988b3824be54df779ed2028776113cb", + "assignee": null, + "assignees": [], + "requested_reviewers": [], + "requested_teams": [], + "labels": [], + "milestone": null, + "commits_url": "https://api.github.com/repos/ursa-labs/ursabot/pulls/26/commits", + "review_comments_url": "https://api.github.com/repos/ursa-labs/ursabot/pulls/26/comments", + "review_comment_url": "https://api.github.com/repos/ursa-labs/ursabot/pulls/comments{/number}", + "comments_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/26/comments", + "statuses_url": "https://api.github.com/repos/ursa-labs/ursabot/statuses/2705da2b616b98fa6010a25813c5a7a27456f71d", + "head": { + "label": "ursa-labs:test-hook", + "ref": "test-hook", + "sha": "2705da2b616b98fa6010a25813c5a7a27456f71d", + "user": { + "login": "ursa-labs", + "id": 46514972, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjQ2NTE0OTcy", + "avatar_url": "https://avatars2.githubusercontent.com/u/46514972?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/ursa-labs", + "html_url": "https://github.com/ursa-labs", + "followers_url": "https://api.github.com/users/ursa-labs/followers", + "following_url": "https://api.github.com/users/ursa-labs/following{/other_user}", + "gists_url": "https://api.github.com/users/ursa-labs/gists{/gist_id}", + "starred_url": "https://api.github.com/users/ursa-labs/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/ursa-labs/subscriptions", + "organizations_url": "https://api.github.com/users/ursa-labs/orgs", + "repos_url": "https://api.github.com/users/ursa-labs/repos", + "events_url": "https://api.github.com/users/ursa-labs/events{/privacy}", + "received_events_url": "https://api.github.com/users/ursa-labs/received_events", + "type": "Organization", + "site_admin": false + }, + "repo": { + "id": 169101701, + "node_id": "MDEwOlJlcG9zaXRvcnkxNjkxMDE3MDE=", + "name": "ursabot", + "full_name": "ursa-labs/ursabot", + "private": false, + "owner": { + "login": "ursa-labs", + "id": 46514972, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjQ2NTE0OTcy", + "avatar_url": "https://avatars2.githubusercontent.com/u/46514972?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/ursa-labs", + "html_url": "https://github.com/ursa-labs", + "followers_url": "https://api.github.com/users/ursa-labs/followers", + "following_url": "https://api.github.com/users/ursa-labs/following{/other_user}", + "gists_url": "https://api.github.com/users/ursa-labs/gists{/gist_id}", + "starred_url": "https://api.github.com/users/ursa-labs/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/ursa-labs/subscriptions", + "organizations_url": "https://api.github.com/users/ursa-labs/orgs", + "repos_url": "https://api.github.com/users/ursa-labs/repos", + "events_url": "https://api.github.com/users/ursa-labs/events{/privacy}", + "received_events_url": "https://api.github.com/users/ursa-labs/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/ursa-labs/ursabot", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/ursa-labs/ursabot", + "forks_url": "https://api.github.com/repos/ursa-labs/ursabot/forks", + "keys_url": "https://api.github.com/repos/ursa-labs/ursabot/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/ursa-labs/ursabot/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/ursa-labs/ursabot/teams", + "hooks_url": "https://api.github.com/repos/ursa-labs/ursabot/hooks", + "issue_events_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/events{/number}", + "events_url": "https://api.github.com/repos/ursa-labs/ursabot/events", + "assignees_url": "https://api.github.com/repos/ursa-labs/ursabot/assignees{/user}", + "branches_url": "https://api.github.com/repos/ursa-labs/ursabot/branches{/branch}", + "tags_url": "https://api.github.com/repos/ursa-labs/ursabot/tags", + "blobs_url": "https://api.github.com/repos/ursa-labs/ursabot/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/ursa-labs/ursabot/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/ursa-labs/ursabot/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/ursa-labs/ursabot/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/ursa-labs/ursabot/statuses/{sha}", + "languages_url": "https://api.github.com/repos/ursa-labs/ursabot/languages", + "stargazers_url": "https://api.github.com/repos/ursa-labs/ursabot/stargazers", + "contributors_url": "https://api.github.com/repos/ursa-labs/ursabot/contributors", + "subscribers_url": "https://api.github.com/repos/ursa-labs/ursabot/subscribers", + "subscription_url": "https://api.github.com/repos/ursa-labs/ursabot/subscription", + "commits_url": "https://api.github.com/repos/ursa-labs/ursabot/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/ursa-labs/ursabot/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/ursa-labs/ursabot/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/ursa-labs/ursabot/contents/{+path}", + "compare_url": "https://api.github.com/repos/ursa-labs/ursabot/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/ursa-labs/ursabot/merges", + "archive_url": "https://api.github.com/repos/ursa-labs/ursabot/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/ursa-labs/ursabot/downloads", + "issues_url": "https://api.github.com/repos/ursa-labs/ursabot/issues{/number}", + "pulls_url": "https://api.github.com/repos/ursa-labs/ursabot/pulls{/number}", + "milestones_url": "https://api.github.com/repos/ursa-labs/ursabot/milestones{/number}", + "notifications_url": "https://api.github.com/repos/ursa-labs/ursabot/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/ursa-labs/ursabot/labels{/name}", + "releases_url": "https://api.github.com/repos/ursa-labs/ursabot/releases{/id}", + "deployments_url": "https://api.github.com/repos/ursa-labs/ursabot/deployments", + "created_at": "2019-02-04T15:40:31Z", + "updated_at": "2019-04-04T17:49:10Z", + "pushed_at": "2019-04-05T12:01:40Z", + "git_url": "git://github.com/ursa-labs/ursabot.git", + "ssh_url": "git@github.com:ursa-labs/ursabot.git", + "clone_url": "https://github.com/ursa-labs/ursabot.git", + "svn_url": "https://github.com/ursa-labs/ursabot", + "homepage": null, + "size": 898, + "stargazers_count": 1, + "watchers_count": 1, + "language": "Jupyter Notebook", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 19, + "license": null, + "forks": 0, + "open_issues": 19, + "watchers": 1, + "default_branch": "master" + } + }, + "base": { + "label": "ursa-labs:master", + "ref": "master", + "sha": "a162ad254b589b924db47e057791191b39613fd5", + "user": { + "login": "ursa-labs", + "id": 46514972, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjQ2NTE0OTcy", + "avatar_url": "https://avatars2.githubusercontent.com/u/46514972?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/ursa-labs", + "html_url": "https://github.com/ursa-labs", + "followers_url": "https://api.github.com/users/ursa-labs/followers", + "following_url": "https://api.github.com/users/ursa-labs/following{/other_user}", + "gists_url": "https://api.github.com/users/ursa-labs/gists{/gist_id}", + "starred_url": "https://api.github.com/users/ursa-labs/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/ursa-labs/subscriptions", + "organizations_url": "https://api.github.com/users/ursa-labs/orgs", + "repos_url": "https://api.github.com/users/ursa-labs/repos", + "events_url": "https://api.github.com/users/ursa-labs/events{/privacy}", + "received_events_url": "https://api.github.com/users/ursa-labs/received_events", + "type": "Organization", + "site_admin": false + }, + "repo": { + "id": 169101701, + "node_id": "MDEwOlJlcG9zaXRvcnkxNjkxMDE3MDE=", + "name": "ursabot", + "full_name": "ursa-labs/ursabot", + "private": false, + "owner": { + "login": "ursa-labs", + "id": 46514972, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjQ2NTE0OTcy", + "avatar_url": "https://avatars2.githubusercontent.com/u/46514972?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/ursa-labs", + "html_url": "https://github.com/ursa-labs", + "followers_url": "https://api.github.com/users/ursa-labs/followers", + "following_url": "https://api.github.com/users/ursa-labs/following{/other_user}", + "gists_url": "https://api.github.com/users/ursa-labs/gists{/gist_id}", + "starred_url": "https://api.github.com/users/ursa-labs/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/ursa-labs/subscriptions", + "organizations_url": "https://api.github.com/users/ursa-labs/orgs", + "repos_url": "https://api.github.com/users/ursa-labs/repos", + "events_url": "https://api.github.com/users/ursa-labs/events{/privacy}", + "received_events_url": "https://api.github.com/users/ursa-labs/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/ursa-labs/ursabot", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/ursa-labs/ursabot", + "forks_url": "https://api.github.com/repos/ursa-labs/ursabot/forks", + "keys_url": "https://api.github.com/repos/ursa-labs/ursabot/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/ursa-labs/ursabot/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/ursa-labs/ursabot/teams", + "hooks_url": "https://api.github.com/repos/ursa-labs/ursabot/hooks", + "issue_events_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/events{/number}", + "events_url": "https://api.github.com/repos/ursa-labs/ursabot/events", + "assignees_url": "https://api.github.com/repos/ursa-labs/ursabot/assignees{/user}", + "branches_url": "https://api.github.com/repos/ursa-labs/ursabot/branches{/branch}", + "tags_url": "https://api.github.com/repos/ursa-labs/ursabot/tags", + "blobs_url": "https://api.github.com/repos/ursa-labs/ursabot/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/ursa-labs/ursabot/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/ursa-labs/ursabot/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/ursa-labs/ursabot/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/ursa-labs/ursabot/statuses/{sha}", + "languages_url": "https://api.github.com/repos/ursa-labs/ursabot/languages", + "stargazers_url": "https://api.github.com/repos/ursa-labs/ursabot/stargazers", + "contributors_url": "https://api.github.com/repos/ursa-labs/ursabot/contributors", + "subscribers_url": "https://api.github.com/repos/ursa-labs/ursabot/subscribers", + "subscription_url": "https://api.github.com/repos/ursa-labs/ursabot/subscription", + "commits_url": "https://api.github.com/repos/ursa-labs/ursabot/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/ursa-labs/ursabot/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/ursa-labs/ursabot/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/ursa-labs/ursabot/contents/{+path}", + "compare_url": "https://api.github.com/repos/ursa-labs/ursabot/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/ursa-labs/ursabot/merges", + "archive_url": "https://api.github.com/repos/ursa-labs/ursabot/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/ursa-labs/ursabot/downloads", + "issues_url": "https://api.github.com/repos/ursa-labs/ursabot/issues{/number}", + "pulls_url": "https://api.github.com/repos/ursa-labs/ursabot/pulls{/number}", + "milestones_url": "https://api.github.com/repos/ursa-labs/ursabot/milestones{/number}", + "notifications_url": "https://api.github.com/repos/ursa-labs/ursabot/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/ursa-labs/ursabot/labels{/name}", + "releases_url": "https://api.github.com/repos/ursa-labs/ursabot/releases{/id}", + "deployments_url": "https://api.github.com/repos/ursa-labs/ursabot/deployments", + "created_at": "2019-02-04T15:40:31Z", + "updated_at": "2019-04-04T17:49:10Z", + "pushed_at": "2019-04-05T12:01:40Z", + "git_url": "git://github.com/ursa-labs/ursabot.git", + "ssh_url": "git@github.com:ursa-labs/ursabot.git", + "clone_url": "https://github.com/ursa-labs/ursabot.git", + "svn_url": "https://github.com/ursa-labs/ursabot", + "homepage": null, + "size": 898, + "stargazers_count": 1, + "watchers_count": 1, + "language": "Jupyter Notebook", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 19, + "license": null, + "forks": 0, + "open_issues": 19, + "watchers": 1, + "default_branch": "master" + } + }, + "_links": { + "self": { + "href": "https://api.github.com/repos/ursa-labs/ursabot/pulls/26" + }, + "html": { + "href": "https://github.com/ursa-labs/ursabot/pull/26" + }, + "issue": { + "href": "https://api.github.com/repos/ursa-labs/ursabot/issues/26" + }, + "comments": { + "href": "https://api.github.com/repos/ursa-labs/ursabot/issues/26/comments" + }, + "review_comments": { + "href": "https://api.github.com/repos/ursa-labs/ursabot/pulls/26/comments" + }, + "review_comment": { + "href": "https://api.github.com/repos/ursa-labs/ursabot/pulls/comments{/number}" + }, + "commits": { + "href": "https://api.github.com/repos/ursa-labs/ursabot/pulls/26/commits" + }, + "statuses": { + "href": "https://api.github.com/repos/ursa-labs/ursabot/statuses/2705da2b616b98fa6010a25813c5a7a27456f71d" + } + }, + "author_association": "COLLABORATOR", + "merged": false, + "mergeable": true, + "rebaseable": true, + "mergeable_state": "unstable", + "merged_by": null, + "comments": 5, + "review_comments": 0, + "maintainer_can_modify": false, + "commits": 2, + "additions": 1124, + "deletions": 0, + "changed_files": 7 + }, + "repository": { + "archive_url": "https://api.github.com/repos/ursa-labs/ursabot/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/ursa-labs/ursabot/assignees{/user}", + "blobs_url": "https://api.github.com/repos/ursa-labs/ursabot/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/ursa-labs/ursabot/branches{/branch}", + "clone_url": "https://github.com/ursa-labs/ursabot.git", + "collaborators_url": "https://api.github.com/repos/ursa-labs/ursabot/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/ursa-labs/ursabot/comments{/number}", + "commits_url": "https://api.github.com/repos/ursa-labs/ursabot/commits{/sha}", + "compare_url": "https://api.github.com/repos/ursa-labs/ursabot/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/ursa-labs/ursabot/contents/{+path}", + "contributors_url": "https://api.github.com/repos/ursa-labs/ursabot/contributors", + "created_at": "2019-02-04T15:40:31Z", + "default_branch": "master", + "deployments_url": "https://api.github.com/repos/ursa-labs/ursabot/deployments", + "description": null, + "disabled": false, + "downloads_url": "https://api.github.com/repos/ursa-labs/ursabot/downloads", + "events_url": "https://api.github.com/repos/ursa-labs/ursabot/events", + "fork": false, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/ursa-labs/ursabot/forks", + "full_name": "ursa-labs/ursabot", + "git_commits_url": "https://api.github.com/repos/ursa-labs/ursabot/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/ursa-labs/ursabot/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/ursa-labs/ursabot/git/tags{/sha}", + "git_url": "git://github.com/ursa-labs/ursabot.git", + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/ursa-labs/ursabot/hooks", + "html_url": "https://github.com/ursa-labs/ursabot", + "id": 169101701, + "issue_comment_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/events{/number}", + "issues_url": "https://api.github.com/repos/ursa-labs/ursabot/issues{/number}", + "keys_url": "https://api.github.com/repos/ursa-labs/ursabot/keys{/key_id}", + "labels_url": "https://api.github.com/repos/ursa-labs/ursabot/labels{/name}", + "language": "Jupyter Notebook", + "languages_url": "https://api.github.com/repos/ursa-labs/ursabot/languages", + "license": null, + "merges_url": "https://api.github.com/repos/ursa-labs/ursabot/merges", + "milestones_url": "https://api.github.com/repos/ursa-labs/ursabot/milestones{/number}", + "mirror_url": null, + "name": "ursabot", + "node_id": "MDEwOlJlcG9zaXRvcnkxNjkxMDE3MDE=", + "notifications_url": "https://api.github.com/repos/ursa-labs/ursabot/notifications{?since,all,participating}", + "open_issues": 19, + "open_issues_count": 19, + "owner": { + "avatar_url": "https://avatars2.githubusercontent.com/u/46514972?v=4", + "events_url": "https://api.github.com/users/ursa-labs/events{/privacy}", + "followers_url": "https://api.github.com/users/ursa-labs/followers", + "following_url": "https://api.github.com/users/ursa-labs/following{/other_user}", + "gists_url": "https://api.github.com/users/ursa-labs/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/ursa-labs", + "id": 46514972, + "login": "ursa-labs", + "node_id": "MDEyOk9yZ2FuaXphdGlvbjQ2NTE0OTcy", + "organizations_url": "https://api.github.com/users/ursa-labs/orgs", + "received_events_url": "https://api.github.com/users/ursa-labs/received_events", + "repos_url": "https://api.github.com/users/ursa-labs/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/ursa-labs/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/ursa-labs/subscriptions", + "type": "Organization", + "url": "https://api.github.com/users/ursa-labs" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/ursa-labs/ursabot/pulls{/number}", + "pushed_at": "2019-04-05T11:22:16Z", + "releases_url": "https://api.github.com/repos/ursa-labs/ursabot/releases{/id}", + "size": 892, + "ssh_url": "git@github.com:ursa-labs/ursabot.git", + "stargazers_count": 1, + "stargazers_url": "https://api.github.com/repos/ursa-labs/ursabot/stargazers", + "statuses_url": "https://api.github.com/repos/ursa-labs/ursabot/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/ursa-labs/ursabot/subscribers", + "subscription_url": "https://api.github.com/repos/ursa-labs/ursabot/subscription", + "svn_url": "https://github.com/ursa-labs/ursabot", + "tags_url": "https://api.github.com/repos/ursa-labs/ursabot/tags", + "teams_url": "https://api.github.com/repos/ursa-labs/ursabot/teams", + "trees_url": "https://api.github.com/repos/ursa-labs/ursabot/git/trees{/sha}", + "updated_at": "2019-04-04T17:49:10Z", + "url": "https://api.github.com/repos/ursa-labs/ursabot", + "watchers": 1, + "watchers_count": 1 + }, + "review":{ + "_links":{ + "html":{ + "href":"https://github.com/ursa-labs/ursabot/pulls/26#pullrequestreview-1291257810" + }, + "pull_request":{ + "href":"https://api.github.com/repos/ursa-labs/ursabot/pulls/26" + } + }, + "author_association":"MEMBER", + "body":"This is a comment review body message", + "commit_id":"8e95c04a29302429c4844fa7ab4f588de0702589", + "html_url":"https://github.com/ursa-labs/ursabot/pulls/26#pullrequestreview-1291257810", + "id":1291257810, + "node_id":"PRR_kwDOHHgT285M9wfS", + "pull_request_url":"https://api.github.com/repos/ursa-labs/ursabot/pulls/26", + "state":"commented", + "submitted_at":"2023-02-09T14:30:53Z", + "user":{ + "avatar_url":"https://avatars.githubusercontent.com/u/124899569?v=4", + "events_url":"https://api.github.com/users/raulcd/events{/privacy}", + "followers_url":"https://api.github.com/users/raulcd/followers", + "following_url":"https://api.github.com/users/raulcd/following{/other_user}", + "gists_url":"https://api.github.com/users/raulcd/gists{/gist_id}", + "gravatar_id":"", + "html_url":"https://github.com/raulcd", + "id":124899569, + "login":"raulcd", + "node_id":"U_kgDOB3HQ8Q", + "organizations_url":"https://api.github.com/users/raulcd/orgs", + "received_events_url":"https://api.github.com/users/raulcd/received_events", + "repos_url":"https://api.github.com/users/raulcd/repos", + "site_admin":false, + "starred_url":"https://api.github.com/users/raulcd/starred{/owner}{/repo}", + "subscriptions_url":"https://api.github.com/users/raulcd/subscriptions", + "type":"User", + "url":"https://api.github.com/users/raulcd" + } + }, + "sender": { + "avatar_url": "https://avatars1.githubusercontent.com/u/961747?v=4", + "events_url": "https://api.github.com/users/kszucs/events{/privacy}", + "followers_url": "https://api.github.com/users/kszucs/followers", + "following_url": "https://api.github.com/users/kszucs/following{/other_user}", + "gists_url": "https://api.github.com/users/kszucs/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/kszucs", + "id": 961747, + "login": "kszucs", + "node_id": "MDQ6VXNlcjk2MTc0Nw==", + "organizations_url": "https://api.github.com/users/kszucs/orgs", + "received_events_url": "https://api.github.com/users/kszucs/received_events", + "repos_url": "https://api.github.com/users/kszucs/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/kszucs/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kszucs/subscriptions", + "type": "User", + "url": "https://api.github.com/users/kszucs" + } + } \ No newline at end of file diff --git a/dev/archery/archery/tests/fixtures/event-pr-review-non-committer.json b/dev/archery/archery/tests/fixtures/event-pr-review-non-committer.json new file mode 100644 index 0000000000000..8f305ff0a2ddd --- /dev/null +++ b/dev/archery/archery/tests/fixtures/event-pr-review-non-committer.json @@ -0,0 +1,484 @@ +{ + "action": "submitted", + "number": 26, + "pull_request": { + "url": "https://api.github.com/repos/ursa-labs/ursabot/pulls/26", + "id": 267785552, + "node_id": "MDExOlB1bGxSZXF1ZXN0MjY3Nzg1NTUy", + "html_url": "https://github.com/ursa-labs/ursabot/pull/26", + "diff_url": "https://github.com/ursa-labs/ursabot/pull/26.diff", + "patch_url": "https://github.com/ursa-labs/ursabot/pull/26.patch", + "issue_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/26", + "number": 26, + "state": "open", + "locked": false, + "title": "Unittests for GithubHook", + "user": { + "login": "kszucs", + "id": 961747, + "node_id": "MDQ6VXNlcjk2MTc0Nw==", + "avatar_url": "https://avatars1.githubusercontent.com/u/961747?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/kszucs", + "html_url": "https://github.com/kszucs", + "followers_url": "https://api.github.com/users/kszucs/followers", + "following_url": "https://api.github.com/users/kszucs/following{/other_user}", + "gists_url": "https://api.github.com/users/kszucs/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kszucs/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kszucs/subscriptions", + "organizations_url": "https://api.github.com/users/kszucs/orgs", + "repos_url": "https://api.github.com/users/kszucs/repos", + "events_url": "https://api.github.com/users/kszucs/events{/privacy}", + "received_events_url": "https://api.github.com/users/kszucs/received_events", + "type": "User", + "site_admin": false + }, + "body": "", + "created_at": "2019-04-05T11:22:15Z", + "updated_at": "2019-04-05T12:01:40Z", + "closed_at": null, + "merged_at": null, + "merge_commit_sha": "cc5dc3606988b3824be54df779ed2028776113cb", + "assignee": null, + "assignees": [], + "requested_reviewers": [], + "requested_teams": [], + "labels": [], + "milestone": null, + "commits_url": "https://api.github.com/repos/ursa-labs/ursabot/pulls/26/commits", + "review_comments_url": "https://api.github.com/repos/ursa-labs/ursabot/pulls/26/comments", + "review_comment_url": "https://api.github.com/repos/ursa-labs/ursabot/pulls/comments{/number}", + "comments_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/26/comments", + "statuses_url": "https://api.github.com/repos/ursa-labs/ursabot/statuses/2705da2b616b98fa6010a25813c5a7a27456f71d", + "head": { + "label": "ursa-labs:test-hook", + "ref": "test-hook", + "sha": "2705da2b616b98fa6010a25813c5a7a27456f71d", + "user": { + "login": "ursa-labs", + "id": 46514972, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjQ2NTE0OTcy", + "avatar_url": "https://avatars2.githubusercontent.com/u/46514972?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/ursa-labs", + "html_url": "https://github.com/ursa-labs", + "followers_url": "https://api.github.com/users/ursa-labs/followers", + "following_url": "https://api.github.com/users/ursa-labs/following{/other_user}", + "gists_url": "https://api.github.com/users/ursa-labs/gists{/gist_id}", + "starred_url": "https://api.github.com/users/ursa-labs/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/ursa-labs/subscriptions", + "organizations_url": "https://api.github.com/users/ursa-labs/orgs", + "repos_url": "https://api.github.com/users/ursa-labs/repos", + "events_url": "https://api.github.com/users/ursa-labs/events{/privacy}", + "received_events_url": "https://api.github.com/users/ursa-labs/received_events", + "type": "Organization", + "site_admin": false + }, + "repo": { + "id": 169101701, + "node_id": "MDEwOlJlcG9zaXRvcnkxNjkxMDE3MDE=", + "name": "ursabot", + "full_name": "ursa-labs/ursabot", + "private": false, + "owner": { + "login": "ursa-labs", + "id": 46514972, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjQ2NTE0OTcy", + "avatar_url": "https://avatars2.githubusercontent.com/u/46514972?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/ursa-labs", + "html_url": "https://github.com/ursa-labs", + "followers_url": "https://api.github.com/users/ursa-labs/followers", + "following_url": "https://api.github.com/users/ursa-labs/following{/other_user}", + "gists_url": "https://api.github.com/users/ursa-labs/gists{/gist_id}", + "starred_url": "https://api.github.com/users/ursa-labs/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/ursa-labs/subscriptions", + "organizations_url": "https://api.github.com/users/ursa-labs/orgs", + "repos_url": "https://api.github.com/users/ursa-labs/repos", + "events_url": "https://api.github.com/users/ursa-labs/events{/privacy}", + "received_events_url": "https://api.github.com/users/ursa-labs/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/ursa-labs/ursabot", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/ursa-labs/ursabot", + "forks_url": "https://api.github.com/repos/ursa-labs/ursabot/forks", + "keys_url": "https://api.github.com/repos/ursa-labs/ursabot/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/ursa-labs/ursabot/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/ursa-labs/ursabot/teams", + "hooks_url": "https://api.github.com/repos/ursa-labs/ursabot/hooks", + "issue_events_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/events{/number}", + "events_url": "https://api.github.com/repos/ursa-labs/ursabot/events", + "assignees_url": "https://api.github.com/repos/ursa-labs/ursabot/assignees{/user}", + "branches_url": "https://api.github.com/repos/ursa-labs/ursabot/branches{/branch}", + "tags_url": "https://api.github.com/repos/ursa-labs/ursabot/tags", + "blobs_url": "https://api.github.com/repos/ursa-labs/ursabot/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/ursa-labs/ursabot/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/ursa-labs/ursabot/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/ursa-labs/ursabot/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/ursa-labs/ursabot/statuses/{sha}", + "languages_url": "https://api.github.com/repos/ursa-labs/ursabot/languages", + "stargazers_url": "https://api.github.com/repos/ursa-labs/ursabot/stargazers", + "contributors_url": "https://api.github.com/repos/ursa-labs/ursabot/contributors", + "subscribers_url": "https://api.github.com/repos/ursa-labs/ursabot/subscribers", + "subscription_url": "https://api.github.com/repos/ursa-labs/ursabot/subscription", + "commits_url": "https://api.github.com/repos/ursa-labs/ursabot/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/ursa-labs/ursabot/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/ursa-labs/ursabot/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/ursa-labs/ursabot/contents/{+path}", + "compare_url": "https://api.github.com/repos/ursa-labs/ursabot/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/ursa-labs/ursabot/merges", + "archive_url": "https://api.github.com/repos/ursa-labs/ursabot/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/ursa-labs/ursabot/downloads", + "issues_url": "https://api.github.com/repos/ursa-labs/ursabot/issues{/number}", + "pulls_url": "https://api.github.com/repos/ursa-labs/ursabot/pulls{/number}", + "milestones_url": "https://api.github.com/repos/ursa-labs/ursabot/milestones{/number}", + "notifications_url": "https://api.github.com/repos/ursa-labs/ursabot/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/ursa-labs/ursabot/labels{/name}", + "releases_url": "https://api.github.com/repos/ursa-labs/ursabot/releases{/id}", + "deployments_url": "https://api.github.com/repos/ursa-labs/ursabot/deployments", + "created_at": "2019-02-04T15:40:31Z", + "updated_at": "2019-04-04T17:49:10Z", + "pushed_at": "2019-04-05T12:01:40Z", + "git_url": "git://github.com/ursa-labs/ursabot.git", + "ssh_url": "git@github.com:ursa-labs/ursabot.git", + "clone_url": "https://github.com/ursa-labs/ursabot.git", + "svn_url": "https://github.com/ursa-labs/ursabot", + "homepage": null, + "size": 898, + "stargazers_count": 1, + "watchers_count": 1, + "language": "Jupyter Notebook", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 19, + "license": null, + "forks": 0, + "open_issues": 19, + "watchers": 1, + "default_branch": "master" + } + }, + "base": { + "label": "ursa-labs:master", + "ref": "master", + "sha": "a162ad254b589b924db47e057791191b39613fd5", + "user": { + "login": "ursa-labs", + "id": 46514972, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjQ2NTE0OTcy", + "avatar_url": "https://avatars2.githubusercontent.com/u/46514972?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/ursa-labs", + "html_url": "https://github.com/ursa-labs", + "followers_url": "https://api.github.com/users/ursa-labs/followers", + "following_url": "https://api.github.com/users/ursa-labs/following{/other_user}", + "gists_url": "https://api.github.com/users/ursa-labs/gists{/gist_id}", + "starred_url": "https://api.github.com/users/ursa-labs/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/ursa-labs/subscriptions", + "organizations_url": "https://api.github.com/users/ursa-labs/orgs", + "repos_url": "https://api.github.com/users/ursa-labs/repos", + "events_url": "https://api.github.com/users/ursa-labs/events{/privacy}", + "received_events_url": "https://api.github.com/users/ursa-labs/received_events", + "type": "Organization", + "site_admin": false + }, + "repo": { + "id": 169101701, + "node_id": "MDEwOlJlcG9zaXRvcnkxNjkxMDE3MDE=", + "name": "ursabot", + "full_name": "ursa-labs/ursabot", + "private": false, + "owner": { + "login": "ursa-labs", + "id": 46514972, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjQ2NTE0OTcy", + "avatar_url": "https://avatars2.githubusercontent.com/u/46514972?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/ursa-labs", + "html_url": "https://github.com/ursa-labs", + "followers_url": "https://api.github.com/users/ursa-labs/followers", + "following_url": "https://api.github.com/users/ursa-labs/following{/other_user}", + "gists_url": "https://api.github.com/users/ursa-labs/gists{/gist_id}", + "starred_url": "https://api.github.com/users/ursa-labs/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/ursa-labs/subscriptions", + "organizations_url": "https://api.github.com/users/ursa-labs/orgs", + "repos_url": "https://api.github.com/users/ursa-labs/repos", + "events_url": "https://api.github.com/users/ursa-labs/events{/privacy}", + "received_events_url": "https://api.github.com/users/ursa-labs/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/ursa-labs/ursabot", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/ursa-labs/ursabot", + "forks_url": "https://api.github.com/repos/ursa-labs/ursabot/forks", + "keys_url": "https://api.github.com/repos/ursa-labs/ursabot/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/ursa-labs/ursabot/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/ursa-labs/ursabot/teams", + "hooks_url": "https://api.github.com/repos/ursa-labs/ursabot/hooks", + "issue_events_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/events{/number}", + "events_url": "https://api.github.com/repos/ursa-labs/ursabot/events", + "assignees_url": "https://api.github.com/repos/ursa-labs/ursabot/assignees{/user}", + "branches_url": "https://api.github.com/repos/ursa-labs/ursabot/branches{/branch}", + "tags_url": "https://api.github.com/repos/ursa-labs/ursabot/tags", + "blobs_url": "https://api.github.com/repos/ursa-labs/ursabot/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/ursa-labs/ursabot/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/ursa-labs/ursabot/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/ursa-labs/ursabot/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/ursa-labs/ursabot/statuses/{sha}", + "languages_url": "https://api.github.com/repos/ursa-labs/ursabot/languages", + "stargazers_url": "https://api.github.com/repos/ursa-labs/ursabot/stargazers", + "contributors_url": "https://api.github.com/repos/ursa-labs/ursabot/contributors", + "subscribers_url": "https://api.github.com/repos/ursa-labs/ursabot/subscribers", + "subscription_url": "https://api.github.com/repos/ursa-labs/ursabot/subscription", + "commits_url": "https://api.github.com/repos/ursa-labs/ursabot/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/ursa-labs/ursabot/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/ursa-labs/ursabot/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/ursa-labs/ursabot/contents/{+path}", + "compare_url": "https://api.github.com/repos/ursa-labs/ursabot/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/ursa-labs/ursabot/merges", + "archive_url": "https://api.github.com/repos/ursa-labs/ursabot/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/ursa-labs/ursabot/downloads", + "issues_url": "https://api.github.com/repos/ursa-labs/ursabot/issues{/number}", + "pulls_url": "https://api.github.com/repos/ursa-labs/ursabot/pulls{/number}", + "milestones_url": "https://api.github.com/repos/ursa-labs/ursabot/milestones{/number}", + "notifications_url": "https://api.github.com/repos/ursa-labs/ursabot/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/ursa-labs/ursabot/labels{/name}", + "releases_url": "https://api.github.com/repos/ursa-labs/ursabot/releases{/id}", + "deployments_url": "https://api.github.com/repos/ursa-labs/ursabot/deployments", + "created_at": "2019-02-04T15:40:31Z", + "updated_at": "2019-04-04T17:49:10Z", + "pushed_at": "2019-04-05T12:01:40Z", + "git_url": "git://github.com/ursa-labs/ursabot.git", + "ssh_url": "git@github.com:ursa-labs/ursabot.git", + "clone_url": "https://github.com/ursa-labs/ursabot.git", + "svn_url": "https://github.com/ursa-labs/ursabot", + "homepage": null, + "size": 898, + "stargazers_count": 1, + "watchers_count": 1, + "language": "Jupyter Notebook", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 19, + "license": null, + "forks": 0, + "open_issues": 19, + "watchers": 1, + "default_branch": "master" + } + }, + "_links": { + "self": { + "href": "https://api.github.com/repos/ursa-labs/ursabot/pulls/26" + }, + "html": { + "href": "https://github.com/ursa-labs/ursabot/pull/26" + }, + "issue": { + "href": "https://api.github.com/repos/ursa-labs/ursabot/issues/26" + }, + "comments": { + "href": "https://api.github.com/repos/ursa-labs/ursabot/issues/26/comments" + }, + "review_comments": { + "href": "https://api.github.com/repos/ursa-labs/ursabot/pulls/26/comments" + }, + "review_comment": { + "href": "https://api.github.com/repos/ursa-labs/ursabot/pulls/comments{/number}" + }, + "commits": { + "href": "https://api.github.com/repos/ursa-labs/ursabot/pulls/26/commits" + }, + "statuses": { + "href": "https://api.github.com/repos/ursa-labs/ursabot/statuses/2705da2b616b98fa6010a25813c5a7a27456f71d" + } + }, + "author_association": "COLLABORATOR", + "merged": false, + "mergeable": true, + "rebaseable": true, + "mergeable_state": "unstable", + "merged_by": null, + "comments": 5, + "review_comments": 0, + "maintainer_can_modify": false, + "commits": 2, + "additions": 1124, + "deletions": 0, + "changed_files": 7 + }, + "repository": { + "archive_url": "https://api.github.com/repos/ursa-labs/ursabot/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/ursa-labs/ursabot/assignees{/user}", + "blobs_url": "https://api.github.com/repos/ursa-labs/ursabot/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/ursa-labs/ursabot/branches{/branch}", + "clone_url": "https://github.com/ursa-labs/ursabot.git", + "collaborators_url": "https://api.github.com/repos/ursa-labs/ursabot/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/ursa-labs/ursabot/comments{/number}", + "commits_url": "https://api.github.com/repos/ursa-labs/ursabot/commits{/sha}", + "compare_url": "https://api.github.com/repos/ursa-labs/ursabot/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/ursa-labs/ursabot/contents/{+path}", + "contributors_url": "https://api.github.com/repos/ursa-labs/ursabot/contributors", + "created_at": "2019-02-04T15:40:31Z", + "default_branch": "master", + "deployments_url": "https://api.github.com/repos/ursa-labs/ursabot/deployments", + "description": null, + "disabled": false, + "downloads_url": "https://api.github.com/repos/ursa-labs/ursabot/downloads", + "events_url": "https://api.github.com/repos/ursa-labs/ursabot/events", + "fork": false, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/ursa-labs/ursabot/forks", + "full_name": "ursa-labs/ursabot", + "git_commits_url": "https://api.github.com/repos/ursa-labs/ursabot/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/ursa-labs/ursabot/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/ursa-labs/ursabot/git/tags{/sha}", + "git_url": "git://github.com/ursa-labs/ursabot.git", + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/ursa-labs/ursabot/hooks", + "html_url": "https://github.com/ursa-labs/ursabot", + "id": 169101701, + "issue_comment_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/events{/number}", + "issues_url": "https://api.github.com/repos/ursa-labs/ursabot/issues{/number}", + "keys_url": "https://api.github.com/repos/ursa-labs/ursabot/keys{/key_id}", + "labels_url": "https://api.github.com/repos/ursa-labs/ursabot/labels{/name}", + "language": "Jupyter Notebook", + "languages_url": "https://api.github.com/repos/ursa-labs/ursabot/languages", + "license": null, + "merges_url": "https://api.github.com/repos/ursa-labs/ursabot/merges", + "milestones_url": "https://api.github.com/repos/ursa-labs/ursabot/milestones{/number}", + "mirror_url": null, + "name": "ursabot", + "node_id": "MDEwOlJlcG9zaXRvcnkxNjkxMDE3MDE=", + "notifications_url": "https://api.github.com/repos/ursa-labs/ursabot/notifications{?since,all,participating}", + "open_issues": 19, + "open_issues_count": 19, + "owner": { + "avatar_url": "https://avatars2.githubusercontent.com/u/46514972?v=4", + "events_url": "https://api.github.com/users/ursa-labs/events{/privacy}", + "followers_url": "https://api.github.com/users/ursa-labs/followers", + "following_url": "https://api.github.com/users/ursa-labs/following{/other_user}", + "gists_url": "https://api.github.com/users/ursa-labs/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/ursa-labs", + "id": 46514972, + "login": "ursa-labs", + "node_id": "MDEyOk9yZ2FuaXphdGlvbjQ2NTE0OTcy", + "organizations_url": "https://api.github.com/users/ursa-labs/orgs", + "received_events_url": "https://api.github.com/users/ursa-labs/received_events", + "repos_url": "https://api.github.com/users/ursa-labs/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/ursa-labs/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/ursa-labs/subscriptions", + "type": "Organization", + "url": "https://api.github.com/users/ursa-labs" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/ursa-labs/ursabot/pulls{/number}", + "pushed_at": "2019-04-05T11:22:16Z", + "releases_url": "https://api.github.com/repos/ursa-labs/ursabot/releases{/id}", + "size": 892, + "ssh_url": "git@github.com:ursa-labs/ursabot.git", + "stargazers_count": 1, + "stargazers_url": "https://api.github.com/repos/ursa-labs/ursabot/stargazers", + "statuses_url": "https://api.github.com/repos/ursa-labs/ursabot/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/ursa-labs/ursabot/subscribers", + "subscription_url": "https://api.github.com/repos/ursa-labs/ursabot/subscription", + "svn_url": "https://github.com/ursa-labs/ursabot", + "tags_url": "https://api.github.com/repos/ursa-labs/ursabot/tags", + "teams_url": "https://api.github.com/repos/ursa-labs/ursabot/teams", + "trees_url": "https://api.github.com/repos/ursa-labs/ursabot/git/trees{/sha}", + "updated_at": "2019-04-04T17:49:10Z", + "url": "https://api.github.com/repos/ursa-labs/ursabot", + "watchers": 1, + "watchers_count": 1 + }, + "review":{ + "_links":{ + "html":{ + "href":"https://github.com/ursa-labs/ursabot/pulls/26#pullrequestreview-1291257810" + }, + "pull_request":{ + "href":"https://api.github.com/repos/ursa-labs/ursabot/pulls/26" + } + }, + "author_association":"COLLABORATOR", + "body":"This is a comment review body message", + "commit_id":"8e95c04a29302429c4844fa7ab4f588de0702589", + "html_url":"https://github.com/ursa-labs/ursabot/pulls/26#pullrequestreview-1291257810", + "id":1291257810, + "node_id":"PRR_kwDOHHgT285M9wfS", + "pull_request_url":"https://api.github.com/repos/ursa-labs/ursabot/pulls/26", + "state":"commented", + "submitted_at":"2023-02-09T14:30:53Z", + "user":{ + "avatar_url":"https://avatars.githubusercontent.com/u/124899569?v=4", + "events_url":"https://api.github.com/users/raulcd/events{/privacy}", + "followers_url":"https://api.github.com/users/raulcd/followers", + "following_url":"https://api.github.com/users/raulcd/following{/other_user}", + "gists_url":"https://api.github.com/users/raulcd/gists{/gist_id}", + "gravatar_id":"", + "html_url":"https://github.com/raulcd", + "id":124899569, + "login":"raulcd", + "node_id":"U_kgDOB3HQ8Q", + "organizations_url":"https://api.github.com/users/raulcd/orgs", + "received_events_url":"https://api.github.com/users/raulcd/received_events", + "repos_url":"https://api.github.com/users/raulcd/repos", + "site_admin":false, + "starred_url":"https://api.github.com/users/raulcd/starred{/owner}{/repo}", + "subscriptions_url":"https://api.github.com/users/raulcd/subscriptions", + "type":"User", + "url":"https://api.github.com/users/raulcd" + } + }, + "sender": { + "avatar_url": "https://avatars1.githubusercontent.com/u/961747?v=4", + "events_url": "https://api.github.com/users/kszucs/events{/privacy}", + "followers_url": "https://api.github.com/users/kszucs/followers", + "following_url": "https://api.github.com/users/kszucs/following{/other_user}", + "gists_url": "https://api.github.com/users/kszucs/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/kszucs", + "id": 961747, + "login": "kszucs", + "node_id": "MDQ6VXNlcjk2MTc0Nw==", + "organizations_url": "https://api.github.com/users/kszucs/orgs", + "received_events_url": "https://api.github.com/users/kszucs/received_events", + "repos_url": "https://api.github.com/users/kszucs/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/kszucs/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kszucs/subscriptions", + "type": "User", + "url": "https://api.github.com/users/kszucs" + } + } \ No newline at end of file diff --git a/dev/archery/archery/tests/fixtures/event-pull-request-opened-non-committer.json b/dev/archery/archery/tests/fixtures/event-pull-request-opened-non-committer.json new file mode 100644 index 0000000000000..d11047705069e --- /dev/null +++ b/dev/archery/archery/tests/fixtures/event-pull-request-opened-non-committer.json @@ -0,0 +1,445 @@ +{ + "action": "opened", + "number": 26, + "pull_request": { + "url": "https://api.github.com/repos/ursa-labs/ursabot/pulls/26", + "id": 267785552, + "node_id": "MDExOlB1bGxSZXF1ZXN0MjY3Nzg1NTUy", + "html_url": "https://github.com/ursa-labs/ursabot/pull/26", + "diff_url": "https://github.com/ursa-labs/ursabot/pull/26.diff", + "patch_url": "https://github.com/ursa-labs/ursabot/pull/26.patch", + "issue_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/26", + "number": 26, + "state": "open", + "locked": false, + "title": "Unittests for GithubHook", + "user": { + "login": "kszucs", + "id": 961747, + "node_id": "MDQ6VXNlcjk2MTc0Nw==", + "avatar_url": "https://avatars1.githubusercontent.com/u/961747?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/kszucs", + "html_url": "https://github.com/kszucs", + "followers_url": "https://api.github.com/users/kszucs/followers", + "following_url": "https://api.github.com/users/kszucs/following{/other_user}", + "gists_url": "https://api.github.com/users/kszucs/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kszucs/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kszucs/subscriptions", + "organizations_url": "https://api.github.com/users/kszucs/orgs", + "repos_url": "https://api.github.com/users/kszucs/repos", + "events_url": "https://api.github.com/users/kszucs/events{/privacy}", + "received_events_url": "https://api.github.com/users/kszucs/received_events", + "type": "User", + "site_admin": false + }, + "body": "", + "created_at": "2019-04-05T11:22:15Z", + "updated_at": "2019-04-05T12:01:40Z", + "closed_at": null, + "merged_at": null, + "merge_commit_sha": "cc5dc3606988b3824be54df779ed2028776113cb", + "assignee": null, + "assignees": [], + "requested_reviewers": [], + "requested_teams": [], + "labels": [], + "milestone": null, + "commits_url": "https://api.github.com/repos/ursa-labs/ursabot/pulls/26/commits", + "review_comments_url": "https://api.github.com/repos/ursa-labs/ursabot/pulls/26/comments", + "review_comment_url": "https://api.github.com/repos/ursa-labs/ursabot/pulls/comments{/number}", + "comments_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/26/comments", + "statuses_url": "https://api.github.com/repos/ursa-labs/ursabot/statuses/2705da2b616b98fa6010a25813c5a7a27456f71d", + "head": { + "label": "ursa-labs:test-hook", + "ref": "test-hook", + "sha": "2705da2b616b98fa6010a25813c5a7a27456f71d", + "user": { + "login": "ursa-labs", + "id": 46514972, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjQ2NTE0OTcy", + "avatar_url": "https://avatars2.githubusercontent.com/u/46514972?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/ursa-labs", + "html_url": "https://github.com/ursa-labs", + "followers_url": "https://api.github.com/users/ursa-labs/followers", + "following_url": "https://api.github.com/users/ursa-labs/following{/other_user}", + "gists_url": "https://api.github.com/users/ursa-labs/gists{/gist_id}", + "starred_url": "https://api.github.com/users/ursa-labs/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/ursa-labs/subscriptions", + "organizations_url": "https://api.github.com/users/ursa-labs/orgs", + "repos_url": "https://api.github.com/users/ursa-labs/repos", + "events_url": "https://api.github.com/users/ursa-labs/events{/privacy}", + "received_events_url": "https://api.github.com/users/ursa-labs/received_events", + "type": "Organization", + "site_admin": false + }, + "repo": { + "id": 169101701, + "node_id": "MDEwOlJlcG9zaXRvcnkxNjkxMDE3MDE=", + "name": "ursabot", + "full_name": "ursa-labs/ursabot", + "private": false, + "owner": { + "login": "ursa-labs", + "id": 46514972, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjQ2NTE0OTcy", + "avatar_url": "https://avatars2.githubusercontent.com/u/46514972?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/ursa-labs", + "html_url": "https://github.com/ursa-labs", + "followers_url": "https://api.github.com/users/ursa-labs/followers", + "following_url": "https://api.github.com/users/ursa-labs/following{/other_user}", + "gists_url": "https://api.github.com/users/ursa-labs/gists{/gist_id}", + "starred_url": "https://api.github.com/users/ursa-labs/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/ursa-labs/subscriptions", + "organizations_url": "https://api.github.com/users/ursa-labs/orgs", + "repos_url": "https://api.github.com/users/ursa-labs/repos", + "events_url": "https://api.github.com/users/ursa-labs/events{/privacy}", + "received_events_url": "https://api.github.com/users/ursa-labs/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/ursa-labs/ursabot", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/ursa-labs/ursabot", + "forks_url": "https://api.github.com/repos/ursa-labs/ursabot/forks", + "keys_url": "https://api.github.com/repos/ursa-labs/ursabot/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/ursa-labs/ursabot/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/ursa-labs/ursabot/teams", + "hooks_url": "https://api.github.com/repos/ursa-labs/ursabot/hooks", + "issue_events_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/events{/number}", + "events_url": "https://api.github.com/repos/ursa-labs/ursabot/events", + "assignees_url": "https://api.github.com/repos/ursa-labs/ursabot/assignees{/user}", + "branches_url": "https://api.github.com/repos/ursa-labs/ursabot/branches{/branch}", + "tags_url": "https://api.github.com/repos/ursa-labs/ursabot/tags", + "blobs_url": "https://api.github.com/repos/ursa-labs/ursabot/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/ursa-labs/ursabot/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/ursa-labs/ursabot/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/ursa-labs/ursabot/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/ursa-labs/ursabot/statuses/{sha}", + "languages_url": "https://api.github.com/repos/ursa-labs/ursabot/languages", + "stargazers_url": "https://api.github.com/repos/ursa-labs/ursabot/stargazers", + "contributors_url": "https://api.github.com/repos/ursa-labs/ursabot/contributors", + "subscribers_url": "https://api.github.com/repos/ursa-labs/ursabot/subscribers", + "subscription_url": "https://api.github.com/repos/ursa-labs/ursabot/subscription", + "commits_url": "https://api.github.com/repos/ursa-labs/ursabot/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/ursa-labs/ursabot/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/ursa-labs/ursabot/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/ursa-labs/ursabot/contents/{+path}", + "compare_url": "https://api.github.com/repos/ursa-labs/ursabot/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/ursa-labs/ursabot/merges", + "archive_url": "https://api.github.com/repos/ursa-labs/ursabot/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/ursa-labs/ursabot/downloads", + "issues_url": "https://api.github.com/repos/ursa-labs/ursabot/issues{/number}", + "pulls_url": "https://api.github.com/repos/ursa-labs/ursabot/pulls{/number}", + "milestones_url": "https://api.github.com/repos/ursa-labs/ursabot/milestones{/number}", + "notifications_url": "https://api.github.com/repos/ursa-labs/ursabot/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/ursa-labs/ursabot/labels{/name}", + "releases_url": "https://api.github.com/repos/ursa-labs/ursabot/releases{/id}", + "deployments_url": "https://api.github.com/repos/ursa-labs/ursabot/deployments", + "created_at": "2019-02-04T15:40:31Z", + "updated_at": "2019-04-04T17:49:10Z", + "pushed_at": "2019-04-05T12:01:40Z", + "git_url": "git://github.com/ursa-labs/ursabot.git", + "ssh_url": "git@github.com:ursa-labs/ursabot.git", + "clone_url": "https://github.com/ursa-labs/ursabot.git", + "svn_url": "https://github.com/ursa-labs/ursabot", + "homepage": null, + "size": 898, + "stargazers_count": 1, + "watchers_count": 1, + "language": "Jupyter Notebook", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 19, + "license": null, + "forks": 0, + "open_issues": 19, + "watchers": 1, + "default_branch": "master" + } + }, + "base": { + "label": "ursa-labs:master", + "ref": "master", + "sha": "a162ad254b589b924db47e057791191b39613fd5", + "user": { + "login": "ursa-labs", + "id": 46514972, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjQ2NTE0OTcy", + "avatar_url": "https://avatars2.githubusercontent.com/u/46514972?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/ursa-labs", + "html_url": "https://github.com/ursa-labs", + "followers_url": "https://api.github.com/users/ursa-labs/followers", + "following_url": "https://api.github.com/users/ursa-labs/following{/other_user}", + "gists_url": "https://api.github.com/users/ursa-labs/gists{/gist_id}", + "starred_url": "https://api.github.com/users/ursa-labs/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/ursa-labs/subscriptions", + "organizations_url": "https://api.github.com/users/ursa-labs/orgs", + "repos_url": "https://api.github.com/users/ursa-labs/repos", + "events_url": "https://api.github.com/users/ursa-labs/events{/privacy}", + "received_events_url": "https://api.github.com/users/ursa-labs/received_events", + "type": "Organization", + "site_admin": false + }, + "repo": { + "id": 169101701, + "node_id": "MDEwOlJlcG9zaXRvcnkxNjkxMDE3MDE=", + "name": "ursabot", + "full_name": "ursa-labs/ursabot", + "private": false, + "owner": { + "login": "ursa-labs", + "id": 46514972, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjQ2NTE0OTcy", + "avatar_url": "https://avatars2.githubusercontent.com/u/46514972?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/ursa-labs", + "html_url": "https://github.com/ursa-labs", + "followers_url": "https://api.github.com/users/ursa-labs/followers", + "following_url": "https://api.github.com/users/ursa-labs/following{/other_user}", + "gists_url": "https://api.github.com/users/ursa-labs/gists{/gist_id}", + "starred_url": "https://api.github.com/users/ursa-labs/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/ursa-labs/subscriptions", + "organizations_url": "https://api.github.com/users/ursa-labs/orgs", + "repos_url": "https://api.github.com/users/ursa-labs/repos", + "events_url": "https://api.github.com/users/ursa-labs/events{/privacy}", + "received_events_url": "https://api.github.com/users/ursa-labs/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/ursa-labs/ursabot", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/ursa-labs/ursabot", + "forks_url": "https://api.github.com/repos/ursa-labs/ursabot/forks", + "keys_url": "https://api.github.com/repos/ursa-labs/ursabot/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/ursa-labs/ursabot/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/ursa-labs/ursabot/teams", + "hooks_url": "https://api.github.com/repos/ursa-labs/ursabot/hooks", + "issue_events_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/events{/number}", + "events_url": "https://api.github.com/repos/ursa-labs/ursabot/events", + "assignees_url": "https://api.github.com/repos/ursa-labs/ursabot/assignees{/user}", + "branches_url": "https://api.github.com/repos/ursa-labs/ursabot/branches{/branch}", + "tags_url": "https://api.github.com/repos/ursa-labs/ursabot/tags", + "blobs_url": "https://api.github.com/repos/ursa-labs/ursabot/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/ursa-labs/ursabot/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/ursa-labs/ursabot/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/ursa-labs/ursabot/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/ursa-labs/ursabot/statuses/{sha}", + "languages_url": "https://api.github.com/repos/ursa-labs/ursabot/languages", + "stargazers_url": "https://api.github.com/repos/ursa-labs/ursabot/stargazers", + "contributors_url": "https://api.github.com/repos/ursa-labs/ursabot/contributors", + "subscribers_url": "https://api.github.com/repos/ursa-labs/ursabot/subscribers", + "subscription_url": "https://api.github.com/repos/ursa-labs/ursabot/subscription", + "commits_url": "https://api.github.com/repos/ursa-labs/ursabot/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/ursa-labs/ursabot/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/ursa-labs/ursabot/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/ursa-labs/ursabot/contents/{+path}", + "compare_url": "https://api.github.com/repos/ursa-labs/ursabot/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/ursa-labs/ursabot/merges", + "archive_url": "https://api.github.com/repos/ursa-labs/ursabot/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/ursa-labs/ursabot/downloads", + "issues_url": "https://api.github.com/repos/ursa-labs/ursabot/issues{/number}", + "pulls_url": "https://api.github.com/repos/ursa-labs/ursabot/pulls{/number}", + "milestones_url": "https://api.github.com/repos/ursa-labs/ursabot/milestones{/number}", + "notifications_url": "https://api.github.com/repos/ursa-labs/ursabot/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/ursa-labs/ursabot/labels{/name}", + "releases_url": "https://api.github.com/repos/ursa-labs/ursabot/releases{/id}", + "deployments_url": "https://api.github.com/repos/ursa-labs/ursabot/deployments", + "created_at": "2019-02-04T15:40:31Z", + "updated_at": "2019-04-04T17:49:10Z", + "pushed_at": "2019-04-05T12:01:40Z", + "git_url": "git://github.com/ursa-labs/ursabot.git", + "ssh_url": "git@github.com:ursa-labs/ursabot.git", + "clone_url": "https://github.com/ursa-labs/ursabot.git", + "svn_url": "https://github.com/ursa-labs/ursabot", + "homepage": null, + "size": 898, + "stargazers_count": 1, + "watchers_count": 1, + "language": "Jupyter Notebook", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 19, + "license": null, + "forks": 0, + "open_issues": 19, + "watchers": 1, + "default_branch": "master" + } + }, + "_links": { + "self": { + "href": "https://api.github.com/repos/ursa-labs/ursabot/pulls/26" + }, + "html": { + "href": "https://github.com/ursa-labs/ursabot/pull/26" + }, + "issue": { + "href": "https://api.github.com/repos/ursa-labs/ursabot/issues/26" + }, + "comments": { + "href": "https://api.github.com/repos/ursa-labs/ursabot/issues/26/comments" + }, + "review_comments": { + "href": "https://api.github.com/repos/ursa-labs/ursabot/pulls/26/comments" + }, + "review_comment": { + "href": "https://api.github.com/repos/ursa-labs/ursabot/pulls/comments{/number}" + }, + "commits": { + "href": "https://api.github.com/repos/ursa-labs/ursabot/pulls/26/commits" + }, + "statuses": { + "href": "https://api.github.com/repos/ursa-labs/ursabot/statuses/2705da2b616b98fa6010a25813c5a7a27456f71d" + } + }, + "author_association": "COLLABORATOR", + "merged": false, + "mergeable": true, + "rebaseable": true, + "mergeable_state": "unstable", + "merged_by": null, + "comments": 5, + "review_comments": 0, + "maintainer_can_modify": false, + "commits": 2, + "additions": 1124, + "deletions": 0, + "changed_files": 7 + }, + "repository": { + "archive_url": "https://api.github.com/repos/ursa-labs/ursabot/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/ursa-labs/ursabot/assignees{/user}", + "blobs_url": "https://api.github.com/repos/ursa-labs/ursabot/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/ursa-labs/ursabot/branches{/branch}", + "clone_url": "https://github.com/ursa-labs/ursabot.git", + "collaborators_url": "https://api.github.com/repos/ursa-labs/ursabot/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/ursa-labs/ursabot/comments{/number}", + "commits_url": "https://api.github.com/repos/ursa-labs/ursabot/commits{/sha}", + "compare_url": "https://api.github.com/repos/ursa-labs/ursabot/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/ursa-labs/ursabot/contents/{+path}", + "contributors_url": "https://api.github.com/repos/ursa-labs/ursabot/contributors", + "created_at": "2019-02-04T15:40:31Z", + "default_branch": "master", + "deployments_url": "https://api.github.com/repos/ursa-labs/ursabot/deployments", + "description": null, + "disabled": false, + "downloads_url": "https://api.github.com/repos/ursa-labs/ursabot/downloads", + "events_url": "https://api.github.com/repos/ursa-labs/ursabot/events", + "fork": false, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/ursa-labs/ursabot/forks", + "full_name": "ursa-labs/ursabot", + "git_commits_url": "https://api.github.com/repos/ursa-labs/ursabot/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/ursa-labs/ursabot/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/ursa-labs/ursabot/git/tags{/sha}", + "git_url": "git://github.com/ursa-labs/ursabot.git", + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/ursa-labs/ursabot/hooks", + "html_url": "https://github.com/ursa-labs/ursabot", + "id": 169101701, + "issue_comment_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/events{/number}", + "issues_url": "https://api.github.com/repos/ursa-labs/ursabot/issues{/number}", + "keys_url": "https://api.github.com/repos/ursa-labs/ursabot/keys{/key_id}", + "labels_url": "https://api.github.com/repos/ursa-labs/ursabot/labels{/name}", + "language": "Jupyter Notebook", + "languages_url": "https://api.github.com/repos/ursa-labs/ursabot/languages", + "license": null, + "merges_url": "https://api.github.com/repos/ursa-labs/ursabot/merges", + "milestones_url": "https://api.github.com/repos/ursa-labs/ursabot/milestones{/number}", + "mirror_url": null, + "name": "ursabot", + "node_id": "MDEwOlJlcG9zaXRvcnkxNjkxMDE3MDE=", + "notifications_url": "https://api.github.com/repos/ursa-labs/ursabot/notifications{?since,all,participating}", + "open_issues": 19, + "open_issues_count": 19, + "owner": { + "avatar_url": "https://avatars2.githubusercontent.com/u/46514972?v=4", + "events_url": "https://api.github.com/users/ursa-labs/events{/privacy}", + "followers_url": "https://api.github.com/users/ursa-labs/followers", + "following_url": "https://api.github.com/users/ursa-labs/following{/other_user}", + "gists_url": "https://api.github.com/users/ursa-labs/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/ursa-labs", + "id": 46514972, + "login": "ursa-labs", + "node_id": "MDEyOk9yZ2FuaXphdGlvbjQ2NTE0OTcy", + "organizations_url": "https://api.github.com/users/ursa-labs/orgs", + "received_events_url": "https://api.github.com/users/ursa-labs/received_events", + "repos_url": "https://api.github.com/users/ursa-labs/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/ursa-labs/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/ursa-labs/subscriptions", + "type": "Organization", + "url": "https://api.github.com/users/ursa-labs" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/ursa-labs/ursabot/pulls{/number}", + "pushed_at": "2019-04-05T11:22:16Z", + "releases_url": "https://api.github.com/repos/ursa-labs/ursabot/releases{/id}", + "size": 892, + "ssh_url": "git@github.com:ursa-labs/ursabot.git", + "stargazers_count": 1, + "stargazers_url": "https://api.github.com/repos/ursa-labs/ursabot/stargazers", + "statuses_url": "https://api.github.com/repos/ursa-labs/ursabot/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/ursa-labs/ursabot/subscribers", + "subscription_url": "https://api.github.com/repos/ursa-labs/ursabot/subscription", + "svn_url": "https://github.com/ursa-labs/ursabot", + "tags_url": "https://api.github.com/repos/ursa-labs/ursabot/tags", + "teams_url": "https://api.github.com/repos/ursa-labs/ursabot/teams", + "trees_url": "https://api.github.com/repos/ursa-labs/ursabot/git/trees{/sha}", + "updated_at": "2019-04-04T17:49:10Z", + "url": "https://api.github.com/repos/ursa-labs/ursabot", + "watchers": 1, + "watchers_count": 1 + }, + "sender": { + "avatar_url": "https://avatars1.githubusercontent.com/u/961747?v=4", + "events_url": "https://api.github.com/users/kszucs/events{/privacy}", + "followers_url": "https://api.github.com/users/kszucs/followers", + "following_url": "https://api.github.com/users/kszucs/following{/other_user}", + "gists_url": "https://api.github.com/users/kszucs/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/kszucs", + "id": 961747, + "login": "kszucs", + "node_id": "MDQ6VXNlcjk2MTc0Nw==", + "organizations_url": "https://api.github.com/users/kszucs/orgs", + "received_events_url": "https://api.github.com/users/kszucs/received_events", + "repos_url": "https://api.github.com/users/kszucs/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/kszucs/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kszucs/subscriptions", + "type": "User", + "url": "https://api.github.com/users/kszucs" + } +} \ No newline at end of file diff --git a/dev/archery/archery/tests/fixtures/event-push.json b/dev/archery/archery/tests/fixtures/event-push.json new file mode 100644 index 0000000000000..d0d108b294954 --- /dev/null +++ b/dev/archery/archery/tests/fixtures/event-push.json @@ -0,0 +1,184 @@ +{ + "after":"27313fc220561ef6b0d5edb485b29684b405c80b", + "base_ref":"None", + "before":"8e95c04a29302429c4844fa7ab4f588de0702589", + "commits":[ + { + "author":{ + "email":"raulcumplido@gmail.com", + "name":"Raúl Cumplido", + "username":"raulcd" + }, + "committer":{ + "email":"raulcumplido@gmail.com", + "name":"Raúl Cumplido", + "username":"raulcd" + }, + "distinct":true, + "id":"27313fc220561ef6b0d5edb485b29684b405c80b", + "message":"Initial GitHub Workflow triggering archery bot", + "timestamp":"2023-02-10T12:30:01+01:00", + "tree_id":"c079a4afb0178472534363c85a01c7b7fa33daba", + "url":"https://github.com/raulcd/arrow/commit/27313fc220561ef6b0d5edb485b29684b405c80b" + } + ], + "compare":"https://github.com/raulcd/arrow/compare/8e95c04a2930...27313fc22056", + "created":false, + "deleted":false, + "forced":true, + "head_commit":{ + "author":{ + "email":"raulcumplido@gmail.com", + "name":"Raúl Cumplido", + "username":"raulcd" + }, + "committer":{ + "email":"raulcumplido@gmail.com", + "name":"Raúl Cumplido", + "username":"raulcd" + }, + "distinct":true, + "id":"27313fc220561ef6b0d5edb485b29684b405c80b", + "message":"Initial GitHub Workflow triggering archery bot", + "timestamp":"2023-02-10T12:30:01+01:00", + "tree_id":"c079a4afb0178472534363c85a01c7b7fa33daba", + "url":"https://github.com/raulcd/arrow/commit/27313fc220561ef6b0d5edb485b29684b405c80b" + }, + "pusher":{ + "email":"raulcumplido@gmail.com", + "name":"raulcd" + }, + "ref":"refs/heads/pr-workflow-automation-poc", + "repository":{ + "allow_forking":true, + "archive_url":"https://api.github.com/repos/raulcd/arrow/{archive_format}{/ref}", + "archived":false, + "assignees_url":"https://api.github.com/repos/raulcd/arrow/assignees{/user}", + "blobs_url":"https://api.github.com/repos/raulcd/arrow/git/blobs{/sha}", + "branches_url":"https://api.github.com/repos/raulcd/arrow/branches{/branch}", + "clone_url":"https://github.com/raulcd/arrow.git", + "collaborators_url":"https://api.github.com/repos/raulcd/arrow/collaborators{/collaborator}", + "comments_url":"https://api.github.com/repos/raulcd/arrow/comments{/number}", + "commits_url":"https://api.github.com/repos/raulcd/arrow/commits{/sha}", + "compare_url":"https://api.github.com/repos/raulcd/arrow/compare/{base}...{head}", + "contents_url":"https://api.github.com/repos/raulcd/arrow/contents/{+path}", + "contributors_url":"https://api.github.com/repos/raulcd/arrow/contributors", + "created_at":1649064396, + "default_branch":"master", + "deployments_url":"https://api.github.com/repos/raulcd/arrow/deployments", + "description":"Apache Arrow is a multi-language toolbox for accelerated data interchange and in-memory processing", + "disabled":false, + "downloads_url":"https://api.github.com/repos/raulcd/arrow/downloads", + "events_url":"https://api.github.com/repos/raulcd/arrow/events", + "fork":true, + "forks":0, + "forks_count":0, + "forks_url":"https://api.github.com/repos/raulcd/arrow/forks", + "full_name":"raulcd/arrow", + "git_commits_url":"https://api.github.com/repos/raulcd/arrow/git/commits{/sha}", + "git_refs_url":"https://api.github.com/repos/raulcd/arrow/git/refs{/sha}", + "git_tags_url":"https://api.github.com/repos/raulcd/arrow/git/tags{/sha}", + "git_url":"git://github.com/raulcd/arrow.git", + "has_discussions":false, + "has_downloads":true, + "has_issues":true, + "has_pages":false, + "has_projects":true, + "has_wiki":false, + "homepage":"https://arrow.apache.org/", + "hooks_url":"https://api.github.com/repos/raulcd/arrow/hooks", + "html_url":"https://github.com/raulcd/arrow", + "id":477631451, + "is_template":false, + "issue_comment_url":"https://api.github.com/repos/raulcd/arrow/issues/comments{/number}", + "issue_events_url":"https://api.github.com/repos/raulcd/arrow/issues/events{/number}", + "issues_url":"https://api.github.com/repos/raulcd/arrow/issues{/number}", + "keys_url":"https://api.github.com/repos/raulcd/arrow/keys{/key_id}", + "labels_url":"https://api.github.com/repos/raulcd/arrow/labels{/name}", + "language":"C++", + "languages_url":"https://api.github.com/repos/raulcd/arrow/languages", + "license":{ + "key":"apache-2.0", + "name":"Apache License 2.0", + "node_id":"MDc6TGljZW5zZTI=", + "spdx_id":"Apache-2.0", + "url":"https://api.github.com/licenses/apache-2.0" + }, + "master_branch":"master", + "merges_url":"https://api.github.com/repos/raulcd/arrow/merges", + "milestones_url":"https://api.github.com/repos/raulcd/arrow/milestones{/number}", + "mirror_url":"None", + "name":"arrow", + "node_id":"R_kgDOHHgT2w", + "notifications_url":"https://api.github.com/repos/raulcd/arrow/notifications{?since,all,participating}", + "open_issues":11, + "open_issues_count":11, + "owner":{ + "avatar_url":"https://avatars.githubusercontent.com/u/639755?v=4", + "email":"raulcumplido@gmail.com", + "events_url":"https://api.github.com/users/raulcd/events{/privacy}", + "followers_url":"https://api.github.com/users/raulcd/followers", + "following_url":"https://api.github.com/users/raulcd/following{/other_user}", + "gists_url":"https://api.github.com/users/raulcd/gists{/gist_id}", + "gravatar_id":"", + "html_url":"https://github.com/raulcd", + "id":639755, + "login":"raulcd", + "name":"raulcd", + "node_id":"MDQ6VXNlcjYzOTc1NQ==", + "organizations_url":"https://api.github.com/users/raulcd/orgs", + "received_events_url":"https://api.github.com/users/raulcd/received_events", + "repos_url":"https://api.github.com/users/raulcd/repos", + "site_admin":false, + "starred_url":"https://api.github.com/users/raulcd/starred{/owner}{/repo}", + "subscriptions_url":"https://api.github.com/users/raulcd/subscriptions", + "type":"User", + "url":"https://api.github.com/users/raulcd" + }, + "private":false, + "pulls_url":"https://api.github.com/repos/raulcd/arrow/pulls{/number}", + "pushed_at":1676028624, + "releases_url":"https://api.github.com/repos/raulcd/arrow/releases{/id}", + "size":150817, + "ssh_url":"git@github.com:raulcd/arrow.git", + "stargazers":0, + "stargazers_count":0, + "stargazers_url":"https://api.github.com/repos/raulcd/arrow/stargazers", + "statuses_url":"https://api.github.com/repos/raulcd/arrow/statuses/{sha}", + "subscribers_url":"https://api.github.com/repos/raulcd/arrow/subscribers", + "subscription_url":"https://api.github.com/repos/raulcd/arrow/subscription", + "svn_url":"https://github.com/raulcd/arrow", + "tags_url":"https://api.github.com/repos/raulcd/arrow/tags", + "teams_url":"https://api.github.com/repos/raulcd/arrow/teams", + "topics":[ + + ], + "trees_url":"https://api.github.com/repos/raulcd/arrow/git/trees{/sha}", + "updated_at":"2022-11-24T17:34:08Z", + "url":"https://github.com/raulcd/arrow", + "visibility":"public", + "watchers":0, + "watchers_count":0, + "web_commit_signoff_required":false + }, + "sender":{ + "avatar_url":"https://avatars.githubusercontent.com/u/639755?v=4", + "events_url":"https://api.github.com/users/raulcd/events{/privacy}", + "followers_url":"https://api.github.com/users/raulcd/followers", + "following_url":"https://api.github.com/users/raulcd/following{/other_user}", + "gists_url":"https://api.github.com/users/raulcd/gists{/gist_id}", + "gravatar_id":"", + "html_url":"https://github.com/raulcd", + "id":639755, + "login":"raulcd", + "node_id":"MDQ6VXNlcjYzOTc1NQ==", + "organizations_url":"https://api.github.com/users/raulcd/orgs", + "received_events_url":"https://api.github.com/users/raulcd/received_events", + "repos_url":"https://api.github.com/users/raulcd/repos", + "site_admin":false, + "starred_url":"https://api.github.com/users/raulcd/starred{/owner}{/repo}", + "subscriptions_url":"https://api.github.com/users/raulcd/subscriptions", + "type":"User", + "url":"https://api.github.com/users/raulcd" + } + } \ No newline at end of file diff --git a/dev/archery/archery/tests/fixtures/label-awaiting-change-review.json b/dev/archery/archery/tests/fixtures/label-awaiting-change-review.json new file mode 100644 index 0000000000000..09ef1f597ac0c --- /dev/null +++ b/dev/archery/archery/tests/fixtures/label-awaiting-change-review.json @@ -0,0 +1,11 @@ +[ + { + "id": 3998634670, + "node_id": "LA_kwDOHHgT287uVlKu", + "url": "https://api.github.com/repos/ursa-labs/ursabot/labels/awaiting%20change%20review", + "name": "awaiting change review", + "color": "d73a4a", + "default": true, + "description": "Awaiting Change Review" + } + ] \ No newline at end of file diff --git a/dev/archery/archery/tests/fixtures/label-awaiting-changes.json b/dev/archery/archery/tests/fixtures/label-awaiting-changes.json new file mode 100644 index 0000000000000..60db81e14b32b --- /dev/null +++ b/dev/archery/archery/tests/fixtures/label-awaiting-changes.json @@ -0,0 +1,11 @@ +[ + { + "id": 3998634670, + "node_id": "LA_kwDOHHgT287uVlKu", + "url": "https://api.github.com/repos/ursa-labs/ursabot/labels/awaiting%20changes", + "name": "awaiting changes", + "color": "d73a4a", + "default": true, + "description": "Awaiting Changes" + } + ] \ No newline at end of file diff --git a/dev/archery/archery/tests/fixtures/label-awaiting-review.json b/dev/archery/archery/tests/fixtures/label-awaiting-review.json new file mode 100644 index 0000000000000..79e97b420584b --- /dev/null +++ b/dev/archery/archery/tests/fixtures/label-awaiting-review.json @@ -0,0 +1,11 @@ +[ + { + "id": 3998634670, + "node_id": "LA_kwDOHHgT287uVlKu", + "url": "https://api.github.com/repos/ursa-labs/ursabot/labels/awaiting%20review", + "name": "awaiting review", + "color": "d73a4a", + "default": true, + "description": "Awaiting Review" + } + ] \ No newline at end of file diff --git a/dev/archery/archery/tests/fixtures/pull-request-26-awaiting-review.json b/dev/archery/archery/tests/fixtures/pull-request-26-awaiting-review.json new file mode 100644 index 0000000000000..d295afb396e3c --- /dev/null +++ b/dev/archery/archery/tests/fixtures/pull-request-26-awaiting-review.json @@ -0,0 +1,329 @@ +{ + "url": "https://api.github.com/repos/ursa-labs/ursabot/pulls/26", + "id": 267785552, + "node_id": "MDExOlB1bGxSZXF1ZXN0MjY3Nzg1NTUy", + "html_url": "https://github.com/ursa-labs/ursabot/pull/26", + "diff_url": "https://github.com/ursa-labs/ursabot/pull/26.diff", + "patch_url": "https://github.com/ursa-labs/ursabot/pull/26.patch", + "issue_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/26", + "number": 26, + "state": "open", + "locked": false, + "title": "Unittests for GithubHook", + "user": { + "login": "kszucs", + "id": 961747, + "node_id": "MDQ6VXNlcjk2MTc0Nw==", + "avatar_url": "https://avatars1.githubusercontent.com/u/961747?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/kszucs", + "html_url": "https://github.com/kszucs", + "followers_url": "https://api.github.com/users/kszucs/followers", + "following_url": "https://api.github.com/users/kszucs/following{/other_user}", + "gists_url": "https://api.github.com/users/kszucs/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kszucs/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kszucs/subscriptions", + "organizations_url": "https://api.github.com/users/kszucs/orgs", + "repos_url": "https://api.github.com/users/kszucs/repos", + "events_url": "https://api.github.com/users/kszucs/events{/privacy}", + "received_events_url": "https://api.github.com/users/kszucs/received_events", + "type": "User", + "site_admin": false + }, + "body": "", + "body_html": "", + "body_text": "", + "created_at": "2019-04-05T11:22:15Z", + "updated_at": "2019-04-05T12:01:40Z", + "closed_at": null, + "merged_at": null, + "merge_commit_sha": "cc5dc3606988b3824be54df779ed2028776113cb", + "assignee": null, + "assignees": [], + "requested_reviewers": [], + "requested_teams": [], + "labels": [], + "milestone": null, + "commits_url": "https://api.github.com/repos/ursa-labs/ursabot/pulls/26/commits", + "review_comments_url": "https://api.github.com/repos/ursa-labs/ursabot/pulls/26/comments", + "review_comment_url": "https://api.github.com/repos/ursa-labs/ursabot/pulls/comments{/number}", + "comments_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/26/comments", + "statuses_url": "https://api.github.com/repos/ursa-labs/ursabot/statuses/2705da2b616b98fa6010a25813c5a7a27456f71d", + "head": { + "label": "ursa-labs:test-hook", + "ref": "test-hook", + "sha": "2705da2b616b98fa6010a25813c5a7a27456f71d", + "user": { + "login": "ursa-labs", + "id": 46514972, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjQ2NTE0OTcy", + "avatar_url": "https://avatars2.githubusercontent.com/u/46514972?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/ursa-labs", + "html_url": "https://github.com/ursa-labs", + "followers_url": "https://api.github.com/users/ursa-labs/followers", + "following_url": "https://api.github.com/users/ursa-labs/following{/other_user}", + "gists_url": "https://api.github.com/users/ursa-labs/gists{/gist_id}", + "starred_url": "https://api.github.com/users/ursa-labs/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/ursa-labs/subscriptions", + "organizations_url": "https://api.github.com/users/ursa-labs/orgs", + "repos_url": "https://api.github.com/users/ursa-labs/repos", + "events_url": "https://api.github.com/users/ursa-labs/events{/privacy}", + "received_events_url": "https://api.github.com/users/ursa-labs/received_events", + "type": "Organization", + "site_admin": false + }, + "repo": { + "id": 169101701, + "node_id": "MDEwOlJlcG9zaXRvcnkxNjkxMDE3MDE=", + "name": "ursabot", + "full_name": "ursa-labs/ursabot", + "private": false, + "owner": { + "login": "ursa-labs", + "id": 46514972, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjQ2NTE0OTcy", + "avatar_url": "https://avatars2.githubusercontent.com/u/46514972?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/ursa-labs", + "html_url": "https://github.com/ursa-labs", + "followers_url": "https://api.github.com/users/ursa-labs/followers", + "following_url": "https://api.github.com/users/ursa-labs/following{/other_user}", + "gists_url": "https://api.github.com/users/ursa-labs/gists{/gist_id}", + "starred_url": "https://api.github.com/users/ursa-labs/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/ursa-labs/subscriptions", + "organizations_url": "https://api.github.com/users/ursa-labs/orgs", + "repos_url": "https://api.github.com/users/ursa-labs/repos", + "events_url": "https://api.github.com/users/ursa-labs/events{/privacy}", + "received_events_url": "https://api.github.com/users/ursa-labs/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/ursa-labs/ursabot", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/ursa-labs/ursabot", + "forks_url": "https://api.github.com/repos/ursa-labs/ursabot/forks", + "keys_url": "https://api.github.com/repos/ursa-labs/ursabot/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/ursa-labs/ursabot/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/ursa-labs/ursabot/teams", + "hooks_url": "https://api.github.com/repos/ursa-labs/ursabot/hooks", + "issue_events_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/events{/number}", + "events_url": "https://api.github.com/repos/ursa-labs/ursabot/events", + "assignees_url": "https://api.github.com/repos/ursa-labs/ursabot/assignees{/user}", + "branches_url": "https://api.github.com/repos/ursa-labs/ursabot/branches{/branch}", + "tags_url": "https://api.github.com/repos/ursa-labs/ursabot/tags", + "blobs_url": "https://api.github.com/repos/ursa-labs/ursabot/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/ursa-labs/ursabot/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/ursa-labs/ursabot/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/ursa-labs/ursabot/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/ursa-labs/ursabot/statuses/{sha}", + "languages_url": "https://api.github.com/repos/ursa-labs/ursabot/languages", + "stargazers_url": "https://api.github.com/repos/ursa-labs/ursabot/stargazers", + "contributors_url": "https://api.github.com/repos/ursa-labs/ursabot/contributors", + "subscribers_url": "https://api.github.com/repos/ursa-labs/ursabot/subscribers", + "subscription_url": "https://api.github.com/repos/ursa-labs/ursabot/subscription", + "commits_url": "https://api.github.com/repos/ursa-labs/ursabot/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/ursa-labs/ursabot/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/ursa-labs/ursabot/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/ursa-labs/ursabot/contents/{+path}", + "compare_url": "https://api.github.com/repos/ursa-labs/ursabot/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/ursa-labs/ursabot/merges", + "archive_url": "https://api.github.com/repos/ursa-labs/ursabot/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/ursa-labs/ursabot/downloads", + "issues_url": "https://api.github.com/repos/ursa-labs/ursabot/issues{/number}", + "pulls_url": "https://api.github.com/repos/ursa-labs/ursabot/pulls{/number}", + "milestones_url": "https://api.github.com/repos/ursa-labs/ursabot/milestones{/number}", + "notifications_url": "https://api.github.com/repos/ursa-labs/ursabot/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/ursa-labs/ursabot/labels{/name}", + "releases_url": "https://api.github.com/repos/ursa-labs/ursabot/releases{/id}", + "deployments_url": "https://api.github.com/repos/ursa-labs/ursabot/deployments", + "created_at": "2019-02-04T15:40:31Z", + "updated_at": "2019-04-04T17:49:10Z", + "pushed_at": "2019-04-05T12:01:40Z", + "git_url": "git://github.com/ursa-labs/ursabot.git", + "ssh_url": "git@github.com:ursa-labs/ursabot.git", + "clone_url": "https://github.com/ursa-labs/ursabot.git", + "svn_url": "https://github.com/ursa-labs/ursabot", + "homepage": null, + "size": 898, + "stargazers_count": 1, + "watchers_count": 1, + "language": "Jupyter Notebook", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 19, + "license": null, + "forks": 0, + "open_issues": 19, + "watchers": 1, + "default_branch": "master" + } + }, + "base": { + "label": "ursa-labs:master", + "ref": "master", + "sha": "a162ad254b589b924db47e057791191b39613fd5", + "user": { + "login": "ursa-labs", + "id": 46514972, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjQ2NTE0OTcy", + "avatar_url": "https://avatars2.githubusercontent.com/u/46514972?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/ursa-labs", + "html_url": "https://github.com/ursa-labs", + "followers_url": "https://api.github.com/users/ursa-labs/followers", + "following_url": "https://api.github.com/users/ursa-labs/following{/other_user}", + "gists_url": "https://api.github.com/users/ursa-labs/gists{/gist_id}", + "starred_url": "https://api.github.com/users/ursa-labs/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/ursa-labs/subscriptions", + "organizations_url": "https://api.github.com/users/ursa-labs/orgs", + "repos_url": "https://api.github.com/users/ursa-labs/repos", + "events_url": "https://api.github.com/users/ursa-labs/events{/privacy}", + "received_events_url": "https://api.github.com/users/ursa-labs/received_events", + "type": "Organization", + "site_admin": false + }, + "repo": { + "id": 169101701, + "node_id": "MDEwOlJlcG9zaXRvcnkxNjkxMDE3MDE=", + "name": "ursabot", + "full_name": "ursa-labs/ursabot", + "private": false, + "owner": { + "login": "ursa-labs", + "id": 46514972, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjQ2NTE0OTcy", + "avatar_url": "https://avatars2.githubusercontent.com/u/46514972?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/ursa-labs", + "html_url": "https://github.com/ursa-labs", + "followers_url": "https://api.github.com/users/ursa-labs/followers", + "following_url": "https://api.github.com/users/ursa-labs/following{/other_user}", + "gists_url": "https://api.github.com/users/ursa-labs/gists{/gist_id}", + "starred_url": "https://api.github.com/users/ursa-labs/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/ursa-labs/subscriptions", + "organizations_url": "https://api.github.com/users/ursa-labs/orgs", + "repos_url": "https://api.github.com/users/ursa-labs/repos", + "events_url": "https://api.github.com/users/ursa-labs/events{/privacy}", + "received_events_url": "https://api.github.com/users/ursa-labs/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/ursa-labs/ursabot", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/ursa-labs/ursabot", + "forks_url": "https://api.github.com/repos/ursa-labs/ursabot/forks", + "keys_url": "https://api.github.com/repos/ursa-labs/ursabot/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/ursa-labs/ursabot/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/ursa-labs/ursabot/teams", + "hooks_url": "https://api.github.com/repos/ursa-labs/ursabot/hooks", + "issue_events_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/events{/number}", + "events_url": "https://api.github.com/repos/ursa-labs/ursabot/events", + "assignees_url": "https://api.github.com/repos/ursa-labs/ursabot/assignees{/user}", + "branches_url": "https://api.github.com/repos/ursa-labs/ursabot/branches{/branch}", + "tags_url": "https://api.github.com/repos/ursa-labs/ursabot/tags", + "blobs_url": "https://api.github.com/repos/ursa-labs/ursabot/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/ursa-labs/ursabot/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/ursa-labs/ursabot/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/ursa-labs/ursabot/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/ursa-labs/ursabot/statuses/{sha}", + "languages_url": "https://api.github.com/repos/ursa-labs/ursabot/languages", + "stargazers_url": "https://api.github.com/repos/ursa-labs/ursabot/stargazers", + "contributors_url": "https://api.github.com/repos/ursa-labs/ursabot/contributors", + "subscribers_url": "https://api.github.com/repos/ursa-labs/ursabot/subscribers", + "subscription_url": "https://api.github.com/repos/ursa-labs/ursabot/subscription", + "commits_url": "https://api.github.com/repos/ursa-labs/ursabot/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/ursa-labs/ursabot/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/ursa-labs/ursabot/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/ursa-labs/ursabot/contents/{+path}", + "compare_url": "https://api.github.com/repos/ursa-labs/ursabot/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/ursa-labs/ursabot/merges", + "archive_url": "https://api.github.com/repos/ursa-labs/ursabot/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/ursa-labs/ursabot/downloads", + "issues_url": "https://api.github.com/repos/ursa-labs/ursabot/issues{/number}", + "pulls_url": "https://api.github.com/repos/ursa-labs/ursabot/pulls{/number}", + "milestones_url": "https://api.github.com/repos/ursa-labs/ursabot/milestones{/number}", + "notifications_url": "https://api.github.com/repos/ursa-labs/ursabot/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/ursa-labs/ursabot/labels{/name}", + "releases_url": "https://api.github.com/repos/ursa-labs/ursabot/releases{/id}", + "deployments_url": "https://api.github.com/repos/ursa-labs/ursabot/deployments", + "created_at": "2019-02-04T15:40:31Z", + "updated_at": "2019-04-04T17:49:10Z", + "pushed_at": "2019-04-05T12:01:40Z", + "git_url": "git://github.com/ursa-labs/ursabot.git", + "ssh_url": "git@github.com:ursa-labs/ursabot.git", + "clone_url": "https://github.com/ursa-labs/ursabot.git", + "svn_url": "https://github.com/ursa-labs/ursabot", + "homepage": null, + "size": 898, + "stargazers_count": 1, + "watchers_count": 1, + "language": "Jupyter Notebook", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 19, + "license": null, + "forks": 0, + "open_issues": 19, + "watchers": 1, + "default_branch": "master" + } + }, + "_links": { + "self": { + "href": "https://api.github.com/repos/ursa-labs/ursabot/pulls/26" + }, + "html": { + "href": "https://github.com/ursa-labs/ursabot/pull/26" + }, + "issue": { + "href": "https://api.github.com/repos/ursa-labs/ursabot/issues/26" + }, + "comments": { + "href": "https://api.github.com/repos/ursa-labs/ursabot/issues/26/comments" + }, + "review_comments": { + "href": "https://api.github.com/repos/ursa-labs/ursabot/pulls/26/comments" + }, + "review_comment": { + "href": "https://api.github.com/repos/ursa-labs/ursabot/pulls/comments{/number}" + }, + "commits": { + "href": "https://api.github.com/repos/ursa-labs/ursabot/pulls/26/commits" + }, + "statuses": { + "href": "https://api.github.com/repos/ursa-labs/ursabot/statuses/2705da2b616b98fa6010a25813c5a7a27456f71d" + } + }, + "author_association": "MEMBER", + "merged": false, + "mergeable": true, + "rebaseable": true, + "mergeable_state": "unstable", + "merged_by": null, + "comments": 5, + "review_comments": 0, + "maintainer_can_modify": false, + "commits": 2, + "additions": 1124, + "deletions": 0, + "changed_files": 7 +} \ No newline at end of file diff --git a/dev/archery/archery/tests/test_bot.py b/dev/archery/archery/tests/test_bot.py index 30480b1021407..04a65593b6141 100644 --- a/dev/archery/archery/tests/test_bot.py +++ b/dev/archery/archery/tests/test_bot.py @@ -24,7 +24,13 @@ import pytest import responses as rsps -from archery.bot import CommentBot, CommandError, group +from archery.bot import ( + CommentBot, + CommandError, + PullRequestState, + PullRequestWorkflowBot, + group +) @pytest.fixture @@ -339,3 +345,238 @@ def test_issue_comment_with_commands_bot_not_first(load_fixture, responses): bot.handle('issue_comment', payload) handler.assert_not_called() + + +@pytest.mark.parametrize(('fixture_name', 'expected_label'), [ + ('event-pull-request-opened.json', PullRequestState.committer_review.value), + ('event-pull-request-opened-non-committer.json', PullRequestState.review.value), +]) +def test_open_pull_request(load_fixture, responses, fixture_name, expected_label): + responses.add( + responses.GET, + github_url('/repositories/169101701/pulls/26'), + json=load_fixture('pull-request-26.json'), + status=200 + ) + responses.add( + responses.GET, + github_url('/repos/ursa-labs/ursabot/issues/26/labels'), + json=[], + status=200 + ) + responses.add( + responses.POST, + github_url( + '/repos/ursa-labs/ursabot/issues/26/labels' + ), + status=201 + ) + payload = load_fixture(fixture_name) + + bot = PullRequestWorkflowBot('pull_request', payload, token='') + bot.handle() + + # Setting awaiting committer review or awaiting review label + post = responses.calls[-1] + assert json.loads(post.request.body) == [expected_label] + + +@pytest.mark.parametrize(('fixture_name', 'expected_label'), [ + ('event-pull-request-opened.json', PullRequestState.committer_review.value), +]) +def test_open_pull_request_with_existing_label( + load_fixture, responses, fixture_name, expected_label): + responses.add( + responses.GET, + github_url('/repositories/169101701/pulls/26'), + json=load_fixture('pull-request-26-awaiting-review.json'), + status=200 + ) + responses.add( + responses.GET, + github_url('/repos/ursa-labs/ursabot/issues/26/labels'), + json=load_fixture('label-awaiting-review.json'), + status=200 + ) + responses.add( + responses.DELETE, + github_url('/repos/ursa-labs/ursabot/issues/26/labels/awaiting%20review'), + status=200 + ) + responses.add( + responses.POST, + github_url( + '/repos/ursa-labs/ursabot/issues/26/labels' + ), + status=201 + ) + payload = load_fixture(fixture_name) + payload['pull_request']['labels'] = ['awaiting review'] + + bot = PullRequestWorkflowBot('pull_request', payload, token='') + bot.handle() + + post = responses.calls[-1] + assert json.loads(post.request.body) == [expected_label] + + +@pytest.mark.parametrize(('fixture_name', 'review_state', 'expected_label'), [ + ('event-pr-review-committer.json', 'commented', PullRequestState.changes.value), + ('event-pr-review-committer.json', 'changes_requested', + PullRequestState.changes.value), + ('event-pr-review-committer.json', 'approved', PullRequestState.merge.value), + ('event-pr-review-non-committer.json', 'commented', + PullRequestState.committer_review.value), + ('event-pr-review-non-committer.json', 'changes_requested', + PullRequestState.committer_review.value), + ('event-pr-review-non-committer.json', 'approved', + PullRequestState.committer_review.value), +]) +def test_pull_request_review_awaiting_review( + load_fixture, responses, fixture_name, review_state, expected_label): + responses.add( + responses.GET, + github_url('/repositories/169101701/pulls/26'), + json=load_fixture('pull-request-26-awaiting-review.json'), + status=200 + ) + responses.add( + responses.GET, + github_url('/repos/ursa-labs/ursabot/issues/26/labels'), + json=load_fixture('label-awaiting-review.json'), + status=200 + ) + responses.add( + responses.DELETE, + github_url('/repos/ursa-labs/ursabot/issues/26/labels/awaiting%20review'), + status=200 + ) + responses.add( + responses.POST, + github_url( + '/repos/ursa-labs/ursabot/issues/26/labels' + ), + status=201 + ) + payload = load_fixture(fixture_name) + payload['pull_request']['labels'] = ['awaiting review'] + payload['review']['state'] = review_state + + bot = PullRequestWorkflowBot('pull_request_review', payload, token='') + bot.handle() + + post = responses.calls[-1] + assert json.loads(post.request.body) == [expected_label] + + +@pytest.mark.parametrize(('review_state', 'expected_label'), [ + ('commented', PullRequestState.changes.value), + ('changes_requested', PullRequestState.changes.value), + ('approved', PullRequestState.merge.value), +]) +def test_pull_request_committer_review_awaiting_change_review( + load_fixture, responses, review_state, expected_label): + responses.add( + responses.GET, + github_url('/repositories/169101701/pulls/26'), + json=load_fixture('pull-request-26-awaiting-review.json'), + status=200 + ) + responses.add( + responses.GET, + github_url('/repos/ursa-labs/ursabot/issues/26/labels'), + json=load_fixture('label-awaiting-change-review.json'), + status=200 + ) + responses.add( + responses.DELETE, + github_url('/repos/ursa-labs/ursabot/issues/26/' + + 'labels/awaiting%20change%20review'), + status=200 + ) + responses.add( + responses.POST, + github_url( + '/repos/ursa-labs/ursabot/issues/26/labels' + ), + status=201 + ) + payload = load_fixture('event-pr-review-committer.json') + payload['pull_request']['labels'] = ['awaiting change review'] + payload['review']['state'] = review_state + + bot = PullRequestWorkflowBot('pull_request_review', payload, token='') + bot.handle() + + post = responses.calls[-1] + assert json.loads(post.request.body) == [expected_label] + + +@pytest.mark.parametrize('review_state', [ + 'commented', 'changes_requested', 'approved']) +def test_pull_request_non_committer_review_awaiting_change_review( + load_fixture, responses, review_state): + responses.add( + responses.GET, + github_url('/repositories/169101701/pulls/26'), + json=load_fixture('pull-request-26-awaiting-review.json'), + status=200 + ) + responses.add( + responses.GET, + github_url('/repos/ursa-labs/ursabot/issues/26/labels'), + json=load_fixture('label-awaiting-change-review.json'), + status=200 + ) + payload = load_fixture('event-pr-review-non-committer.json') + payload['pull_request']['labels'] = ['awaiting change review'] + payload['review']['state'] = review_state + + bot = PullRequestWorkflowBot('pull_request_review', payload, token='') + bot.handle() + + # No requests to delete / set new labels on non-committer reviews + assert len(responses.calls) == 2 + + +def test_push_event( + load_fixture, responses): + payload = load_fixture('event-push.json') + # TODO: Fix lint and improve fixtures + responses.add( + responses.GET, + github_url('/search/issues?q=qualifiers%3A%7B%27type%27%3A+%27pr%27%2C+%27repo%27%3A+%27raulcd%2Farrow%27%2C+%27sha%27%3A+%2727313fc220561ef6b0d5edb485b29684b405c80b%27%7D'), + json=load_fixture('commit-search.json'), + status=200 + ) + responses.add( + responses.GET, + github_url('/repositories/477631451/pulls/74'), + json=load_fixture('pull-request-26-awaiting-review.json'), + status=200 + ) + responses.add( + responses.GET, + github_url('/repos/ursa-labs/ursabot/issues/26/labels'), + json=load_fixture('label-awaiting-changes.json'), + status=200 + ) + responses.add( + responses.DELETE, + github_url('/repos/ursa-labs/ursabot/issues/26/' + + 'labels/awaiting%20changes'), + status=200 + ) + responses.add( + responses.POST, + github_url( + '/repos/ursa-labs/ursabot/issues/26/labels' + ), + status=201 + ) + + bot = PullRequestWorkflowBot('push', payload, token='') + bot.handle() + # after push event label changes + post = responses.calls[-1] + assert json.loads(post.request.body) == ["awaiting change review"] From 713c4a8846e0f7852fb46253de6482dee72d0c8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Fri, 10 Feb 2023 17:54:06 +0100 Subject: [PATCH 03/16] Default already opened PRs --- dev/archery/archery/bot.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dev/archery/archery/bot.py b/dev/archery/archery/bot.py index 6482edebc4aa0..c1ee7155fff40 100644 --- a/dev/archery/archery/bot.py +++ b/dev/archery/archery/bot.py @@ -178,8 +178,10 @@ def get_target_state(self, current_state): elif (self.event_name == "push" and current_state == PullRequestState.changes.value): return PullRequestState.change_review - # TODO: Test push on awaiting review! - # TODO: Implement case of PRs already opened + # TODO: Test push on awaiting review or push without label + # Default already opened PRs to Review state. + if current_state is None: + current_state = PullRequestState.review.value return PullRequestState(current_state) def set_state(self, state): From 72b0d4c8066f3ef3891410363d752fcb3cc785ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Mon, 13 Feb 2023 13:03:04 +0100 Subject: [PATCH 04/16] Fix lint --- dev/archery/archery/bot.py | 1 - dev/archery/archery/tests/test_bot.py | 11 +++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/dev/archery/archery/bot.py b/dev/archery/archery/bot.py index c1ee7155fff40..c5eef6ffc6f38 100644 --- a/dev/archery/archery/bot.py +++ b/dev/archery/archery/bot.py @@ -190,7 +190,6 @@ def set_state(self, state): def _get_pr_for_commit(self): """Find the PR containing the specific commit hash.""" sha = self.event_payload['commits'][-1]['id'] - # TODO: Validate this query is working on PR prs_for_commit = self.github.search_issues( "", qualifiers={"type": "pr", diff --git a/dev/archery/archery/tests/test_bot.py b/dev/archery/archery/tests/test_bot.py index 04a65593b6141..6edbd6185de5d 100644 --- a/dev/archery/archery/tests/test_bot.py +++ b/dev/archery/archery/tests/test_bot.py @@ -22,6 +22,7 @@ import click import pytest +from responses import matchers import responses as rsps from archery.bot import ( @@ -542,10 +543,16 @@ def test_pull_request_non_committer_review_awaiting_change_review( def test_push_event( load_fixture, responses): payload = load_fixture('event-push.json') - # TODO: Fix lint and improve fixtures + sha = '27313fc220561ef6b0d5edb485b29684b405c80b' + qualifiers = {'qualifiers': {'type': 'pr', 'repo': 'raulcd/arrow', 'sha': sha}} + url_parameters = " ".join( + [f"{qualifier}:{value}" for qualifier, value in qualifiers.items()] + ) + responses.add( responses.GET, - github_url('/search/issues?q=qualifiers%3A%7B%27type%27%3A+%27pr%27%2C+%27repo%27%3A+%27raulcd%2Farrow%27%2C+%27sha%27%3A+%2727313fc220561ef6b0d5edb485b29684b405c80b%27%7D'), + github_url('/search/issues'), + match=[matchers.query_string_matcher("q=" + url_parameters)], json=load_fixture('commit-search.json'), status=200 ) From 6e98669c807cbacac2cdc2052c8dd152a6a0518b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Mon, 13 Feb 2023 13:28:21 +0100 Subject: [PATCH 05/16] Fix fixtures to point to ursalabs repo --- .../archery/tests/fixtures/commit-search.json | 26 ++--- .../archery/tests/fixtures/event-push.json | 94 +++++++++---------- dev/archery/archery/tests/test_bot.py | 2 +- 3 files changed, 61 insertions(+), 61 deletions(-) diff --git a/dev/archery/archery/tests/fixtures/commit-search.json b/dev/archery/archery/tests/fixtures/commit-search.json index e064163191f78..c3da9aa0c4d37 100644 --- a/dev/archery/archery/tests/fixtures/commit-search.json +++ b/dev/archery/archery/tests/fixtures/commit-search.json @@ -3,15 +3,15 @@ "incomplete_results": false, "items": [ { - "url": "https://api.github.com/repos/raulcd/arrow/issues/74", - "repository_url": "https://api.github.com/repos/raulcd/arrow", - "labels_url": "https://api.github.com/repos/raulcd/arrow/issues/74/labels{/name}", - "comments_url": "https://api.github.com/repos/raulcd/arrow/issues/74/comments", - "events_url": "https://api.github.com/repos/raulcd/arrow/issues/74/events", - "html_url": "https://github.com/raulcd/arrow/pull/74", + "url": "https://api.github.com/repos/ursa-labs/ursabot/issues/26", + "repository_url": "https://api.github.com/repos/ursa-labs/ursabot", + "labels_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/26/labels{/name}", + "comments_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/26/comments", + "events_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/26/events", + "html_url": "https://github.com/ursa-labs/ursabot/pull/26", "id": 1572348024, "node_id": "PR_kwDOHHgT285JU-KQ", - "number": 74, + "number": 26, "title": "Pr workflow automation poc", "user": { "login": "raulcd", @@ -51,15 +51,15 @@ "active_lock_reason": null, "draft": true, "pull_request": { - "url": "https://api.github.com/repos/raulcd/arrow/pulls/74", - "html_url": "https://github.com/raulcd/arrow/pull/74", - "diff_url": "https://github.com/raulcd/arrow/pull/74.diff", - "patch_url": "https://github.com/raulcd/arrow/pull/74.patch", + "url": "https://api.github.com/repos/ursa-labs/ursabot/pulls/26", + "html_url": "https://github.com/ursa-labs/ursabot/pull/26", + "diff_url": "https://github.com/ursa-labs/ursabot/pull/26.diff", + "patch_url": "https://github.com/ursa-labs/ursabot/pull/26.patch", "merged_at": null }, "body": "\r\n\r\n### Rationale for this change\r\n\r\n\r\n\r\n### What changes are included in this PR?\r\n\r\n\r\n\r\n### Are these changes tested?\r\n\r\n\r\n\r\n### Are there any user-facing changes?\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n", "reactions": { - "url": "https://api.github.com/repos/raulcd/arrow/issues/74/reactions", + "url": "https://api.github.com/repos/ursa-labs/ursabot/issues/26/reactions", "total_count": 0, "+1": 0, "-1": 0, @@ -70,7 +70,7 @@ "rocket": 0, "eyes": 0 }, - "timeline_url": "https://api.github.com/repos/raulcd/arrow/issues/74/timeline", + "timeline_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/26/timeline", "performed_via_github_app": null, "state_reason": null, "score": 1.0 diff --git a/dev/archery/archery/tests/fixtures/event-push.json b/dev/archery/archery/tests/fixtures/event-push.json index d0d108b294954..345d0067fb768 100644 --- a/dev/archery/archery/tests/fixtures/event-push.json +++ b/dev/archery/archery/tests/fixtures/event-push.json @@ -19,10 +19,10 @@ "message":"Initial GitHub Workflow triggering archery bot", "timestamp":"2023-02-10T12:30:01+01:00", "tree_id":"c079a4afb0178472534363c85a01c7b7fa33daba", - "url":"https://github.com/raulcd/arrow/commit/27313fc220561ef6b0d5edb485b29684b405c80b" + "url":"https://github.com/ursa-labs/ursabot/commit/27313fc220561ef6b0d5edb485b29684b405c80b" } ], - "compare":"https://github.com/raulcd/arrow/compare/8e95c04a2930...27313fc22056", + "compare":"https://github.com/ursa-labs/ursabot/compare/8e95c04a2930...27313fc22056", "created":false, "deleted":false, "forced":true, @@ -42,7 +42,7 @@ "message":"Initial GitHub Workflow triggering archery bot", "timestamp":"2023-02-10T12:30:01+01:00", "tree_id":"c079a4afb0178472534363c85a01c7b7fa33daba", - "url":"https://github.com/raulcd/arrow/commit/27313fc220561ef6b0d5edb485b29684b405c80b" + "url":"https://github.com/ursa-labs/ursabot/commit/27313fc220561ef6b0d5edb485b29684b405c80b" }, "pusher":{ "email":"raulcumplido@gmail.com", @@ -51,34 +51,34 @@ "ref":"refs/heads/pr-workflow-automation-poc", "repository":{ "allow_forking":true, - "archive_url":"https://api.github.com/repos/raulcd/arrow/{archive_format}{/ref}", + "archive_url":"https://api.github.com/repos/ursa-labs/ursabot/{archive_format}{/ref}", "archived":false, - "assignees_url":"https://api.github.com/repos/raulcd/arrow/assignees{/user}", - "blobs_url":"https://api.github.com/repos/raulcd/arrow/git/blobs{/sha}", - "branches_url":"https://api.github.com/repos/raulcd/arrow/branches{/branch}", - "clone_url":"https://github.com/raulcd/arrow.git", - "collaborators_url":"https://api.github.com/repos/raulcd/arrow/collaborators{/collaborator}", - "comments_url":"https://api.github.com/repos/raulcd/arrow/comments{/number}", - "commits_url":"https://api.github.com/repos/raulcd/arrow/commits{/sha}", - "compare_url":"https://api.github.com/repos/raulcd/arrow/compare/{base}...{head}", - "contents_url":"https://api.github.com/repos/raulcd/arrow/contents/{+path}", - "contributors_url":"https://api.github.com/repos/raulcd/arrow/contributors", + "assignees_url":"https://api.github.com/repos/ursa-labs/ursabot/assignees{/user}", + "blobs_url":"https://api.github.com/repos/ursa-labs/ursabot/git/blobs{/sha}", + "branches_url":"https://api.github.com/repos/ursa-labs/ursabot/branches{/branch}", + "clone_url":"https://github.com/ursa-labs/ursabot.git", + "collaborators_url":"https://api.github.com/repos/ursa-labs/ursabot/collaborators{/collaborator}", + "comments_url":"https://api.github.com/repos/ursa-labs/ursabot/comments{/number}", + "commits_url":"https://api.github.com/repos/ursa-labs/ursabot/commits{/sha}", + "compare_url":"https://api.github.com/repos/ursa-labs/ursabot/compare/{base}...{head}", + "contents_url":"https://api.github.com/repos/ursa-labs/ursabot/contents/{+path}", + "contributors_url":"https://api.github.com/repos/ursa-labs/ursabot/contributors", "created_at":1649064396, "default_branch":"master", - "deployments_url":"https://api.github.com/repos/raulcd/arrow/deployments", + "deployments_url":"https://api.github.com/repos/ursa-labs/ursabot/deployments", "description":"Apache Arrow is a multi-language toolbox for accelerated data interchange and in-memory processing", "disabled":false, - "downloads_url":"https://api.github.com/repos/raulcd/arrow/downloads", - "events_url":"https://api.github.com/repos/raulcd/arrow/events", + "downloads_url":"https://api.github.com/repos/ursa-labs/ursabot/downloads", + "events_url":"https://api.github.com/repos/ursa-labs/ursabot/events", "fork":true, "forks":0, "forks_count":0, - "forks_url":"https://api.github.com/repos/raulcd/arrow/forks", - "full_name":"raulcd/arrow", - "git_commits_url":"https://api.github.com/repos/raulcd/arrow/git/commits{/sha}", - "git_refs_url":"https://api.github.com/repos/raulcd/arrow/git/refs{/sha}", - "git_tags_url":"https://api.github.com/repos/raulcd/arrow/git/tags{/sha}", - "git_url":"git://github.com/raulcd/arrow.git", + "forks_url":"https://api.github.com/repos/ursa-labs/ursabot/forks", + "full_name":"ursa-labs/ursabot", + "git_commits_url":"https://api.github.com/repos/ursa-labs/ursabot/git/commits{/sha}", + "git_refs_url":"https://api.github.com/repos/ursa-labs/ursabot/git/refs{/sha}", + "git_tags_url":"https://api.github.com/repos/ursa-labs/ursabot/git/tags{/sha}", + "git_url":"git://github.com/ursa-labs/ursabot.git", "has_discussions":false, "has_downloads":true, "has_issues":true, @@ -86,17 +86,17 @@ "has_projects":true, "has_wiki":false, "homepage":"https://arrow.apache.org/", - "hooks_url":"https://api.github.com/repos/raulcd/arrow/hooks", - "html_url":"https://github.com/raulcd/arrow", - "id":477631451, + "hooks_url":"https://api.github.com/repos/ursa-labs/ursabot/hooks", + "html_url":"https://github.com/ursa-labs/ursabot", + "id":169101701, "is_template":false, - "issue_comment_url":"https://api.github.com/repos/raulcd/arrow/issues/comments{/number}", - "issue_events_url":"https://api.github.com/repos/raulcd/arrow/issues/events{/number}", - "issues_url":"https://api.github.com/repos/raulcd/arrow/issues{/number}", - "keys_url":"https://api.github.com/repos/raulcd/arrow/keys{/key_id}", - "labels_url":"https://api.github.com/repos/raulcd/arrow/labels{/name}", + "issue_comment_url":"https://api.github.com/repos/ursa-labs/ursabot/issues/comments{/number}", + "issue_events_url":"https://api.github.com/repos/ursa-labs/ursabot/issues/events{/number}", + "issues_url":"https://api.github.com/repos/ursa-labs/ursabot/issues{/number}", + "keys_url":"https://api.github.com/repos/ursa-labs/ursabot/keys{/key_id}", + "labels_url":"https://api.github.com/repos/ursa-labs/ursabot/labels{/name}", "language":"C++", - "languages_url":"https://api.github.com/repos/raulcd/arrow/languages", + "languages_url":"https://api.github.com/repos/ursa-labs/ursabot/languages", "license":{ "key":"apache-2.0", "name":"Apache License 2.0", @@ -105,12 +105,12 @@ "url":"https://api.github.com/licenses/apache-2.0" }, "master_branch":"master", - "merges_url":"https://api.github.com/repos/raulcd/arrow/merges", - "milestones_url":"https://api.github.com/repos/raulcd/arrow/milestones{/number}", + "merges_url":"https://api.github.com/repos/ursa-labs/ursabot/merges", + "milestones_url":"https://api.github.com/repos/ursa-labs/ursabot/milestones{/number}", "mirror_url":"None", "name":"arrow", "node_id":"R_kgDOHHgT2w", - "notifications_url":"https://api.github.com/repos/raulcd/arrow/notifications{?since,all,participating}", + "notifications_url":"https://api.github.com/repos/ursa-labs/ursabot/notifications{?since,all,participating}", "open_issues":11, "open_issues_count":11, "owner":{ @@ -136,26 +136,26 @@ "url":"https://api.github.com/users/raulcd" }, "private":false, - "pulls_url":"https://api.github.com/repos/raulcd/arrow/pulls{/number}", + "pulls_url":"https://api.github.com/repos/ursa-labs/ursabot/pulls{/number}", "pushed_at":1676028624, - "releases_url":"https://api.github.com/repos/raulcd/arrow/releases{/id}", + "releases_url":"https://api.github.com/repos/ursa-labs/ursabot/releases{/id}", "size":150817, - "ssh_url":"git@github.com:raulcd/arrow.git", + "ssh_url":"git@github.com:ursa-labs/ursabot.git", "stargazers":0, "stargazers_count":0, - "stargazers_url":"https://api.github.com/repos/raulcd/arrow/stargazers", - "statuses_url":"https://api.github.com/repos/raulcd/arrow/statuses/{sha}", - "subscribers_url":"https://api.github.com/repos/raulcd/arrow/subscribers", - "subscription_url":"https://api.github.com/repos/raulcd/arrow/subscription", - "svn_url":"https://github.com/raulcd/arrow", - "tags_url":"https://api.github.com/repos/raulcd/arrow/tags", - "teams_url":"https://api.github.com/repos/raulcd/arrow/teams", + "stargazers_url":"https://api.github.com/repos/ursa-labs/ursabot/stargazers", + "statuses_url":"https://api.github.com/repos/ursa-labs/ursabot/statuses/{sha}", + "subscribers_url":"https://api.github.com/repos/ursa-labs/ursabot/subscribers", + "subscription_url":"https://api.github.com/repos/ursa-labs/ursabot/subscription", + "svn_url":"https://github.com/ursa-labs/ursabot", + "tags_url":"https://api.github.com/repos/ursa-labs/ursabot/tags", + "teams_url":"https://api.github.com/repos/ursa-labs/ursabot/teams", "topics":[ ], - "trees_url":"https://api.github.com/repos/raulcd/arrow/git/trees{/sha}", + "trees_url":"https://api.github.com/repos/ursa-labs/ursabot/git/trees{/sha}", "updated_at":"2022-11-24T17:34:08Z", - "url":"https://github.com/raulcd/arrow", + "url":"https://github.com/ursa-labs/ursabot", "visibility":"public", "watchers":0, "watchers_count":0, diff --git a/dev/archery/archery/tests/test_bot.py b/dev/archery/archery/tests/test_bot.py index 6edbd6185de5d..aa641bb07354e 100644 --- a/dev/archery/archery/tests/test_bot.py +++ b/dev/archery/archery/tests/test_bot.py @@ -558,7 +558,7 @@ def test_push_event( ) responses.add( responses.GET, - github_url('/repositories/477631451/pulls/74'), + github_url('/repositories/169101701/pulls/26'), json=load_fixture('pull-request-26-awaiting-review.json'), status=200 ) From 0cd562e0f98ef9f04557ee0008161c5bf0861c64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Mon, 13 Feb 2023 15:01:59 +0100 Subject: [PATCH 06/16] Add more tests and some documentation --- dev/archery/archery/bot.py | 19 +++++- dev/archery/archery/cli.py | 1 - dev/archery/archery/tests/test_bot.py | 84 ++++++++++++++++++++++++++- 3 files changed, 99 insertions(+), 5 deletions(-) diff --git a/dev/archery/archery/bot.py b/dev/archery/archery/bot.py index c5eef6ffc6f38..c7636e0e06895 100644 --- a/dev/archery/archery/bot.py +++ b/dev/archery/archery/bot.py @@ -113,6 +113,10 @@ def __init__(self, event_name, event_payload, token=None): @cached_property def pull(self): + """ + Returns a github.PullRequest object associated with the event. + In case of a commit we search the PR associated with the commit. + """ if self.event_name == 'push': return self._get_pr_for_commit() else: @@ -137,6 +141,12 @@ def handle(self): self.set_state(new_state) def get_current_state(self): + """ + Returns a string with the current PR state label + based on label starting with LABEL_PREFIX. + If more than one label is found raises EventError. + If no label is found returns None. + """ states = [label.name for label in self.pull.get_labels() if label.name.startswith(LABEL_PREFIX)] if len(states) > 1: @@ -145,11 +155,18 @@ def get_current_state(self): return states[0] def clear_current_state(self): + """ + Removes all existing labels starting with LABEL_PREFIX + """ for label in self.pull.get_labels(): if label.name.startswith(LABEL_PREFIX): self.pull.remove_from_labels(label) def get_target_state(self, current_state): + """ + Returns the expected target state based on the event and + the current state. + """ if (self.event_name == "pull_request" and self.event_payload['action'] == 'opened'): if (self.event_payload['pull_request']['author_association'] in @@ -178,13 +195,13 @@ def get_target_state(self, current_state): elif (self.event_name == "push" and current_state == PullRequestState.changes.value): return PullRequestState.change_review - # TODO: Test push on awaiting review or push without label # Default already opened PRs to Review state. if current_state is None: current_state = PullRequestState.review.value return PullRequestState(current_state) def set_state(self, state): + """Sets the State label to the PR.""" self.pull.add_to_labels(state.value) def _get_pr_for_commit(self): diff --git a/dev/archery/archery/cli.py b/dev/archery/archery/cli.py index 8baada6aa1959..146b3babdc2b8 100644 --- a/dev/archery/archery/cli.py +++ b/dev/archery/archery/cli.py @@ -788,7 +788,6 @@ def trigger_bot(event_name, event_payload, arrow_token): bot = CommentBot(name='github-actions', handler=actions, token=arrow_token) bot.handle(event_name, event_payload) else: - # TODO: Make API for both classes more consistent bot = PullRequestWorkflowBot(event_name, event_payload, token=arrow_token) bot.handle() diff --git a/dev/archery/archery/tests/test_bot.py b/dev/archery/archery/tests/test_bot.py index aa641bb07354e..2a337712bb3d1 100644 --- a/dev/archery/archery/tests/test_bot.py +++ b/dev/archery/archery/tests/test_bot.py @@ -536,11 +536,11 @@ def test_pull_request_non_committer_review_awaiting_change_review( bot = PullRequestWorkflowBot('pull_request_review', payload, token='') bot.handle() - # No requests to delete / set new labels on non-committer reviews + # No requests to delete post new labels on non-committer reviews assert len(responses.calls) == 2 -def test_push_event( +def test_push_event_on_awaiting_changes( load_fixture, responses): payload = load_fixture('event-push.json') sha = '27313fc220561ef6b0d5edb485b29684b405c80b' @@ -584,6 +584,84 @@ def test_push_event( bot = PullRequestWorkflowBot('push', payload, token='') bot.handle() - # after push event label changes + # after push event label changes. post = responses.calls[-1] assert json.loads(post.request.body) == ["awaiting change review"] + + +def test_push_event_on_awaiting_review( + load_fixture, responses): + payload = load_fixture('event-push.json') + sha = '27313fc220561ef6b0d5edb485b29684b405c80b' + qualifiers = {'qualifiers': {'type': 'pr', 'repo': 'raulcd/arrow', 'sha': sha}} + url_parameters = " ".join( + [f"{qualifier}:{value}" for qualifier, value in qualifiers.items()] + ) + + responses.add( + responses.GET, + github_url('/search/issues'), + match=[matchers.query_string_matcher("q=" + url_parameters)], + json=load_fixture('commit-search.json'), + status=200 + ) + responses.add( + responses.GET, + github_url('/repositories/169101701/pulls/26'), + json=load_fixture('pull-request-26-awaiting-review.json'), + status=200 + ) + responses.add( + responses.GET, + github_url('/repos/ursa-labs/ursabot/issues/26/labels'), + json=load_fixture('label-awaiting-review.json'), + status=200 + ) + + bot = PullRequestWorkflowBot('push', payload, token='') + bot.handle() + # No requests to delete or post new labels on push awaiting review + assert len(responses.calls) == 3 + + +def test_push_event_on_existing_pr_without_state( + load_fixture, responses): + payload = load_fixture('event-push.json') + sha = '27313fc220561ef6b0d5edb485b29684b405c80b' + qualifiers = {'qualifiers': {'type': 'pr', 'repo': 'raulcd/arrow', 'sha': sha}} + url_parameters = " ".join( + [f"{qualifier}:{value}" for qualifier, value in qualifiers.items()] + ) + + responses.add( + responses.GET, + github_url('/search/issues'), + match=[matchers.query_string_matcher("q=" + url_parameters)], + json=load_fixture('commit-search.json'), + status=200 + ) + responses.add( + responses.GET, + github_url('/repositories/169101701/pulls/26'), + json=load_fixture('pull-request-26.json'), + status=200 + ) + responses.add( + responses.GET, + github_url('/repos/ursa-labs/ursabot/issues/26/labels'), + json=[], + status=200 + ) + responses.add( + responses.POST, + github_url( + '/repos/ursa-labs/ursabot/issues/26/labels' + ), + status=201 + ) + + bot = PullRequestWorkflowBot('push', payload, token='') + bot.handle() + # after push event label get set to default + post = responses.calls[-1] + assert json.loads(post.request.body) == ["awaiting review"] From 399375e5696b1db568b3055e2be156ed1aad2db2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Mon, 13 Feb 2023 15:17:33 +0100 Subject: [PATCH 07/16] Retrieve repo name from event_payload and add license header to workflow --- .github/workflows/pr_bot.yml | 24 +++++++++++++++++++++--- dev/archery/archery/bot.py | 3 ++- dev/archery/archery/tests/test_bot.py | 6 +++--- 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pr_bot.yml b/.github/workflows/pr_bot.yml index f43f8cfa72bcd..0f270819b14c9 100644 --- a/.github/workflows/pr_bot.yml +++ b/.github/workflows/pr_bot.yml @@ -1,4 +1,21 @@ -name: pr-bot +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +name: pr-workflow-bot on: pull_request: types: @@ -11,7 +28,8 @@ on: push: jobs: - run-pr-bot: + pr-workflow-bot-job: + name: "PR Workflow bot" permissions: contents: read pull-requests: write @@ -36,4 +54,4 @@ jobs: run: | archery trigger-bot \ --event-name ${{ github.event_name }} \ - --event-payload ${{ github.event_path }} \ No newline at end of file + --event-payload ${{ github.event_path }} diff --git a/dev/archery/archery/bot.py b/dev/archery/archery/bot.py index c7636e0e06895..a4f893b76b5de 100644 --- a/dev/archery/archery/bot.py +++ b/dev/archery/archery/bot.py @@ -207,10 +207,11 @@ def set_state(self, state): def _get_pr_for_commit(self): """Find the PR containing the specific commit hash.""" sha = self.event_payload['commits'][-1]['id'] + repo = self.event_payload['repository']['full_name'] prs_for_commit = self.github.search_issues( "", qualifiers={"type": "pr", - "repo": "raulcd/arrow", + "repo": repo, "sha": sha} ) pull = None diff --git a/dev/archery/archery/tests/test_bot.py b/dev/archery/archery/tests/test_bot.py index 2a337712bb3d1..21ba38064be69 100644 --- a/dev/archery/archery/tests/test_bot.py +++ b/dev/archery/archery/tests/test_bot.py @@ -544,7 +544,7 @@ def test_push_event_on_awaiting_changes( load_fixture, responses): payload = load_fixture('event-push.json') sha = '27313fc220561ef6b0d5edb485b29684b405c80b' - qualifiers = {'qualifiers': {'type': 'pr', 'repo': 'raulcd/arrow', 'sha': sha}} + qualifiers = {'qualifiers': {'type': 'pr', 'repo': 'ursa-labs/ursabot', 'sha': sha}} url_parameters = " ".join( [f"{qualifier}:{value}" for qualifier, value in qualifiers.items()] ) @@ -593,7 +593,7 @@ def test_push_event_on_awaiting_review( load_fixture, responses): payload = load_fixture('event-push.json') sha = '27313fc220561ef6b0d5edb485b29684b405c80b' - qualifiers = {'qualifiers': {'type': 'pr', 'repo': 'raulcd/arrow', 'sha': sha}} + qualifiers = {'qualifiers': {'type': 'pr', 'repo': 'ursa-labs/ursabot', 'sha': sha}} url_parameters = " ".join( [f"{qualifier}:{value}" for qualifier, value in qualifiers.items()] ) @@ -628,7 +628,7 @@ def test_push_event_on_existing_pr_without_state( load_fixture, responses): payload = load_fixture('event-push.json') sha = '27313fc220561ef6b0d5edb485b29684b405c80b' - qualifiers = {'qualifiers': {'type': 'pr', 'repo': 'raulcd/arrow', 'sha': sha}} + qualifiers = {'qualifiers': {'type': 'pr', 'repo': 'ursa-labs/ursabot', 'sha': sha}} url_parameters = " ".join( [f"{qualifier}:{value}" for qualifier, value in qualifiers.items()] ) From 9306409ce79a3e673b1b658123a387998f06ecb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Mon, 13 Feb 2023 15:43:41 +0100 Subject: [PATCH 08/16] Fix typo --- dev/archery/archery/bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/archery/archery/bot.py b/dev/archery/archery/bot.py index a4f893b76b5de..ba6b9c09e077b 100644 --- a/dev/archery/archery/bot.py +++ b/dev/archery/archery/bot.py @@ -95,7 +95,7 @@ class PullRequestState(enum.Enum): """State of a pull request.""" review = f"{LABEL_PREFIX} review" - committer_review = f"{LABEL_PREFIX} comitter review" + committer_review = f"{LABEL_PREFIX} committer review" changes = f"{LABEL_PREFIX} changes" change_review = f"{LABEL_PREFIX} change review" merge = f"{LABEL_PREFIX} merge" From 6f61ae8264fe79b8156e551b42816846c27ee739 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Mon, 13 Feb 2023 15:51:08 +0100 Subject: [PATCH 09/16] Issues permissions seems required to add labels --- .github/workflows/pr_bot.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pr_bot.yml b/.github/workflows/pr_bot.yml index 0f270819b14c9..0c1dfcaefb523 100644 --- a/.github/workflows/pr_bot.yml +++ b/.github/workflows/pr_bot.yml @@ -33,6 +33,7 @@ jobs: permissions: contents: read pull-requests: write + issues: write runs-on: ubuntu-latest steps: - name: Checkout Arrow From fcf3305fdc91c1956326c8d517bb2155db2f99a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Mon, 13 Feb 2023 15:56:43 +0100 Subject: [PATCH 10/16] try with apache/arrow repo --- dev/archery/archery/bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/archery/archery/bot.py b/dev/archery/archery/bot.py index ba6b9c09e077b..4a496234fc65e 100644 --- a/dev/archery/archery/bot.py +++ b/dev/archery/archery/bot.py @@ -211,7 +211,7 @@ def _get_pr_for_commit(self): prs_for_commit = self.github.search_issues( "", qualifiers={"type": "pr", - "repo": repo, + "repo": "apache/arrow", "sha": sha} ) pull = None From 25188f8a7657dcd4e707a630ce198f27440fbc7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Wed, 15 Feb 2023 12:16:05 +0100 Subject: [PATCH 11/16] Change event pull_request and push to pull_request_target --- .github/workflows/pr_bot.yml | 18 +++++++++++------- dev/archery/archery/bot.py | 29 +++++------------------------ 2 files changed, 16 insertions(+), 31 deletions(-) diff --git a/.github/workflows/pr_bot.yml b/.github/workflows/pr_bot.yml index 0c1dfcaefb523..704a8ea05d994 100644 --- a/.github/workflows/pr_bot.yml +++ b/.github/workflows/pr_bot.yml @@ -15,31 +15,35 @@ # specific language governing permissions and limitations # under the License. -name: pr-workflow-bot +name: "Workflow label bot" on: - pull_request: + pull_request_target: types: - opened - converted_to_draft - ready_for_review + - synchronize pull_request_review: types: - submitted - push: + +permissions: + contents: read + pull-requests: write + issues: write jobs: pr-workflow-bot-job: name: "PR Workflow bot" - permissions: - contents: read - pull-requests: write - issues: write runs-on: ubuntu-latest steps: - name: Checkout Arrow uses: actions/checkout@v3 with: path: arrow + repository: apache/arrow + ref: master + persist-credentials: false # fetch the tags for version number generation fetch-depth: 0 - name: Set up Python diff --git a/dev/archery/archery/bot.py b/dev/archery/archery/bot.py index 4a496234fc65e..c31f3f15ee7fd 100644 --- a/dev/archery/archery/bot.py +++ b/dev/archery/archery/bot.py @@ -115,18 +115,15 @@ def __init__(self, event_name, event_payload, token=None): def pull(self): """ Returns a github.PullRequest object associated with the event. - In case of a commit we search the PR associated with the commit. """ - if self.event_name == 'push': - return self._get_pr_for_commit() - else: - return self.repo.get_pull(self.event_payload['pull_request']['number']) + return self.repo.get_pull(self.event_payload['pull_request']['number']) @cached_property def repo(self): return self.github.get_repo(self.event_payload['repository']['id'], lazy=True) def handle(self): + print(f"event_name: {self.event_name} - event_payload: {self.event_payload}") current_state = None try: current_state = self.get_current_state() @@ -167,7 +164,7 @@ def get_target_state(self, current_state): Returns the expected target state based on the event and the current state. """ - if (self.event_name == "pull_request" and + if (self.event_name == "pull_request_target" and self.event_payload['action'] == 'opened'): if (self.event_payload['pull_request']['author_association'] in COMMITTER_ROLES): @@ -192,7 +189,8 @@ def get_target_state(self, current_state): return PullRequestState.merge elif review_state in ("changes_requested", "commented"): return PullRequestState.changes - elif (self.event_name == "push" and + elif (self.event_name == "pull_request_target" and + self.event_payload['action'] == 'synchronize' and current_state == PullRequestState.changes.value): return PullRequestState.change_review # Default already opened PRs to Review state. @@ -204,23 +202,6 @@ def set_state(self, state): """Sets the State label to the PR.""" self.pull.add_to_labels(state.value) - def _get_pr_for_commit(self): - """Find the PR containing the specific commit hash.""" - sha = self.event_payload['commits'][-1]['id'] - repo = self.event_payload['repository']['full_name'] - prs_for_commit = self.github.search_issues( - "", - qualifiers={"type": "pr", - "repo": "apache/arrow", - "sha": sha} - ) - pull = None - try: - pull = self.repo.get_pull(prs_for_commit[0].number) - except IndexError: - pass - return pull - class CommentBot: From 2f4d12baf6b04b458df0ab9822392a797be64bf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Wed, 15 Feb 2023 12:54:56 +0100 Subject: [PATCH 12/16] Update tests and event fixtures --- ...ent-pull-request-opened-non-committer.json | 445 ----------------- ...-pull-request-target-opened-committer.json | 459 +++++++++++++++++ ...l-request-target-opened-non-committer.json | 459 +++++++++++++++++ ...event-pull-request-target-synchronize.json | 461 ++++++++++++++++++ .../archery/tests/fixtures/event-push.json | 184 ------- dev/archery/archery/tests/test_bot.py | 70 +-- 6 files changed, 1397 insertions(+), 681 deletions(-) delete mode 100644 dev/archery/archery/tests/fixtures/event-pull-request-opened-non-committer.json create mode 100644 dev/archery/archery/tests/fixtures/event-pull-request-target-opened-committer.json create mode 100644 dev/archery/archery/tests/fixtures/event-pull-request-target-opened-non-committer.json create mode 100644 dev/archery/archery/tests/fixtures/event-pull-request-target-synchronize.json delete mode 100644 dev/archery/archery/tests/fixtures/event-push.json diff --git a/dev/archery/archery/tests/fixtures/event-pull-request-opened-non-committer.json b/dev/archery/archery/tests/fixtures/event-pull-request-opened-non-committer.json deleted file mode 100644 index d11047705069e..0000000000000 --- a/dev/archery/archery/tests/fixtures/event-pull-request-opened-non-committer.json +++ /dev/null @@ -1,445 +0,0 @@ -{ - "action": "opened", - "number": 26, - "pull_request": { - "url": "https://api.github.com/repos/ursa-labs/ursabot/pulls/26", - "id": 267785552, - "node_id": "MDExOlB1bGxSZXF1ZXN0MjY3Nzg1NTUy", - "html_url": "https://github.com/ursa-labs/ursabot/pull/26", - "diff_url": "https://github.com/ursa-labs/ursabot/pull/26.diff", - "patch_url": "https://github.com/ursa-labs/ursabot/pull/26.patch", - "issue_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/26", - "number": 26, - "state": "open", - "locked": false, - "title": "Unittests for GithubHook", - "user": { - "login": "kszucs", - "id": 961747, - "node_id": "MDQ6VXNlcjk2MTc0Nw==", - "avatar_url": "https://avatars1.githubusercontent.com/u/961747?v=4", - "gravatar_id": "", - "url": "https://api.github.com/users/kszucs", - "html_url": "https://github.com/kszucs", - "followers_url": "https://api.github.com/users/kszucs/followers", - "following_url": "https://api.github.com/users/kszucs/following{/other_user}", - "gists_url": "https://api.github.com/users/kszucs/gists{/gist_id}", - "starred_url": "https://api.github.com/users/kszucs/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/kszucs/subscriptions", - "organizations_url": "https://api.github.com/users/kszucs/orgs", - "repos_url": "https://api.github.com/users/kszucs/repos", - "events_url": "https://api.github.com/users/kszucs/events{/privacy}", - "received_events_url": "https://api.github.com/users/kszucs/received_events", - "type": "User", - "site_admin": false - }, - "body": "", - "created_at": "2019-04-05T11:22:15Z", - "updated_at": "2019-04-05T12:01:40Z", - "closed_at": null, - "merged_at": null, - "merge_commit_sha": "cc5dc3606988b3824be54df779ed2028776113cb", - "assignee": null, - "assignees": [], - "requested_reviewers": [], - "requested_teams": [], - "labels": [], - "milestone": null, - "commits_url": "https://api.github.com/repos/ursa-labs/ursabot/pulls/26/commits", - "review_comments_url": "https://api.github.com/repos/ursa-labs/ursabot/pulls/26/comments", - "review_comment_url": "https://api.github.com/repos/ursa-labs/ursabot/pulls/comments{/number}", - "comments_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/26/comments", - "statuses_url": "https://api.github.com/repos/ursa-labs/ursabot/statuses/2705da2b616b98fa6010a25813c5a7a27456f71d", - "head": { - "label": "ursa-labs:test-hook", - "ref": "test-hook", - "sha": "2705da2b616b98fa6010a25813c5a7a27456f71d", - "user": { - "login": "ursa-labs", - "id": 46514972, - "node_id": "MDEyOk9yZ2FuaXphdGlvbjQ2NTE0OTcy", - "avatar_url": "https://avatars2.githubusercontent.com/u/46514972?v=4", - "gravatar_id": "", - "url": "https://api.github.com/users/ursa-labs", - "html_url": "https://github.com/ursa-labs", - "followers_url": "https://api.github.com/users/ursa-labs/followers", - "following_url": "https://api.github.com/users/ursa-labs/following{/other_user}", - "gists_url": "https://api.github.com/users/ursa-labs/gists{/gist_id}", - "starred_url": "https://api.github.com/users/ursa-labs/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/ursa-labs/subscriptions", - "organizations_url": "https://api.github.com/users/ursa-labs/orgs", - "repos_url": "https://api.github.com/users/ursa-labs/repos", - "events_url": "https://api.github.com/users/ursa-labs/events{/privacy}", - "received_events_url": "https://api.github.com/users/ursa-labs/received_events", - "type": "Organization", - "site_admin": false - }, - "repo": { - "id": 169101701, - "node_id": "MDEwOlJlcG9zaXRvcnkxNjkxMDE3MDE=", - "name": "ursabot", - "full_name": "ursa-labs/ursabot", - "private": false, - "owner": { - "login": "ursa-labs", - "id": 46514972, - "node_id": "MDEyOk9yZ2FuaXphdGlvbjQ2NTE0OTcy", - "avatar_url": "https://avatars2.githubusercontent.com/u/46514972?v=4", - "gravatar_id": "", - "url": "https://api.github.com/users/ursa-labs", - "html_url": "https://github.com/ursa-labs", - "followers_url": "https://api.github.com/users/ursa-labs/followers", - "following_url": "https://api.github.com/users/ursa-labs/following{/other_user}", - "gists_url": "https://api.github.com/users/ursa-labs/gists{/gist_id}", - "starred_url": "https://api.github.com/users/ursa-labs/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/ursa-labs/subscriptions", - "organizations_url": "https://api.github.com/users/ursa-labs/orgs", - "repos_url": "https://api.github.com/users/ursa-labs/repos", - "events_url": "https://api.github.com/users/ursa-labs/events{/privacy}", - "received_events_url": "https://api.github.com/users/ursa-labs/received_events", - "type": "Organization", - "site_admin": false - }, - "html_url": "https://github.com/ursa-labs/ursabot", - "description": null, - "fork": false, - "url": "https://api.github.com/repos/ursa-labs/ursabot", - "forks_url": "https://api.github.com/repos/ursa-labs/ursabot/forks", - "keys_url": "https://api.github.com/repos/ursa-labs/ursabot/keys{/key_id}", - "collaborators_url": "https://api.github.com/repos/ursa-labs/ursabot/collaborators{/collaborator}", - "teams_url": "https://api.github.com/repos/ursa-labs/ursabot/teams", - "hooks_url": "https://api.github.com/repos/ursa-labs/ursabot/hooks", - "issue_events_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/events{/number}", - "events_url": "https://api.github.com/repos/ursa-labs/ursabot/events", - "assignees_url": "https://api.github.com/repos/ursa-labs/ursabot/assignees{/user}", - "branches_url": "https://api.github.com/repos/ursa-labs/ursabot/branches{/branch}", - "tags_url": "https://api.github.com/repos/ursa-labs/ursabot/tags", - "blobs_url": "https://api.github.com/repos/ursa-labs/ursabot/git/blobs{/sha}", - "git_tags_url": "https://api.github.com/repos/ursa-labs/ursabot/git/tags{/sha}", - "git_refs_url": "https://api.github.com/repos/ursa-labs/ursabot/git/refs{/sha}", - "trees_url": "https://api.github.com/repos/ursa-labs/ursabot/git/trees{/sha}", - "statuses_url": "https://api.github.com/repos/ursa-labs/ursabot/statuses/{sha}", - "languages_url": "https://api.github.com/repos/ursa-labs/ursabot/languages", - "stargazers_url": "https://api.github.com/repos/ursa-labs/ursabot/stargazers", - "contributors_url": "https://api.github.com/repos/ursa-labs/ursabot/contributors", - "subscribers_url": "https://api.github.com/repos/ursa-labs/ursabot/subscribers", - "subscription_url": "https://api.github.com/repos/ursa-labs/ursabot/subscription", - "commits_url": "https://api.github.com/repos/ursa-labs/ursabot/commits{/sha}", - "git_commits_url": "https://api.github.com/repos/ursa-labs/ursabot/git/commits{/sha}", - "comments_url": "https://api.github.com/repos/ursa-labs/ursabot/comments{/number}", - "issue_comment_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/comments{/number}", - "contents_url": "https://api.github.com/repos/ursa-labs/ursabot/contents/{+path}", - "compare_url": "https://api.github.com/repos/ursa-labs/ursabot/compare/{base}...{head}", - "merges_url": "https://api.github.com/repos/ursa-labs/ursabot/merges", - "archive_url": "https://api.github.com/repos/ursa-labs/ursabot/{archive_format}{/ref}", - "downloads_url": "https://api.github.com/repos/ursa-labs/ursabot/downloads", - "issues_url": "https://api.github.com/repos/ursa-labs/ursabot/issues{/number}", - "pulls_url": "https://api.github.com/repos/ursa-labs/ursabot/pulls{/number}", - "milestones_url": "https://api.github.com/repos/ursa-labs/ursabot/milestones{/number}", - "notifications_url": "https://api.github.com/repos/ursa-labs/ursabot/notifications{?since,all,participating}", - "labels_url": "https://api.github.com/repos/ursa-labs/ursabot/labels{/name}", - "releases_url": "https://api.github.com/repos/ursa-labs/ursabot/releases{/id}", - "deployments_url": "https://api.github.com/repos/ursa-labs/ursabot/deployments", - "created_at": "2019-02-04T15:40:31Z", - "updated_at": "2019-04-04T17:49:10Z", - "pushed_at": "2019-04-05T12:01:40Z", - "git_url": "git://github.com/ursa-labs/ursabot.git", - "ssh_url": "git@github.com:ursa-labs/ursabot.git", - "clone_url": "https://github.com/ursa-labs/ursabot.git", - "svn_url": "https://github.com/ursa-labs/ursabot", - "homepage": null, - "size": 898, - "stargazers_count": 1, - "watchers_count": 1, - "language": "Jupyter Notebook", - "has_issues": true, - "has_projects": true, - "has_downloads": true, - "has_wiki": true, - "has_pages": false, - "forks_count": 0, - "mirror_url": null, - "archived": false, - "disabled": false, - "open_issues_count": 19, - "license": null, - "forks": 0, - "open_issues": 19, - "watchers": 1, - "default_branch": "master" - } - }, - "base": { - "label": "ursa-labs:master", - "ref": "master", - "sha": "a162ad254b589b924db47e057791191b39613fd5", - "user": { - "login": "ursa-labs", - "id": 46514972, - "node_id": "MDEyOk9yZ2FuaXphdGlvbjQ2NTE0OTcy", - "avatar_url": "https://avatars2.githubusercontent.com/u/46514972?v=4", - "gravatar_id": "", - "url": "https://api.github.com/users/ursa-labs", - "html_url": "https://github.com/ursa-labs", - "followers_url": "https://api.github.com/users/ursa-labs/followers", - "following_url": "https://api.github.com/users/ursa-labs/following{/other_user}", - "gists_url": "https://api.github.com/users/ursa-labs/gists{/gist_id}", - "starred_url": "https://api.github.com/users/ursa-labs/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/ursa-labs/subscriptions", - "organizations_url": "https://api.github.com/users/ursa-labs/orgs", - "repos_url": "https://api.github.com/users/ursa-labs/repos", - "events_url": "https://api.github.com/users/ursa-labs/events{/privacy}", - "received_events_url": "https://api.github.com/users/ursa-labs/received_events", - "type": "Organization", - "site_admin": false - }, - "repo": { - "id": 169101701, - "node_id": "MDEwOlJlcG9zaXRvcnkxNjkxMDE3MDE=", - "name": "ursabot", - "full_name": "ursa-labs/ursabot", - "private": false, - "owner": { - "login": "ursa-labs", - "id": 46514972, - "node_id": "MDEyOk9yZ2FuaXphdGlvbjQ2NTE0OTcy", - "avatar_url": "https://avatars2.githubusercontent.com/u/46514972?v=4", - "gravatar_id": "", - "url": "https://api.github.com/users/ursa-labs", - "html_url": "https://github.com/ursa-labs", - "followers_url": "https://api.github.com/users/ursa-labs/followers", - "following_url": "https://api.github.com/users/ursa-labs/following{/other_user}", - "gists_url": "https://api.github.com/users/ursa-labs/gists{/gist_id}", - "starred_url": "https://api.github.com/users/ursa-labs/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/ursa-labs/subscriptions", - "organizations_url": "https://api.github.com/users/ursa-labs/orgs", - "repos_url": "https://api.github.com/users/ursa-labs/repos", - "events_url": "https://api.github.com/users/ursa-labs/events{/privacy}", - "received_events_url": "https://api.github.com/users/ursa-labs/received_events", - "type": "Organization", - "site_admin": false - }, - "html_url": "https://github.com/ursa-labs/ursabot", - "description": null, - "fork": false, - "url": "https://api.github.com/repos/ursa-labs/ursabot", - "forks_url": "https://api.github.com/repos/ursa-labs/ursabot/forks", - "keys_url": "https://api.github.com/repos/ursa-labs/ursabot/keys{/key_id}", - "collaborators_url": "https://api.github.com/repos/ursa-labs/ursabot/collaborators{/collaborator}", - "teams_url": "https://api.github.com/repos/ursa-labs/ursabot/teams", - "hooks_url": "https://api.github.com/repos/ursa-labs/ursabot/hooks", - "issue_events_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/events{/number}", - "events_url": "https://api.github.com/repos/ursa-labs/ursabot/events", - "assignees_url": "https://api.github.com/repos/ursa-labs/ursabot/assignees{/user}", - "branches_url": "https://api.github.com/repos/ursa-labs/ursabot/branches{/branch}", - "tags_url": "https://api.github.com/repos/ursa-labs/ursabot/tags", - "blobs_url": "https://api.github.com/repos/ursa-labs/ursabot/git/blobs{/sha}", - "git_tags_url": "https://api.github.com/repos/ursa-labs/ursabot/git/tags{/sha}", - "git_refs_url": "https://api.github.com/repos/ursa-labs/ursabot/git/refs{/sha}", - "trees_url": "https://api.github.com/repos/ursa-labs/ursabot/git/trees{/sha}", - "statuses_url": "https://api.github.com/repos/ursa-labs/ursabot/statuses/{sha}", - "languages_url": "https://api.github.com/repos/ursa-labs/ursabot/languages", - "stargazers_url": "https://api.github.com/repos/ursa-labs/ursabot/stargazers", - "contributors_url": "https://api.github.com/repos/ursa-labs/ursabot/contributors", - "subscribers_url": "https://api.github.com/repos/ursa-labs/ursabot/subscribers", - "subscription_url": "https://api.github.com/repos/ursa-labs/ursabot/subscription", - "commits_url": "https://api.github.com/repos/ursa-labs/ursabot/commits{/sha}", - "git_commits_url": "https://api.github.com/repos/ursa-labs/ursabot/git/commits{/sha}", - "comments_url": "https://api.github.com/repos/ursa-labs/ursabot/comments{/number}", - "issue_comment_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/comments{/number}", - "contents_url": "https://api.github.com/repos/ursa-labs/ursabot/contents/{+path}", - "compare_url": "https://api.github.com/repos/ursa-labs/ursabot/compare/{base}...{head}", - "merges_url": "https://api.github.com/repos/ursa-labs/ursabot/merges", - "archive_url": "https://api.github.com/repos/ursa-labs/ursabot/{archive_format}{/ref}", - "downloads_url": "https://api.github.com/repos/ursa-labs/ursabot/downloads", - "issues_url": "https://api.github.com/repos/ursa-labs/ursabot/issues{/number}", - "pulls_url": "https://api.github.com/repos/ursa-labs/ursabot/pulls{/number}", - "milestones_url": "https://api.github.com/repos/ursa-labs/ursabot/milestones{/number}", - "notifications_url": "https://api.github.com/repos/ursa-labs/ursabot/notifications{?since,all,participating}", - "labels_url": "https://api.github.com/repos/ursa-labs/ursabot/labels{/name}", - "releases_url": "https://api.github.com/repos/ursa-labs/ursabot/releases{/id}", - "deployments_url": "https://api.github.com/repos/ursa-labs/ursabot/deployments", - "created_at": "2019-02-04T15:40:31Z", - "updated_at": "2019-04-04T17:49:10Z", - "pushed_at": "2019-04-05T12:01:40Z", - "git_url": "git://github.com/ursa-labs/ursabot.git", - "ssh_url": "git@github.com:ursa-labs/ursabot.git", - "clone_url": "https://github.com/ursa-labs/ursabot.git", - "svn_url": "https://github.com/ursa-labs/ursabot", - "homepage": null, - "size": 898, - "stargazers_count": 1, - "watchers_count": 1, - "language": "Jupyter Notebook", - "has_issues": true, - "has_projects": true, - "has_downloads": true, - "has_wiki": true, - "has_pages": false, - "forks_count": 0, - "mirror_url": null, - "archived": false, - "disabled": false, - "open_issues_count": 19, - "license": null, - "forks": 0, - "open_issues": 19, - "watchers": 1, - "default_branch": "master" - } - }, - "_links": { - "self": { - "href": "https://api.github.com/repos/ursa-labs/ursabot/pulls/26" - }, - "html": { - "href": "https://github.com/ursa-labs/ursabot/pull/26" - }, - "issue": { - "href": "https://api.github.com/repos/ursa-labs/ursabot/issues/26" - }, - "comments": { - "href": "https://api.github.com/repos/ursa-labs/ursabot/issues/26/comments" - }, - "review_comments": { - "href": "https://api.github.com/repos/ursa-labs/ursabot/pulls/26/comments" - }, - "review_comment": { - "href": "https://api.github.com/repos/ursa-labs/ursabot/pulls/comments{/number}" - }, - "commits": { - "href": "https://api.github.com/repos/ursa-labs/ursabot/pulls/26/commits" - }, - "statuses": { - "href": "https://api.github.com/repos/ursa-labs/ursabot/statuses/2705da2b616b98fa6010a25813c5a7a27456f71d" - } - }, - "author_association": "COLLABORATOR", - "merged": false, - "mergeable": true, - "rebaseable": true, - "mergeable_state": "unstable", - "merged_by": null, - "comments": 5, - "review_comments": 0, - "maintainer_can_modify": false, - "commits": 2, - "additions": 1124, - "deletions": 0, - "changed_files": 7 - }, - "repository": { - "archive_url": "https://api.github.com/repos/ursa-labs/ursabot/{archive_format}{/ref}", - "archived": false, - "assignees_url": "https://api.github.com/repos/ursa-labs/ursabot/assignees{/user}", - "blobs_url": "https://api.github.com/repos/ursa-labs/ursabot/git/blobs{/sha}", - "branches_url": "https://api.github.com/repos/ursa-labs/ursabot/branches{/branch}", - "clone_url": "https://github.com/ursa-labs/ursabot.git", - "collaborators_url": "https://api.github.com/repos/ursa-labs/ursabot/collaborators{/collaborator}", - "comments_url": "https://api.github.com/repos/ursa-labs/ursabot/comments{/number}", - "commits_url": "https://api.github.com/repos/ursa-labs/ursabot/commits{/sha}", - "compare_url": "https://api.github.com/repos/ursa-labs/ursabot/compare/{base}...{head}", - "contents_url": "https://api.github.com/repos/ursa-labs/ursabot/contents/{+path}", - "contributors_url": "https://api.github.com/repos/ursa-labs/ursabot/contributors", - "created_at": "2019-02-04T15:40:31Z", - "default_branch": "master", - "deployments_url": "https://api.github.com/repos/ursa-labs/ursabot/deployments", - "description": null, - "disabled": false, - "downloads_url": "https://api.github.com/repos/ursa-labs/ursabot/downloads", - "events_url": "https://api.github.com/repos/ursa-labs/ursabot/events", - "fork": false, - "forks": 0, - "forks_count": 0, - "forks_url": "https://api.github.com/repos/ursa-labs/ursabot/forks", - "full_name": "ursa-labs/ursabot", - "git_commits_url": "https://api.github.com/repos/ursa-labs/ursabot/git/commits{/sha}", - "git_refs_url": "https://api.github.com/repos/ursa-labs/ursabot/git/refs{/sha}", - "git_tags_url": "https://api.github.com/repos/ursa-labs/ursabot/git/tags{/sha}", - "git_url": "git://github.com/ursa-labs/ursabot.git", - "has_downloads": true, - "has_issues": true, - "has_pages": false, - "has_projects": true, - "has_wiki": true, - "homepage": null, - "hooks_url": "https://api.github.com/repos/ursa-labs/ursabot/hooks", - "html_url": "https://github.com/ursa-labs/ursabot", - "id": 169101701, - "issue_comment_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/comments{/number}", - "issue_events_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/events{/number}", - "issues_url": "https://api.github.com/repos/ursa-labs/ursabot/issues{/number}", - "keys_url": "https://api.github.com/repos/ursa-labs/ursabot/keys{/key_id}", - "labels_url": "https://api.github.com/repos/ursa-labs/ursabot/labels{/name}", - "language": "Jupyter Notebook", - "languages_url": "https://api.github.com/repos/ursa-labs/ursabot/languages", - "license": null, - "merges_url": "https://api.github.com/repos/ursa-labs/ursabot/merges", - "milestones_url": "https://api.github.com/repos/ursa-labs/ursabot/milestones{/number}", - "mirror_url": null, - "name": "ursabot", - "node_id": "MDEwOlJlcG9zaXRvcnkxNjkxMDE3MDE=", - "notifications_url": "https://api.github.com/repos/ursa-labs/ursabot/notifications{?since,all,participating}", - "open_issues": 19, - "open_issues_count": 19, - "owner": { - "avatar_url": "https://avatars2.githubusercontent.com/u/46514972?v=4", - "events_url": "https://api.github.com/users/ursa-labs/events{/privacy}", - "followers_url": "https://api.github.com/users/ursa-labs/followers", - "following_url": "https://api.github.com/users/ursa-labs/following{/other_user}", - "gists_url": "https://api.github.com/users/ursa-labs/gists{/gist_id}", - "gravatar_id": "", - "html_url": "https://github.com/ursa-labs", - "id": 46514972, - "login": "ursa-labs", - "node_id": "MDEyOk9yZ2FuaXphdGlvbjQ2NTE0OTcy", - "organizations_url": "https://api.github.com/users/ursa-labs/orgs", - "received_events_url": "https://api.github.com/users/ursa-labs/received_events", - "repos_url": "https://api.github.com/users/ursa-labs/repos", - "site_admin": false, - "starred_url": "https://api.github.com/users/ursa-labs/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/ursa-labs/subscriptions", - "type": "Organization", - "url": "https://api.github.com/users/ursa-labs" - }, - "private": false, - "pulls_url": "https://api.github.com/repos/ursa-labs/ursabot/pulls{/number}", - "pushed_at": "2019-04-05T11:22:16Z", - "releases_url": "https://api.github.com/repos/ursa-labs/ursabot/releases{/id}", - "size": 892, - "ssh_url": "git@github.com:ursa-labs/ursabot.git", - "stargazers_count": 1, - "stargazers_url": "https://api.github.com/repos/ursa-labs/ursabot/stargazers", - "statuses_url": "https://api.github.com/repos/ursa-labs/ursabot/statuses/{sha}", - "subscribers_url": "https://api.github.com/repos/ursa-labs/ursabot/subscribers", - "subscription_url": "https://api.github.com/repos/ursa-labs/ursabot/subscription", - "svn_url": "https://github.com/ursa-labs/ursabot", - "tags_url": "https://api.github.com/repos/ursa-labs/ursabot/tags", - "teams_url": "https://api.github.com/repos/ursa-labs/ursabot/teams", - "trees_url": "https://api.github.com/repos/ursa-labs/ursabot/git/trees{/sha}", - "updated_at": "2019-04-04T17:49:10Z", - "url": "https://api.github.com/repos/ursa-labs/ursabot", - "watchers": 1, - "watchers_count": 1 - }, - "sender": { - "avatar_url": "https://avatars1.githubusercontent.com/u/961747?v=4", - "events_url": "https://api.github.com/users/kszucs/events{/privacy}", - "followers_url": "https://api.github.com/users/kszucs/followers", - "following_url": "https://api.github.com/users/kszucs/following{/other_user}", - "gists_url": "https://api.github.com/users/kszucs/gists{/gist_id}", - "gravatar_id": "", - "html_url": "https://github.com/kszucs", - "id": 961747, - "login": "kszucs", - "node_id": "MDQ6VXNlcjk2MTc0Nw==", - "organizations_url": "https://api.github.com/users/kszucs/orgs", - "received_events_url": "https://api.github.com/users/kszucs/received_events", - "repos_url": "https://api.github.com/users/kszucs/repos", - "site_admin": false, - "starred_url": "https://api.github.com/users/kszucs/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/kszucs/subscriptions", - "type": "User", - "url": "https://api.github.com/users/kszucs" - } -} \ No newline at end of file diff --git a/dev/archery/archery/tests/fixtures/event-pull-request-target-opened-committer.json b/dev/archery/archery/tests/fixtures/event-pull-request-target-opened-committer.json new file mode 100644 index 0000000000000..67a4836c7635f --- /dev/null +++ b/dev/archery/archery/tests/fixtures/event-pull-request-target-opened-committer.json @@ -0,0 +1,459 @@ +{ + "action":"opened", + "number":26, + "organization": { + "avatar_url": "https://avatars2.githubusercontent.com/u/46514972?v=4", + "description": "Innovation lab for open source data science tools, powered by Apache Arrow", + "events_url": "https://api.github.com/orgs/ursa-labs/events", + "hooks_url": "https://api.github.com/orgs/ursa-labs/hooks", + "id": 46514972, + "issues_url": "https://api.github.com/orgs/ursa-labs/issues", + "login": "ursa-labs", + "members_url": "https://api.github.com/orgs/ursa-labs/members{/member}", + "node_id": "MDEyOk9yZ2FuaXphdGlvbjQ2NTE0OTcy", + "public_members_url": "https://api.github.com/orgs/ursa-labs/public_members{/member}", + "repos_url": "https://api.github.com/orgs/ursa-labs/repos", + "url": "https://api.github.com/orgs/ursa-labs" + }, + "pull_request": { + "url": "https://api.github.com/repos/ursa-labs/ursabot/pulls/26", + "id": 267785552, + "node_id": "MDExOlB1bGxSZXF1ZXN0MjY3Nzg1NTUy", + "html_url": "https://github.com/ursa-labs/ursabot/pull/26", + "diff_url": "https://github.com/ursa-labs/ursabot/pull/26.diff", + "patch_url": "https://github.com/ursa-labs/ursabot/pull/26.patch", + "issue_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/26", + "number": 26, + "state": "open", + "locked": false, + "title": "Unittests for GithubHook", + "user": { + "login": "kszucs", + "id": 961747, + "node_id": "MDQ6VXNlcjk2MTc0Nw==", + "avatar_url": "https://avatars1.githubusercontent.com/u/961747?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/kszucs", + "html_url": "https://github.com/kszucs", + "followers_url": "https://api.github.com/users/kszucs/followers", + "following_url": "https://api.github.com/users/kszucs/following{/other_user}", + "gists_url": "https://api.github.com/users/kszucs/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kszucs/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kszucs/subscriptions", + "organizations_url": "https://api.github.com/users/kszucs/orgs", + "repos_url": "https://api.github.com/users/kszucs/repos", + "events_url": "https://api.github.com/users/kszucs/events{/privacy}", + "received_events_url": "https://api.github.com/users/kszucs/received_events", + "type": "User", + "site_admin": false + }, + "body": "", + "created_at": "2019-04-05T11:22:15Z", + "updated_at": "2019-04-05T12:01:40Z", + "closed_at": null, + "merged_at": null, + "merge_commit_sha": "cc5dc3606988b3824be54df779ed2028776113cb", + "assignee": null, + "assignees": [], + "requested_reviewers": [], + "requested_teams": [], + "labels": [], + "milestone": null, + "commits_url": "https://api.github.com/repos/ursa-labs/ursabot/pulls/26/commits", + "review_comments_url": "https://api.github.com/repos/ursa-labs/ursabot/pulls/26/comments", + "review_comment_url": "https://api.github.com/repos/ursa-labs/ursabot/pulls/comments{/number}", + "comments_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/26/comments", + "statuses_url": "https://api.github.com/repos/ursa-labs/ursabot/statuses/2705da2b616b98fa6010a25813c5a7a27456f71d", + "head": { + "label": "ursa-labs:test-hook", + "ref": "test-hook", + "sha": "2705da2b616b98fa6010a25813c5a7a27456f71d", + "user": { + "login": "ursa-labs", + "id": 46514972, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjQ2NTE0OTcy", + "avatar_url": "https://avatars2.githubusercontent.com/u/46514972?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/ursa-labs", + "html_url": "https://github.com/ursa-labs", + "followers_url": "https://api.github.com/users/ursa-labs/followers", + "following_url": "https://api.github.com/users/ursa-labs/following{/other_user}", + "gists_url": "https://api.github.com/users/ursa-labs/gists{/gist_id}", + "starred_url": "https://api.github.com/users/ursa-labs/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/ursa-labs/subscriptions", + "organizations_url": "https://api.github.com/users/ursa-labs/orgs", + "repos_url": "https://api.github.com/users/ursa-labs/repos", + "events_url": "https://api.github.com/users/ursa-labs/events{/privacy}", + "received_events_url": "https://api.github.com/users/ursa-labs/received_events", + "type": "Organization", + "site_admin": false + }, + "repo": { + "id": 169101701, + "node_id": "MDEwOlJlcG9zaXRvcnkxNjkxMDE3MDE=", + "name": "ursabot", + "full_name": "ursa-labs/ursabot", + "private": false, + "owner": { + "login": "ursa-labs", + "id": 46514972, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjQ2NTE0OTcy", + "avatar_url": "https://avatars2.githubusercontent.com/u/46514972?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/ursa-labs", + "html_url": "https://github.com/ursa-labs", + "followers_url": "https://api.github.com/users/ursa-labs/followers", + "following_url": "https://api.github.com/users/ursa-labs/following{/other_user}", + "gists_url": "https://api.github.com/users/ursa-labs/gists{/gist_id}", + "starred_url": "https://api.github.com/users/ursa-labs/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/ursa-labs/subscriptions", + "organizations_url": "https://api.github.com/users/ursa-labs/orgs", + "repos_url": "https://api.github.com/users/ursa-labs/repos", + "events_url": "https://api.github.com/users/ursa-labs/events{/privacy}", + "received_events_url": "https://api.github.com/users/ursa-labs/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/ursa-labs/ursabot", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/ursa-labs/ursabot", + "forks_url": "https://api.github.com/repos/ursa-labs/ursabot/forks", + "keys_url": "https://api.github.com/repos/ursa-labs/ursabot/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/ursa-labs/ursabot/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/ursa-labs/ursabot/teams", + "hooks_url": "https://api.github.com/repos/ursa-labs/ursabot/hooks", + "issue_events_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/events{/number}", + "events_url": "https://api.github.com/repos/ursa-labs/ursabot/events", + "assignees_url": "https://api.github.com/repos/ursa-labs/ursabot/assignees{/user}", + "branches_url": "https://api.github.com/repos/ursa-labs/ursabot/branches{/branch}", + "tags_url": "https://api.github.com/repos/ursa-labs/ursabot/tags", + "blobs_url": "https://api.github.com/repos/ursa-labs/ursabot/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/ursa-labs/ursabot/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/ursa-labs/ursabot/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/ursa-labs/ursabot/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/ursa-labs/ursabot/statuses/{sha}", + "languages_url": "https://api.github.com/repos/ursa-labs/ursabot/languages", + "stargazers_url": "https://api.github.com/repos/ursa-labs/ursabot/stargazers", + "contributors_url": "https://api.github.com/repos/ursa-labs/ursabot/contributors", + "subscribers_url": "https://api.github.com/repos/ursa-labs/ursabot/subscribers", + "subscription_url": "https://api.github.com/repos/ursa-labs/ursabot/subscription", + "commits_url": "https://api.github.com/repos/ursa-labs/ursabot/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/ursa-labs/ursabot/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/ursa-labs/ursabot/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/ursa-labs/ursabot/contents/{+path}", + "compare_url": "https://api.github.com/repos/ursa-labs/ursabot/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/ursa-labs/ursabot/merges", + "archive_url": "https://api.github.com/repos/ursa-labs/ursabot/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/ursa-labs/ursabot/downloads", + "issues_url": "https://api.github.com/repos/ursa-labs/ursabot/issues{/number}", + "pulls_url": "https://api.github.com/repos/ursa-labs/ursabot/pulls{/number}", + "milestones_url": "https://api.github.com/repos/ursa-labs/ursabot/milestones{/number}", + "notifications_url": "https://api.github.com/repos/ursa-labs/ursabot/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/ursa-labs/ursabot/labels{/name}", + "releases_url": "https://api.github.com/repos/ursa-labs/ursabot/releases{/id}", + "deployments_url": "https://api.github.com/repos/ursa-labs/ursabot/deployments", + "created_at": "2019-02-04T15:40:31Z", + "updated_at": "2019-04-04T17:49:10Z", + "pushed_at": "2019-04-05T12:01:40Z", + "git_url": "git://github.com/ursa-labs/ursabot.git", + "ssh_url": "git@github.com:ursa-labs/ursabot.git", + "clone_url": "https://github.com/ursa-labs/ursabot.git", + "svn_url": "https://github.com/ursa-labs/ursabot", + "homepage": null, + "size": 898, + "stargazers_count": 1, + "watchers_count": 1, + "language": "Jupyter Notebook", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 19, + "license": null, + "forks": 0, + "open_issues": 19, + "watchers": 1, + "default_branch": "master" + } + }, + "base": { + "label": "ursa-labs:master", + "ref": "master", + "sha": "a162ad254b589b924db47e057791191b39613fd5", + "user": { + "login": "ursa-labs", + "id": 46514972, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjQ2NTE0OTcy", + "avatar_url": "https://avatars2.githubusercontent.com/u/46514972?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/ursa-labs", + "html_url": "https://github.com/ursa-labs", + "followers_url": "https://api.github.com/users/ursa-labs/followers", + "following_url": "https://api.github.com/users/ursa-labs/following{/other_user}", + "gists_url": "https://api.github.com/users/ursa-labs/gists{/gist_id}", + "starred_url": "https://api.github.com/users/ursa-labs/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/ursa-labs/subscriptions", + "organizations_url": "https://api.github.com/users/ursa-labs/orgs", + "repos_url": "https://api.github.com/users/ursa-labs/repos", + "events_url": "https://api.github.com/users/ursa-labs/events{/privacy}", + "received_events_url": "https://api.github.com/users/ursa-labs/received_events", + "type": "Organization", + "site_admin": false + }, + "repo": { + "id": 169101701, + "node_id": "MDEwOlJlcG9zaXRvcnkxNjkxMDE3MDE=", + "name": "ursabot", + "full_name": "ursa-labs/ursabot", + "private": false, + "owner": { + "login": "ursa-labs", + "id": 46514972, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjQ2NTE0OTcy", + "avatar_url": "https://avatars2.githubusercontent.com/u/46514972?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/ursa-labs", + "html_url": "https://github.com/ursa-labs", + "followers_url": "https://api.github.com/users/ursa-labs/followers", + "following_url": "https://api.github.com/users/ursa-labs/following{/other_user}", + "gists_url": "https://api.github.com/users/ursa-labs/gists{/gist_id}", + "starred_url": "https://api.github.com/users/ursa-labs/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/ursa-labs/subscriptions", + "organizations_url": "https://api.github.com/users/ursa-labs/orgs", + "repos_url": "https://api.github.com/users/ursa-labs/repos", + "events_url": "https://api.github.com/users/ursa-labs/events{/privacy}", + "received_events_url": "https://api.github.com/users/ursa-labs/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/ursa-labs/ursabot", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/ursa-labs/ursabot", + "forks_url": "https://api.github.com/repos/ursa-labs/ursabot/forks", + "keys_url": "https://api.github.com/repos/ursa-labs/ursabot/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/ursa-labs/ursabot/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/ursa-labs/ursabot/teams", + "hooks_url": "https://api.github.com/repos/ursa-labs/ursabot/hooks", + "issue_events_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/events{/number}", + "events_url": "https://api.github.com/repos/ursa-labs/ursabot/events", + "assignees_url": "https://api.github.com/repos/ursa-labs/ursabot/assignees{/user}", + "branches_url": "https://api.github.com/repos/ursa-labs/ursabot/branches{/branch}", + "tags_url": "https://api.github.com/repos/ursa-labs/ursabot/tags", + "blobs_url": "https://api.github.com/repos/ursa-labs/ursabot/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/ursa-labs/ursabot/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/ursa-labs/ursabot/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/ursa-labs/ursabot/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/ursa-labs/ursabot/statuses/{sha}", + "languages_url": "https://api.github.com/repos/ursa-labs/ursabot/languages", + "stargazers_url": "https://api.github.com/repos/ursa-labs/ursabot/stargazers", + "contributors_url": "https://api.github.com/repos/ursa-labs/ursabot/contributors", + "subscribers_url": "https://api.github.com/repos/ursa-labs/ursabot/subscribers", + "subscription_url": "https://api.github.com/repos/ursa-labs/ursabot/subscription", + "commits_url": "https://api.github.com/repos/ursa-labs/ursabot/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/ursa-labs/ursabot/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/ursa-labs/ursabot/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/ursa-labs/ursabot/contents/{+path}", + "compare_url": "https://api.github.com/repos/ursa-labs/ursabot/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/ursa-labs/ursabot/merges", + "archive_url": "https://api.github.com/repos/ursa-labs/ursabot/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/ursa-labs/ursabot/downloads", + "issues_url": "https://api.github.com/repos/ursa-labs/ursabot/issues{/number}", + "pulls_url": "https://api.github.com/repos/ursa-labs/ursabot/pulls{/number}", + "milestones_url": "https://api.github.com/repos/ursa-labs/ursabot/milestones{/number}", + "notifications_url": "https://api.github.com/repos/ursa-labs/ursabot/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/ursa-labs/ursabot/labels{/name}", + "releases_url": "https://api.github.com/repos/ursa-labs/ursabot/releases{/id}", + "deployments_url": "https://api.github.com/repos/ursa-labs/ursabot/deployments", + "created_at": "2019-02-04T15:40:31Z", + "updated_at": "2019-04-04T17:49:10Z", + "pushed_at": "2019-04-05T12:01:40Z", + "git_url": "git://github.com/ursa-labs/ursabot.git", + "ssh_url": "git@github.com:ursa-labs/ursabot.git", + "clone_url": "https://github.com/ursa-labs/ursabot.git", + "svn_url": "https://github.com/ursa-labs/ursabot", + "homepage": null, + "size": 898, + "stargazers_count": 1, + "watchers_count": 1, + "language": "Jupyter Notebook", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 19, + "license": null, + "forks": 0, + "open_issues": 19, + "watchers": 1, + "default_branch": "master" + } + }, + "_links": { + "self": { + "href": "https://api.github.com/repos/ursa-labs/ursabot/pulls/26" + }, + "html": { + "href": "https://github.com/ursa-labs/ursabot/pull/26" + }, + "issue": { + "href": "https://api.github.com/repos/ursa-labs/ursabot/issues/26" + }, + "comments": { + "href": "https://api.github.com/repos/ursa-labs/ursabot/issues/26/comments" + }, + "review_comments": { + "href": "https://api.github.com/repos/ursa-labs/ursabot/pulls/26/comments" + }, + "review_comment": { + "href": "https://api.github.com/repos/ursa-labs/ursabot/pulls/comments{/number}" + }, + "commits": { + "href": "https://api.github.com/repos/ursa-labs/ursabot/pulls/26/commits" + }, + "statuses": { + "href": "https://api.github.com/repos/ursa-labs/ursabot/statuses/2705da2b616b98fa6010a25813c5a7a27456f71d" + } + }, + "author_association": "MEMBER", + "merged": false, + "mergeable": true, + "rebaseable": true, + "mergeable_state": "unstable", + "merged_by": null, + "comments": 5, + "review_comments": 0, + "maintainer_can_modify": false, + "commits": 2, + "additions": 1124, + "deletions": 0, + "changed_files": 7 + }, + "repository": { + "archive_url": "https://api.github.com/repos/ursa-labs/ursabot/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/ursa-labs/ursabot/assignees{/user}", + "blobs_url": "https://api.github.com/repos/ursa-labs/ursabot/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/ursa-labs/ursabot/branches{/branch}", + "clone_url": "https://github.com/ursa-labs/ursabot.git", + "collaborators_url": "https://api.github.com/repos/ursa-labs/ursabot/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/ursa-labs/ursabot/comments{/number}", + "commits_url": "https://api.github.com/repos/ursa-labs/ursabot/commits{/sha}", + "compare_url": "https://api.github.com/repos/ursa-labs/ursabot/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/ursa-labs/ursabot/contents/{+path}", + "contributors_url": "https://api.github.com/repos/ursa-labs/ursabot/contributors", + "created_at": "2019-02-04T15:40:31Z", + "default_branch": "master", + "deployments_url": "https://api.github.com/repos/ursa-labs/ursabot/deployments", + "description": null, + "disabled": false, + "downloads_url": "https://api.github.com/repos/ursa-labs/ursabot/downloads", + "events_url": "https://api.github.com/repos/ursa-labs/ursabot/events", + "fork": false, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/ursa-labs/ursabot/forks", + "full_name": "ursa-labs/ursabot", + "git_commits_url": "https://api.github.com/repos/ursa-labs/ursabot/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/ursa-labs/ursabot/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/ursa-labs/ursabot/git/tags{/sha}", + "git_url": "git://github.com/ursa-labs/ursabot.git", + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/ursa-labs/ursabot/hooks", + "html_url": "https://github.com/ursa-labs/ursabot", + "id": 169101701, + "issue_comment_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/events{/number}", + "issues_url": "https://api.github.com/repos/ursa-labs/ursabot/issues{/number}", + "keys_url": "https://api.github.com/repos/ursa-labs/ursabot/keys{/key_id}", + "labels_url": "https://api.github.com/repos/ursa-labs/ursabot/labels{/name}", + "language": "Jupyter Notebook", + "languages_url": "https://api.github.com/repos/ursa-labs/ursabot/languages", + "license": null, + "merges_url": "https://api.github.com/repos/ursa-labs/ursabot/merges", + "milestones_url": "https://api.github.com/repos/ursa-labs/ursabot/milestones{/number}", + "mirror_url": null, + "name": "ursabot", + "node_id": "MDEwOlJlcG9zaXRvcnkxNjkxMDE3MDE=", + "notifications_url": "https://api.github.com/repos/ursa-labs/ursabot/notifications{?since,all,participating}", + "open_issues": 19, + "open_issues_count": 19, + "owner": { + "avatar_url": "https://avatars2.githubusercontent.com/u/46514972?v=4", + "events_url": "https://api.github.com/users/ursa-labs/events{/privacy}", + "followers_url": "https://api.github.com/users/ursa-labs/followers", + "following_url": "https://api.github.com/users/ursa-labs/following{/other_user}", + "gists_url": "https://api.github.com/users/ursa-labs/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/ursa-labs", + "id": 46514972, + "login": "ursa-labs", + "node_id": "MDEyOk9yZ2FuaXphdGlvbjQ2NTE0OTcy", + "organizations_url": "https://api.github.com/users/ursa-labs/orgs", + "received_events_url": "https://api.github.com/users/ursa-labs/received_events", + "repos_url": "https://api.github.com/users/ursa-labs/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/ursa-labs/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/ursa-labs/subscriptions", + "type": "Organization", + "url": "https://api.github.com/users/ursa-labs" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/ursa-labs/ursabot/pulls{/number}", + "pushed_at": "2019-04-05T11:22:16Z", + "releases_url": "https://api.github.com/repos/ursa-labs/ursabot/releases{/id}", + "size": 892, + "ssh_url": "git@github.com:ursa-labs/ursabot.git", + "stargazers_count": 1, + "stargazers_url": "https://api.github.com/repos/ursa-labs/ursabot/stargazers", + "statuses_url": "https://api.github.com/repos/ursa-labs/ursabot/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/ursa-labs/ursabot/subscribers", + "subscription_url": "https://api.github.com/repos/ursa-labs/ursabot/subscription", + "svn_url": "https://github.com/ursa-labs/ursabot", + "tags_url": "https://api.github.com/repos/ursa-labs/ursabot/tags", + "teams_url": "https://api.github.com/repos/ursa-labs/ursabot/teams", + "trees_url": "https://api.github.com/repos/ursa-labs/ursabot/git/trees{/sha}", + "updated_at": "2019-04-04T17:49:10Z", + "url": "https://api.github.com/repos/ursa-labs/ursabot", + "watchers": 1, + "watchers_count": 1 + }, + "sender": { + "avatar_url": "https://avatars1.githubusercontent.com/u/961747?v=4", + "events_url": "https://api.github.com/users/kszucs/events{/privacy}", + "followers_url": "https://api.github.com/users/kszucs/followers", + "following_url": "https://api.github.com/users/kszucs/following{/other_user}", + "gists_url": "https://api.github.com/users/kszucs/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/kszucs", + "id": 961747, + "login": "kszucs", + "node_id": "MDQ6VXNlcjk2MTc0Nw==", + "organizations_url": "https://api.github.com/users/kszucs/orgs", + "received_events_url": "https://api.github.com/users/kszucs/received_events", + "repos_url": "https://api.github.com/users/kszucs/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/kszucs/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kszucs/subscriptions", + "type": "User", + "url": "https://api.github.com/users/kszucs" + } + } \ No newline at end of file diff --git a/dev/archery/archery/tests/fixtures/event-pull-request-target-opened-non-committer.json b/dev/archery/archery/tests/fixtures/event-pull-request-target-opened-non-committer.json new file mode 100644 index 0000000000000..6f4db37ccb465 --- /dev/null +++ b/dev/archery/archery/tests/fixtures/event-pull-request-target-opened-non-committer.json @@ -0,0 +1,459 @@ +{ + "action":"opened", + "number":26, + "organization": { + "avatar_url": "https://avatars2.githubusercontent.com/u/46514972?v=4", + "description": "Innovation lab for open source data science tools, powered by Apache Arrow", + "events_url": "https://api.github.com/orgs/ursa-labs/events", + "hooks_url": "https://api.github.com/orgs/ursa-labs/hooks", + "id": 46514972, + "issues_url": "https://api.github.com/orgs/ursa-labs/issues", + "login": "ursa-labs", + "members_url": "https://api.github.com/orgs/ursa-labs/members{/member}", + "node_id": "MDEyOk9yZ2FuaXphdGlvbjQ2NTE0OTcy", + "public_members_url": "https://api.github.com/orgs/ursa-labs/public_members{/member}", + "repos_url": "https://api.github.com/orgs/ursa-labs/repos", + "url": "https://api.github.com/orgs/ursa-labs" + }, + "pull_request": { + "url": "https://api.github.com/repos/ursa-labs/ursabot/pulls/26", + "id": 267785552, + "node_id": "MDExOlB1bGxSZXF1ZXN0MjY3Nzg1NTUy", + "html_url": "https://github.com/ursa-labs/ursabot/pull/26", + "diff_url": "https://github.com/ursa-labs/ursabot/pull/26.diff", + "patch_url": "https://github.com/ursa-labs/ursabot/pull/26.patch", + "issue_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/26", + "number": 26, + "state": "open", + "locked": false, + "title": "Unittests for GithubHook", + "user": { + "login": "kszucs", + "id": 961747, + "node_id": "MDQ6VXNlcjk2MTc0Nw==", + "avatar_url": "https://avatars1.githubusercontent.com/u/961747?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/kszucs", + "html_url": "https://github.com/kszucs", + "followers_url": "https://api.github.com/users/kszucs/followers", + "following_url": "https://api.github.com/users/kszucs/following{/other_user}", + "gists_url": "https://api.github.com/users/kszucs/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kszucs/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kszucs/subscriptions", + "organizations_url": "https://api.github.com/users/kszucs/orgs", + "repos_url": "https://api.github.com/users/kszucs/repos", + "events_url": "https://api.github.com/users/kszucs/events{/privacy}", + "received_events_url": "https://api.github.com/users/kszucs/received_events", + "type": "User", + "site_admin": false + }, + "body": "", + "created_at": "2019-04-05T11:22:15Z", + "updated_at": "2019-04-05T12:01:40Z", + "closed_at": null, + "merged_at": null, + "merge_commit_sha": "cc5dc3606988b3824be54df779ed2028776113cb", + "assignee": null, + "assignees": [], + "requested_reviewers": [], + "requested_teams": [], + "labels": [], + "milestone": null, + "commits_url": "https://api.github.com/repos/ursa-labs/ursabot/pulls/26/commits", + "review_comments_url": "https://api.github.com/repos/ursa-labs/ursabot/pulls/26/comments", + "review_comment_url": "https://api.github.com/repos/ursa-labs/ursabot/pulls/comments{/number}", + "comments_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/26/comments", + "statuses_url": "https://api.github.com/repos/ursa-labs/ursabot/statuses/2705da2b616b98fa6010a25813c5a7a27456f71d", + "head": { + "label": "ursa-labs:test-hook", + "ref": "test-hook", + "sha": "2705da2b616b98fa6010a25813c5a7a27456f71d", + "user": { + "login": "ursa-labs", + "id": 46514972, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjQ2NTE0OTcy", + "avatar_url": "https://avatars2.githubusercontent.com/u/46514972?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/ursa-labs", + "html_url": "https://github.com/ursa-labs", + "followers_url": "https://api.github.com/users/ursa-labs/followers", + "following_url": "https://api.github.com/users/ursa-labs/following{/other_user}", + "gists_url": "https://api.github.com/users/ursa-labs/gists{/gist_id}", + "starred_url": "https://api.github.com/users/ursa-labs/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/ursa-labs/subscriptions", + "organizations_url": "https://api.github.com/users/ursa-labs/orgs", + "repos_url": "https://api.github.com/users/ursa-labs/repos", + "events_url": "https://api.github.com/users/ursa-labs/events{/privacy}", + "received_events_url": "https://api.github.com/users/ursa-labs/received_events", + "type": "Organization", + "site_admin": false + }, + "repo": { + "id": 169101701, + "node_id": "MDEwOlJlcG9zaXRvcnkxNjkxMDE3MDE=", + "name": "ursabot", + "full_name": "ursa-labs/ursabot", + "private": false, + "owner": { + "login": "ursa-labs", + "id": 46514972, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjQ2NTE0OTcy", + "avatar_url": "https://avatars2.githubusercontent.com/u/46514972?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/ursa-labs", + "html_url": "https://github.com/ursa-labs", + "followers_url": "https://api.github.com/users/ursa-labs/followers", + "following_url": "https://api.github.com/users/ursa-labs/following{/other_user}", + "gists_url": "https://api.github.com/users/ursa-labs/gists{/gist_id}", + "starred_url": "https://api.github.com/users/ursa-labs/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/ursa-labs/subscriptions", + "organizations_url": "https://api.github.com/users/ursa-labs/orgs", + "repos_url": "https://api.github.com/users/ursa-labs/repos", + "events_url": "https://api.github.com/users/ursa-labs/events{/privacy}", + "received_events_url": "https://api.github.com/users/ursa-labs/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/ursa-labs/ursabot", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/ursa-labs/ursabot", + "forks_url": "https://api.github.com/repos/ursa-labs/ursabot/forks", + "keys_url": "https://api.github.com/repos/ursa-labs/ursabot/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/ursa-labs/ursabot/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/ursa-labs/ursabot/teams", + "hooks_url": "https://api.github.com/repos/ursa-labs/ursabot/hooks", + "issue_events_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/events{/number}", + "events_url": "https://api.github.com/repos/ursa-labs/ursabot/events", + "assignees_url": "https://api.github.com/repos/ursa-labs/ursabot/assignees{/user}", + "branches_url": "https://api.github.com/repos/ursa-labs/ursabot/branches{/branch}", + "tags_url": "https://api.github.com/repos/ursa-labs/ursabot/tags", + "blobs_url": "https://api.github.com/repos/ursa-labs/ursabot/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/ursa-labs/ursabot/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/ursa-labs/ursabot/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/ursa-labs/ursabot/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/ursa-labs/ursabot/statuses/{sha}", + "languages_url": "https://api.github.com/repos/ursa-labs/ursabot/languages", + "stargazers_url": "https://api.github.com/repos/ursa-labs/ursabot/stargazers", + "contributors_url": "https://api.github.com/repos/ursa-labs/ursabot/contributors", + "subscribers_url": "https://api.github.com/repos/ursa-labs/ursabot/subscribers", + "subscription_url": "https://api.github.com/repos/ursa-labs/ursabot/subscription", + "commits_url": "https://api.github.com/repos/ursa-labs/ursabot/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/ursa-labs/ursabot/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/ursa-labs/ursabot/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/ursa-labs/ursabot/contents/{+path}", + "compare_url": "https://api.github.com/repos/ursa-labs/ursabot/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/ursa-labs/ursabot/merges", + "archive_url": "https://api.github.com/repos/ursa-labs/ursabot/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/ursa-labs/ursabot/downloads", + "issues_url": "https://api.github.com/repos/ursa-labs/ursabot/issues{/number}", + "pulls_url": "https://api.github.com/repos/ursa-labs/ursabot/pulls{/number}", + "milestones_url": "https://api.github.com/repos/ursa-labs/ursabot/milestones{/number}", + "notifications_url": "https://api.github.com/repos/ursa-labs/ursabot/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/ursa-labs/ursabot/labels{/name}", + "releases_url": "https://api.github.com/repos/ursa-labs/ursabot/releases{/id}", + "deployments_url": "https://api.github.com/repos/ursa-labs/ursabot/deployments", + "created_at": "2019-02-04T15:40:31Z", + "updated_at": "2019-04-04T17:49:10Z", + "pushed_at": "2019-04-05T12:01:40Z", + "git_url": "git://github.com/ursa-labs/ursabot.git", + "ssh_url": "git@github.com:ursa-labs/ursabot.git", + "clone_url": "https://github.com/ursa-labs/ursabot.git", + "svn_url": "https://github.com/ursa-labs/ursabot", + "homepage": null, + "size": 898, + "stargazers_count": 1, + "watchers_count": 1, + "language": "Jupyter Notebook", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 19, + "license": null, + "forks": 0, + "open_issues": 19, + "watchers": 1, + "default_branch": "master" + } + }, + "base": { + "label": "ursa-labs:master", + "ref": "master", + "sha": "a162ad254b589b924db47e057791191b39613fd5", + "user": { + "login": "ursa-labs", + "id": 46514972, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjQ2NTE0OTcy", + "avatar_url": "https://avatars2.githubusercontent.com/u/46514972?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/ursa-labs", + "html_url": "https://github.com/ursa-labs", + "followers_url": "https://api.github.com/users/ursa-labs/followers", + "following_url": "https://api.github.com/users/ursa-labs/following{/other_user}", + "gists_url": "https://api.github.com/users/ursa-labs/gists{/gist_id}", + "starred_url": "https://api.github.com/users/ursa-labs/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/ursa-labs/subscriptions", + "organizations_url": "https://api.github.com/users/ursa-labs/orgs", + "repos_url": "https://api.github.com/users/ursa-labs/repos", + "events_url": "https://api.github.com/users/ursa-labs/events{/privacy}", + "received_events_url": "https://api.github.com/users/ursa-labs/received_events", + "type": "Organization", + "site_admin": false + }, + "repo": { + "id": 169101701, + "node_id": "MDEwOlJlcG9zaXRvcnkxNjkxMDE3MDE=", + "name": "ursabot", + "full_name": "ursa-labs/ursabot", + "private": false, + "owner": { + "login": "ursa-labs", + "id": 46514972, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjQ2NTE0OTcy", + "avatar_url": "https://avatars2.githubusercontent.com/u/46514972?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/ursa-labs", + "html_url": "https://github.com/ursa-labs", + "followers_url": "https://api.github.com/users/ursa-labs/followers", + "following_url": "https://api.github.com/users/ursa-labs/following{/other_user}", + "gists_url": "https://api.github.com/users/ursa-labs/gists{/gist_id}", + "starred_url": "https://api.github.com/users/ursa-labs/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/ursa-labs/subscriptions", + "organizations_url": "https://api.github.com/users/ursa-labs/orgs", + "repos_url": "https://api.github.com/users/ursa-labs/repos", + "events_url": "https://api.github.com/users/ursa-labs/events{/privacy}", + "received_events_url": "https://api.github.com/users/ursa-labs/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/ursa-labs/ursabot", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/ursa-labs/ursabot", + "forks_url": "https://api.github.com/repos/ursa-labs/ursabot/forks", + "keys_url": "https://api.github.com/repos/ursa-labs/ursabot/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/ursa-labs/ursabot/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/ursa-labs/ursabot/teams", + "hooks_url": "https://api.github.com/repos/ursa-labs/ursabot/hooks", + "issue_events_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/events{/number}", + "events_url": "https://api.github.com/repos/ursa-labs/ursabot/events", + "assignees_url": "https://api.github.com/repos/ursa-labs/ursabot/assignees{/user}", + "branches_url": "https://api.github.com/repos/ursa-labs/ursabot/branches{/branch}", + "tags_url": "https://api.github.com/repos/ursa-labs/ursabot/tags", + "blobs_url": "https://api.github.com/repos/ursa-labs/ursabot/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/ursa-labs/ursabot/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/ursa-labs/ursabot/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/ursa-labs/ursabot/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/ursa-labs/ursabot/statuses/{sha}", + "languages_url": "https://api.github.com/repos/ursa-labs/ursabot/languages", + "stargazers_url": "https://api.github.com/repos/ursa-labs/ursabot/stargazers", + "contributors_url": "https://api.github.com/repos/ursa-labs/ursabot/contributors", + "subscribers_url": "https://api.github.com/repos/ursa-labs/ursabot/subscribers", + "subscription_url": "https://api.github.com/repos/ursa-labs/ursabot/subscription", + "commits_url": "https://api.github.com/repos/ursa-labs/ursabot/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/ursa-labs/ursabot/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/ursa-labs/ursabot/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/ursa-labs/ursabot/contents/{+path}", + "compare_url": "https://api.github.com/repos/ursa-labs/ursabot/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/ursa-labs/ursabot/merges", + "archive_url": "https://api.github.com/repos/ursa-labs/ursabot/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/ursa-labs/ursabot/downloads", + "issues_url": "https://api.github.com/repos/ursa-labs/ursabot/issues{/number}", + "pulls_url": "https://api.github.com/repos/ursa-labs/ursabot/pulls{/number}", + "milestones_url": "https://api.github.com/repos/ursa-labs/ursabot/milestones{/number}", + "notifications_url": "https://api.github.com/repos/ursa-labs/ursabot/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/ursa-labs/ursabot/labels{/name}", + "releases_url": "https://api.github.com/repos/ursa-labs/ursabot/releases{/id}", + "deployments_url": "https://api.github.com/repos/ursa-labs/ursabot/deployments", + "created_at": "2019-02-04T15:40:31Z", + "updated_at": "2019-04-04T17:49:10Z", + "pushed_at": "2019-04-05T12:01:40Z", + "git_url": "git://github.com/ursa-labs/ursabot.git", + "ssh_url": "git@github.com:ursa-labs/ursabot.git", + "clone_url": "https://github.com/ursa-labs/ursabot.git", + "svn_url": "https://github.com/ursa-labs/ursabot", + "homepage": null, + "size": 898, + "stargazers_count": 1, + "watchers_count": 1, + "language": "Jupyter Notebook", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 19, + "license": null, + "forks": 0, + "open_issues": 19, + "watchers": 1, + "default_branch": "master" + } + }, + "_links": { + "self": { + "href": "https://api.github.com/repos/ursa-labs/ursabot/pulls/26" + }, + "html": { + "href": "https://github.com/ursa-labs/ursabot/pull/26" + }, + "issue": { + "href": "https://api.github.com/repos/ursa-labs/ursabot/issues/26" + }, + "comments": { + "href": "https://api.github.com/repos/ursa-labs/ursabot/issues/26/comments" + }, + "review_comments": { + "href": "https://api.github.com/repos/ursa-labs/ursabot/pulls/26/comments" + }, + "review_comment": { + "href": "https://api.github.com/repos/ursa-labs/ursabot/pulls/comments{/number}" + }, + "commits": { + "href": "https://api.github.com/repos/ursa-labs/ursabot/pulls/26/commits" + }, + "statuses": { + "href": "https://api.github.com/repos/ursa-labs/ursabot/statuses/2705da2b616b98fa6010a25813c5a7a27456f71d" + } + }, + "author_association": "COLLABORATOR", + "merged": false, + "mergeable": true, + "rebaseable": true, + "mergeable_state": "unstable", + "merged_by": null, + "comments": 5, + "review_comments": 0, + "maintainer_can_modify": false, + "commits": 2, + "additions": 1124, + "deletions": 0, + "changed_files": 7 + }, + "repository": { + "archive_url": "https://api.github.com/repos/ursa-labs/ursabot/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/ursa-labs/ursabot/assignees{/user}", + "blobs_url": "https://api.github.com/repos/ursa-labs/ursabot/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/ursa-labs/ursabot/branches{/branch}", + "clone_url": "https://github.com/ursa-labs/ursabot.git", + "collaborators_url": "https://api.github.com/repos/ursa-labs/ursabot/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/ursa-labs/ursabot/comments{/number}", + "commits_url": "https://api.github.com/repos/ursa-labs/ursabot/commits{/sha}", + "compare_url": "https://api.github.com/repos/ursa-labs/ursabot/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/ursa-labs/ursabot/contents/{+path}", + "contributors_url": "https://api.github.com/repos/ursa-labs/ursabot/contributors", + "created_at": "2019-02-04T15:40:31Z", + "default_branch": "master", + "deployments_url": "https://api.github.com/repos/ursa-labs/ursabot/deployments", + "description": null, + "disabled": false, + "downloads_url": "https://api.github.com/repos/ursa-labs/ursabot/downloads", + "events_url": "https://api.github.com/repos/ursa-labs/ursabot/events", + "fork": false, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/ursa-labs/ursabot/forks", + "full_name": "ursa-labs/ursabot", + "git_commits_url": "https://api.github.com/repos/ursa-labs/ursabot/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/ursa-labs/ursabot/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/ursa-labs/ursabot/git/tags{/sha}", + "git_url": "git://github.com/ursa-labs/ursabot.git", + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/ursa-labs/ursabot/hooks", + "html_url": "https://github.com/ursa-labs/ursabot", + "id": 169101701, + "issue_comment_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/events{/number}", + "issues_url": "https://api.github.com/repos/ursa-labs/ursabot/issues{/number}", + "keys_url": "https://api.github.com/repos/ursa-labs/ursabot/keys{/key_id}", + "labels_url": "https://api.github.com/repos/ursa-labs/ursabot/labels{/name}", + "language": "Jupyter Notebook", + "languages_url": "https://api.github.com/repos/ursa-labs/ursabot/languages", + "license": null, + "merges_url": "https://api.github.com/repos/ursa-labs/ursabot/merges", + "milestones_url": "https://api.github.com/repos/ursa-labs/ursabot/milestones{/number}", + "mirror_url": null, + "name": "ursabot", + "node_id": "MDEwOlJlcG9zaXRvcnkxNjkxMDE3MDE=", + "notifications_url": "https://api.github.com/repos/ursa-labs/ursabot/notifications{?since,all,participating}", + "open_issues": 19, + "open_issues_count": 19, + "owner": { + "avatar_url": "https://avatars2.githubusercontent.com/u/46514972?v=4", + "events_url": "https://api.github.com/users/ursa-labs/events{/privacy}", + "followers_url": "https://api.github.com/users/ursa-labs/followers", + "following_url": "https://api.github.com/users/ursa-labs/following{/other_user}", + "gists_url": "https://api.github.com/users/ursa-labs/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/ursa-labs", + "id": 46514972, + "login": "ursa-labs", + "node_id": "MDEyOk9yZ2FuaXphdGlvbjQ2NTE0OTcy", + "organizations_url": "https://api.github.com/users/ursa-labs/orgs", + "received_events_url": "https://api.github.com/users/ursa-labs/received_events", + "repos_url": "https://api.github.com/users/ursa-labs/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/ursa-labs/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/ursa-labs/subscriptions", + "type": "Organization", + "url": "https://api.github.com/users/ursa-labs" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/ursa-labs/ursabot/pulls{/number}", + "pushed_at": "2019-04-05T11:22:16Z", + "releases_url": "https://api.github.com/repos/ursa-labs/ursabot/releases{/id}", + "size": 892, + "ssh_url": "git@github.com:ursa-labs/ursabot.git", + "stargazers_count": 1, + "stargazers_url": "https://api.github.com/repos/ursa-labs/ursabot/stargazers", + "statuses_url": "https://api.github.com/repos/ursa-labs/ursabot/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/ursa-labs/ursabot/subscribers", + "subscription_url": "https://api.github.com/repos/ursa-labs/ursabot/subscription", + "svn_url": "https://github.com/ursa-labs/ursabot", + "tags_url": "https://api.github.com/repos/ursa-labs/ursabot/tags", + "teams_url": "https://api.github.com/repos/ursa-labs/ursabot/teams", + "trees_url": "https://api.github.com/repos/ursa-labs/ursabot/git/trees{/sha}", + "updated_at": "2019-04-04T17:49:10Z", + "url": "https://api.github.com/repos/ursa-labs/ursabot", + "watchers": 1, + "watchers_count": 1 + }, + "sender": { + "avatar_url": "https://avatars1.githubusercontent.com/u/961747?v=4", + "events_url": "https://api.github.com/users/kszucs/events{/privacy}", + "followers_url": "https://api.github.com/users/kszucs/followers", + "following_url": "https://api.github.com/users/kszucs/following{/other_user}", + "gists_url": "https://api.github.com/users/kszucs/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/kszucs", + "id": 961747, + "login": "kszucs", + "node_id": "MDQ6VXNlcjk2MTc0Nw==", + "organizations_url": "https://api.github.com/users/kszucs/orgs", + "received_events_url": "https://api.github.com/users/kszucs/received_events", + "repos_url": "https://api.github.com/users/kszucs/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/kszucs/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kszucs/subscriptions", + "type": "User", + "url": "https://api.github.com/users/kszucs" + } +} \ No newline at end of file diff --git a/dev/archery/archery/tests/fixtures/event-pull-request-target-synchronize.json b/dev/archery/archery/tests/fixtures/event-pull-request-target-synchronize.json new file mode 100644 index 0000000000000..e7e7055e964c2 --- /dev/null +++ b/dev/archery/archery/tests/fixtures/event-pull-request-target-synchronize.json @@ -0,0 +1,461 @@ +{ + "action":"synchronize", + "after":"adb2aa57728760966113411e5013eb415e1d2fd6", + "before":"e3be5a5b09396b629ee8b9cee2bea6f405b8ab1f", + "number":26, + "organization": { + "avatar_url": "https://avatars2.githubusercontent.com/u/46514972?v=4", + "description": "Innovation lab for open source data science tools, powered by Apache Arrow", + "events_url": "https://api.github.com/orgs/ursa-labs/events", + "hooks_url": "https://api.github.com/orgs/ursa-labs/hooks", + "id": 46514972, + "issues_url": "https://api.github.com/orgs/ursa-labs/issues", + "login": "ursa-labs", + "members_url": "https://api.github.com/orgs/ursa-labs/members{/member}", + "node_id": "MDEyOk9yZ2FuaXphdGlvbjQ2NTE0OTcy", + "public_members_url": "https://api.github.com/orgs/ursa-labs/public_members{/member}", + "repos_url": "https://api.github.com/orgs/ursa-labs/repos", + "url": "https://api.github.com/orgs/ursa-labs" + }, + "pull_request": { + "url": "https://api.github.com/repos/ursa-labs/ursabot/pulls/26", + "id": 267785552, + "node_id": "MDExOlB1bGxSZXF1ZXN0MjY3Nzg1NTUy", + "html_url": "https://github.com/ursa-labs/ursabot/pull/26", + "diff_url": "https://github.com/ursa-labs/ursabot/pull/26.diff", + "patch_url": "https://github.com/ursa-labs/ursabot/pull/26.patch", + "issue_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/26", + "number": 26, + "state": "open", + "locked": false, + "title": "Unittests for GithubHook", + "user": { + "login": "kszucs", + "id": 961747, + "node_id": "MDQ6VXNlcjk2MTc0Nw==", + "avatar_url": "https://avatars1.githubusercontent.com/u/961747?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/kszucs", + "html_url": "https://github.com/kszucs", + "followers_url": "https://api.github.com/users/kszucs/followers", + "following_url": "https://api.github.com/users/kszucs/following{/other_user}", + "gists_url": "https://api.github.com/users/kszucs/gists{/gist_id}", + "starred_url": "https://api.github.com/users/kszucs/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kszucs/subscriptions", + "organizations_url": "https://api.github.com/users/kszucs/orgs", + "repos_url": "https://api.github.com/users/kszucs/repos", + "events_url": "https://api.github.com/users/kszucs/events{/privacy}", + "received_events_url": "https://api.github.com/users/kszucs/received_events", + "type": "User", + "site_admin": false + }, + "body": "", + "created_at": "2019-04-05T11:22:15Z", + "updated_at": "2019-04-05T12:01:40Z", + "closed_at": null, + "merged_at": null, + "merge_commit_sha": "cc5dc3606988b3824be54df779ed2028776113cb", + "assignee": null, + "assignees": [], + "requested_reviewers": [], + "requested_teams": [], + "labels": [], + "milestone": null, + "commits_url": "https://api.github.com/repos/ursa-labs/ursabot/pulls/26/commits", + "review_comments_url": "https://api.github.com/repos/ursa-labs/ursabot/pulls/26/comments", + "review_comment_url": "https://api.github.com/repos/ursa-labs/ursabot/pulls/comments{/number}", + "comments_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/26/comments", + "statuses_url": "https://api.github.com/repos/ursa-labs/ursabot/statuses/2705da2b616b98fa6010a25813c5a7a27456f71d", + "head": { + "label": "ursa-labs:test-hook", + "ref": "test-hook", + "sha": "2705da2b616b98fa6010a25813c5a7a27456f71d", + "user": { + "login": "ursa-labs", + "id": 46514972, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjQ2NTE0OTcy", + "avatar_url": "https://avatars2.githubusercontent.com/u/46514972?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/ursa-labs", + "html_url": "https://github.com/ursa-labs", + "followers_url": "https://api.github.com/users/ursa-labs/followers", + "following_url": "https://api.github.com/users/ursa-labs/following{/other_user}", + "gists_url": "https://api.github.com/users/ursa-labs/gists{/gist_id}", + "starred_url": "https://api.github.com/users/ursa-labs/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/ursa-labs/subscriptions", + "organizations_url": "https://api.github.com/users/ursa-labs/orgs", + "repos_url": "https://api.github.com/users/ursa-labs/repos", + "events_url": "https://api.github.com/users/ursa-labs/events{/privacy}", + "received_events_url": "https://api.github.com/users/ursa-labs/received_events", + "type": "Organization", + "site_admin": false + }, + "repo": { + "id": 169101701, + "node_id": "MDEwOlJlcG9zaXRvcnkxNjkxMDE3MDE=", + "name": "ursabot", + "full_name": "ursa-labs/ursabot", + "private": false, + "owner": { + "login": "ursa-labs", + "id": 46514972, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjQ2NTE0OTcy", + "avatar_url": "https://avatars2.githubusercontent.com/u/46514972?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/ursa-labs", + "html_url": "https://github.com/ursa-labs", + "followers_url": "https://api.github.com/users/ursa-labs/followers", + "following_url": "https://api.github.com/users/ursa-labs/following{/other_user}", + "gists_url": "https://api.github.com/users/ursa-labs/gists{/gist_id}", + "starred_url": "https://api.github.com/users/ursa-labs/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/ursa-labs/subscriptions", + "organizations_url": "https://api.github.com/users/ursa-labs/orgs", + "repos_url": "https://api.github.com/users/ursa-labs/repos", + "events_url": "https://api.github.com/users/ursa-labs/events{/privacy}", + "received_events_url": "https://api.github.com/users/ursa-labs/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/ursa-labs/ursabot", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/ursa-labs/ursabot", + "forks_url": "https://api.github.com/repos/ursa-labs/ursabot/forks", + "keys_url": "https://api.github.com/repos/ursa-labs/ursabot/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/ursa-labs/ursabot/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/ursa-labs/ursabot/teams", + "hooks_url": "https://api.github.com/repos/ursa-labs/ursabot/hooks", + "issue_events_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/events{/number}", + "events_url": "https://api.github.com/repos/ursa-labs/ursabot/events", + "assignees_url": "https://api.github.com/repos/ursa-labs/ursabot/assignees{/user}", + "branches_url": "https://api.github.com/repos/ursa-labs/ursabot/branches{/branch}", + "tags_url": "https://api.github.com/repos/ursa-labs/ursabot/tags", + "blobs_url": "https://api.github.com/repos/ursa-labs/ursabot/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/ursa-labs/ursabot/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/ursa-labs/ursabot/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/ursa-labs/ursabot/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/ursa-labs/ursabot/statuses/{sha}", + "languages_url": "https://api.github.com/repos/ursa-labs/ursabot/languages", + "stargazers_url": "https://api.github.com/repos/ursa-labs/ursabot/stargazers", + "contributors_url": "https://api.github.com/repos/ursa-labs/ursabot/contributors", + "subscribers_url": "https://api.github.com/repos/ursa-labs/ursabot/subscribers", + "subscription_url": "https://api.github.com/repos/ursa-labs/ursabot/subscription", + "commits_url": "https://api.github.com/repos/ursa-labs/ursabot/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/ursa-labs/ursabot/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/ursa-labs/ursabot/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/ursa-labs/ursabot/contents/{+path}", + "compare_url": "https://api.github.com/repos/ursa-labs/ursabot/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/ursa-labs/ursabot/merges", + "archive_url": "https://api.github.com/repos/ursa-labs/ursabot/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/ursa-labs/ursabot/downloads", + "issues_url": "https://api.github.com/repos/ursa-labs/ursabot/issues{/number}", + "pulls_url": "https://api.github.com/repos/ursa-labs/ursabot/pulls{/number}", + "milestones_url": "https://api.github.com/repos/ursa-labs/ursabot/milestones{/number}", + "notifications_url": "https://api.github.com/repos/ursa-labs/ursabot/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/ursa-labs/ursabot/labels{/name}", + "releases_url": "https://api.github.com/repos/ursa-labs/ursabot/releases{/id}", + "deployments_url": "https://api.github.com/repos/ursa-labs/ursabot/deployments", + "created_at": "2019-02-04T15:40:31Z", + "updated_at": "2019-04-04T17:49:10Z", + "pushed_at": "2019-04-05T12:01:40Z", + "git_url": "git://github.com/ursa-labs/ursabot.git", + "ssh_url": "git@github.com:ursa-labs/ursabot.git", + "clone_url": "https://github.com/ursa-labs/ursabot.git", + "svn_url": "https://github.com/ursa-labs/ursabot", + "homepage": null, + "size": 898, + "stargazers_count": 1, + "watchers_count": 1, + "language": "Jupyter Notebook", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 19, + "license": null, + "forks": 0, + "open_issues": 19, + "watchers": 1, + "default_branch": "master" + } + }, + "base": { + "label": "ursa-labs:master", + "ref": "master", + "sha": "a162ad254b589b924db47e057791191b39613fd5", + "user": { + "login": "ursa-labs", + "id": 46514972, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjQ2NTE0OTcy", + "avatar_url": "https://avatars2.githubusercontent.com/u/46514972?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/ursa-labs", + "html_url": "https://github.com/ursa-labs", + "followers_url": "https://api.github.com/users/ursa-labs/followers", + "following_url": "https://api.github.com/users/ursa-labs/following{/other_user}", + "gists_url": "https://api.github.com/users/ursa-labs/gists{/gist_id}", + "starred_url": "https://api.github.com/users/ursa-labs/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/ursa-labs/subscriptions", + "organizations_url": "https://api.github.com/users/ursa-labs/orgs", + "repos_url": "https://api.github.com/users/ursa-labs/repos", + "events_url": "https://api.github.com/users/ursa-labs/events{/privacy}", + "received_events_url": "https://api.github.com/users/ursa-labs/received_events", + "type": "Organization", + "site_admin": false + }, + "repo": { + "id": 169101701, + "node_id": "MDEwOlJlcG9zaXRvcnkxNjkxMDE3MDE=", + "name": "ursabot", + "full_name": "ursa-labs/ursabot", + "private": false, + "owner": { + "login": "ursa-labs", + "id": 46514972, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjQ2NTE0OTcy", + "avatar_url": "https://avatars2.githubusercontent.com/u/46514972?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/ursa-labs", + "html_url": "https://github.com/ursa-labs", + "followers_url": "https://api.github.com/users/ursa-labs/followers", + "following_url": "https://api.github.com/users/ursa-labs/following{/other_user}", + "gists_url": "https://api.github.com/users/ursa-labs/gists{/gist_id}", + "starred_url": "https://api.github.com/users/ursa-labs/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/ursa-labs/subscriptions", + "organizations_url": "https://api.github.com/users/ursa-labs/orgs", + "repos_url": "https://api.github.com/users/ursa-labs/repos", + "events_url": "https://api.github.com/users/ursa-labs/events{/privacy}", + "received_events_url": "https://api.github.com/users/ursa-labs/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/ursa-labs/ursabot", + "description": null, + "fork": false, + "url": "https://api.github.com/repos/ursa-labs/ursabot", + "forks_url": "https://api.github.com/repos/ursa-labs/ursabot/forks", + "keys_url": "https://api.github.com/repos/ursa-labs/ursabot/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/ursa-labs/ursabot/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/ursa-labs/ursabot/teams", + "hooks_url": "https://api.github.com/repos/ursa-labs/ursabot/hooks", + "issue_events_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/events{/number}", + "events_url": "https://api.github.com/repos/ursa-labs/ursabot/events", + "assignees_url": "https://api.github.com/repos/ursa-labs/ursabot/assignees{/user}", + "branches_url": "https://api.github.com/repos/ursa-labs/ursabot/branches{/branch}", + "tags_url": "https://api.github.com/repos/ursa-labs/ursabot/tags", + "blobs_url": "https://api.github.com/repos/ursa-labs/ursabot/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/ursa-labs/ursabot/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/ursa-labs/ursabot/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/ursa-labs/ursabot/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/ursa-labs/ursabot/statuses/{sha}", + "languages_url": "https://api.github.com/repos/ursa-labs/ursabot/languages", + "stargazers_url": "https://api.github.com/repos/ursa-labs/ursabot/stargazers", + "contributors_url": "https://api.github.com/repos/ursa-labs/ursabot/contributors", + "subscribers_url": "https://api.github.com/repos/ursa-labs/ursabot/subscribers", + "subscription_url": "https://api.github.com/repos/ursa-labs/ursabot/subscription", + "commits_url": "https://api.github.com/repos/ursa-labs/ursabot/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/ursa-labs/ursabot/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/ursa-labs/ursabot/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/ursa-labs/ursabot/contents/{+path}", + "compare_url": "https://api.github.com/repos/ursa-labs/ursabot/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/ursa-labs/ursabot/merges", + "archive_url": "https://api.github.com/repos/ursa-labs/ursabot/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/ursa-labs/ursabot/downloads", + "issues_url": "https://api.github.com/repos/ursa-labs/ursabot/issues{/number}", + "pulls_url": "https://api.github.com/repos/ursa-labs/ursabot/pulls{/number}", + "milestones_url": "https://api.github.com/repos/ursa-labs/ursabot/milestones{/number}", + "notifications_url": "https://api.github.com/repos/ursa-labs/ursabot/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/ursa-labs/ursabot/labels{/name}", + "releases_url": "https://api.github.com/repos/ursa-labs/ursabot/releases{/id}", + "deployments_url": "https://api.github.com/repos/ursa-labs/ursabot/deployments", + "created_at": "2019-02-04T15:40:31Z", + "updated_at": "2019-04-04T17:49:10Z", + "pushed_at": "2019-04-05T12:01:40Z", + "git_url": "git://github.com/ursa-labs/ursabot.git", + "ssh_url": "git@github.com:ursa-labs/ursabot.git", + "clone_url": "https://github.com/ursa-labs/ursabot.git", + "svn_url": "https://github.com/ursa-labs/ursabot", + "homepage": null, + "size": 898, + "stargazers_count": 1, + "watchers_count": 1, + "language": "Jupyter Notebook", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 19, + "license": null, + "forks": 0, + "open_issues": 19, + "watchers": 1, + "default_branch": "master" + } + }, + "_links": { + "self": { + "href": "https://api.github.com/repos/ursa-labs/ursabot/pulls/26" + }, + "html": { + "href": "https://github.com/ursa-labs/ursabot/pull/26" + }, + "issue": { + "href": "https://api.github.com/repos/ursa-labs/ursabot/issues/26" + }, + "comments": { + "href": "https://api.github.com/repos/ursa-labs/ursabot/issues/26/comments" + }, + "review_comments": { + "href": "https://api.github.com/repos/ursa-labs/ursabot/pulls/26/comments" + }, + "review_comment": { + "href": "https://api.github.com/repos/ursa-labs/ursabot/pulls/comments{/number}" + }, + "commits": { + "href": "https://api.github.com/repos/ursa-labs/ursabot/pulls/26/commits" + }, + "statuses": { + "href": "https://api.github.com/repos/ursa-labs/ursabot/statuses/2705da2b616b98fa6010a25813c5a7a27456f71d" + } + }, + "author_association": "COLLABORATOR", + "merged": false, + "mergeable": true, + "rebaseable": true, + "mergeable_state": "unstable", + "merged_by": null, + "comments": 5, + "review_comments": 0, + "maintainer_can_modify": false, + "commits": 2, + "additions": 1124, + "deletions": 0, + "changed_files": 7 + }, + "repository": { + "archive_url": "https://api.github.com/repos/ursa-labs/ursabot/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/ursa-labs/ursabot/assignees{/user}", + "blobs_url": "https://api.github.com/repos/ursa-labs/ursabot/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/ursa-labs/ursabot/branches{/branch}", + "clone_url": "https://github.com/ursa-labs/ursabot.git", + "collaborators_url": "https://api.github.com/repos/ursa-labs/ursabot/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/ursa-labs/ursabot/comments{/number}", + "commits_url": "https://api.github.com/repos/ursa-labs/ursabot/commits{/sha}", + "compare_url": "https://api.github.com/repos/ursa-labs/ursabot/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/ursa-labs/ursabot/contents/{+path}", + "contributors_url": "https://api.github.com/repos/ursa-labs/ursabot/contributors", + "created_at": "2019-02-04T15:40:31Z", + "default_branch": "master", + "deployments_url": "https://api.github.com/repos/ursa-labs/ursabot/deployments", + "description": null, + "disabled": false, + "downloads_url": "https://api.github.com/repos/ursa-labs/ursabot/downloads", + "events_url": "https://api.github.com/repos/ursa-labs/ursabot/events", + "fork": false, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/ursa-labs/ursabot/forks", + "full_name": "ursa-labs/ursabot", + "git_commits_url": "https://api.github.com/repos/ursa-labs/ursabot/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/ursa-labs/ursabot/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/ursa-labs/ursabot/git/tags{/sha}", + "git_url": "git://github.com/ursa-labs/ursabot.git", + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/ursa-labs/ursabot/hooks", + "html_url": "https://github.com/ursa-labs/ursabot", + "id": 169101701, + "issue_comment_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/events{/number}", + "issues_url": "https://api.github.com/repos/ursa-labs/ursabot/issues{/number}", + "keys_url": "https://api.github.com/repos/ursa-labs/ursabot/keys{/key_id}", + "labels_url": "https://api.github.com/repos/ursa-labs/ursabot/labels{/name}", + "language": "Jupyter Notebook", + "languages_url": "https://api.github.com/repos/ursa-labs/ursabot/languages", + "license": null, + "merges_url": "https://api.github.com/repos/ursa-labs/ursabot/merges", + "milestones_url": "https://api.github.com/repos/ursa-labs/ursabot/milestones{/number}", + "mirror_url": null, + "name": "ursabot", + "node_id": "MDEwOlJlcG9zaXRvcnkxNjkxMDE3MDE=", + "notifications_url": "https://api.github.com/repos/ursa-labs/ursabot/notifications{?since,all,participating}", + "open_issues": 19, + "open_issues_count": 19, + "owner": { + "avatar_url": "https://avatars2.githubusercontent.com/u/46514972?v=4", + "events_url": "https://api.github.com/users/ursa-labs/events{/privacy}", + "followers_url": "https://api.github.com/users/ursa-labs/followers", + "following_url": "https://api.github.com/users/ursa-labs/following{/other_user}", + "gists_url": "https://api.github.com/users/ursa-labs/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/ursa-labs", + "id": 46514972, + "login": "ursa-labs", + "node_id": "MDEyOk9yZ2FuaXphdGlvbjQ2NTE0OTcy", + "organizations_url": "https://api.github.com/users/ursa-labs/orgs", + "received_events_url": "https://api.github.com/users/ursa-labs/received_events", + "repos_url": "https://api.github.com/users/ursa-labs/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/ursa-labs/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/ursa-labs/subscriptions", + "type": "Organization", + "url": "https://api.github.com/users/ursa-labs" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/ursa-labs/ursabot/pulls{/number}", + "pushed_at": "2019-04-05T11:22:16Z", + "releases_url": "https://api.github.com/repos/ursa-labs/ursabot/releases{/id}", + "size": 892, + "ssh_url": "git@github.com:ursa-labs/ursabot.git", + "stargazers_count": 1, + "stargazers_url": "https://api.github.com/repos/ursa-labs/ursabot/stargazers", + "statuses_url": "https://api.github.com/repos/ursa-labs/ursabot/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/ursa-labs/ursabot/subscribers", + "subscription_url": "https://api.github.com/repos/ursa-labs/ursabot/subscription", + "svn_url": "https://github.com/ursa-labs/ursabot", + "tags_url": "https://api.github.com/repos/ursa-labs/ursabot/tags", + "teams_url": "https://api.github.com/repos/ursa-labs/ursabot/teams", + "trees_url": "https://api.github.com/repos/ursa-labs/ursabot/git/trees{/sha}", + "updated_at": "2019-04-04T17:49:10Z", + "url": "https://api.github.com/repos/ursa-labs/ursabot", + "watchers": 1, + "watchers_count": 1 + }, + "sender": { + "avatar_url": "https://avatars1.githubusercontent.com/u/961747?v=4", + "events_url": "https://api.github.com/users/kszucs/events{/privacy}", + "followers_url": "https://api.github.com/users/kszucs/followers", + "following_url": "https://api.github.com/users/kszucs/following{/other_user}", + "gists_url": "https://api.github.com/users/kszucs/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/kszucs", + "id": 961747, + "login": "kszucs", + "node_id": "MDQ6VXNlcjk2MTc0Nw==", + "organizations_url": "https://api.github.com/users/kszucs/orgs", + "received_events_url": "https://api.github.com/users/kszucs/received_events", + "repos_url": "https://api.github.com/users/kszucs/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/kszucs/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/kszucs/subscriptions", + "type": "User", + "url": "https://api.github.com/users/kszucs" + } +} \ No newline at end of file diff --git a/dev/archery/archery/tests/fixtures/event-push.json b/dev/archery/archery/tests/fixtures/event-push.json deleted file mode 100644 index 345d0067fb768..0000000000000 --- a/dev/archery/archery/tests/fixtures/event-push.json +++ /dev/null @@ -1,184 +0,0 @@ -{ - "after":"27313fc220561ef6b0d5edb485b29684b405c80b", - "base_ref":"None", - "before":"8e95c04a29302429c4844fa7ab4f588de0702589", - "commits":[ - { - "author":{ - "email":"raulcumplido@gmail.com", - "name":"Raúl Cumplido", - "username":"raulcd" - }, - "committer":{ - "email":"raulcumplido@gmail.com", - "name":"Raúl Cumplido", - "username":"raulcd" - }, - "distinct":true, - "id":"27313fc220561ef6b0d5edb485b29684b405c80b", - "message":"Initial GitHub Workflow triggering archery bot", - "timestamp":"2023-02-10T12:30:01+01:00", - "tree_id":"c079a4afb0178472534363c85a01c7b7fa33daba", - "url":"https://github.com/ursa-labs/ursabot/commit/27313fc220561ef6b0d5edb485b29684b405c80b" - } - ], - "compare":"https://github.com/ursa-labs/ursabot/compare/8e95c04a2930...27313fc22056", - "created":false, - "deleted":false, - "forced":true, - "head_commit":{ - "author":{ - "email":"raulcumplido@gmail.com", - "name":"Raúl Cumplido", - "username":"raulcd" - }, - "committer":{ - "email":"raulcumplido@gmail.com", - "name":"Raúl Cumplido", - "username":"raulcd" - }, - "distinct":true, - "id":"27313fc220561ef6b0d5edb485b29684b405c80b", - "message":"Initial GitHub Workflow triggering archery bot", - "timestamp":"2023-02-10T12:30:01+01:00", - "tree_id":"c079a4afb0178472534363c85a01c7b7fa33daba", - "url":"https://github.com/ursa-labs/ursabot/commit/27313fc220561ef6b0d5edb485b29684b405c80b" - }, - "pusher":{ - "email":"raulcumplido@gmail.com", - "name":"raulcd" - }, - "ref":"refs/heads/pr-workflow-automation-poc", - "repository":{ - "allow_forking":true, - "archive_url":"https://api.github.com/repos/ursa-labs/ursabot/{archive_format}{/ref}", - "archived":false, - "assignees_url":"https://api.github.com/repos/ursa-labs/ursabot/assignees{/user}", - "blobs_url":"https://api.github.com/repos/ursa-labs/ursabot/git/blobs{/sha}", - "branches_url":"https://api.github.com/repos/ursa-labs/ursabot/branches{/branch}", - "clone_url":"https://github.com/ursa-labs/ursabot.git", - "collaborators_url":"https://api.github.com/repos/ursa-labs/ursabot/collaborators{/collaborator}", - "comments_url":"https://api.github.com/repos/ursa-labs/ursabot/comments{/number}", - "commits_url":"https://api.github.com/repos/ursa-labs/ursabot/commits{/sha}", - "compare_url":"https://api.github.com/repos/ursa-labs/ursabot/compare/{base}...{head}", - "contents_url":"https://api.github.com/repos/ursa-labs/ursabot/contents/{+path}", - "contributors_url":"https://api.github.com/repos/ursa-labs/ursabot/contributors", - "created_at":1649064396, - "default_branch":"master", - "deployments_url":"https://api.github.com/repos/ursa-labs/ursabot/deployments", - "description":"Apache Arrow is a multi-language toolbox for accelerated data interchange and in-memory processing", - "disabled":false, - "downloads_url":"https://api.github.com/repos/ursa-labs/ursabot/downloads", - "events_url":"https://api.github.com/repos/ursa-labs/ursabot/events", - "fork":true, - "forks":0, - "forks_count":0, - "forks_url":"https://api.github.com/repos/ursa-labs/ursabot/forks", - "full_name":"ursa-labs/ursabot", - "git_commits_url":"https://api.github.com/repos/ursa-labs/ursabot/git/commits{/sha}", - "git_refs_url":"https://api.github.com/repos/ursa-labs/ursabot/git/refs{/sha}", - "git_tags_url":"https://api.github.com/repos/ursa-labs/ursabot/git/tags{/sha}", - "git_url":"git://github.com/ursa-labs/ursabot.git", - "has_discussions":false, - "has_downloads":true, - "has_issues":true, - "has_pages":false, - "has_projects":true, - "has_wiki":false, - "homepage":"https://arrow.apache.org/", - "hooks_url":"https://api.github.com/repos/ursa-labs/ursabot/hooks", - "html_url":"https://github.com/ursa-labs/ursabot", - "id":169101701, - "is_template":false, - "issue_comment_url":"https://api.github.com/repos/ursa-labs/ursabot/issues/comments{/number}", - "issue_events_url":"https://api.github.com/repos/ursa-labs/ursabot/issues/events{/number}", - "issues_url":"https://api.github.com/repos/ursa-labs/ursabot/issues{/number}", - "keys_url":"https://api.github.com/repos/ursa-labs/ursabot/keys{/key_id}", - "labels_url":"https://api.github.com/repos/ursa-labs/ursabot/labels{/name}", - "language":"C++", - "languages_url":"https://api.github.com/repos/ursa-labs/ursabot/languages", - "license":{ - "key":"apache-2.0", - "name":"Apache License 2.0", - "node_id":"MDc6TGljZW5zZTI=", - "spdx_id":"Apache-2.0", - "url":"https://api.github.com/licenses/apache-2.0" - }, - "master_branch":"master", - "merges_url":"https://api.github.com/repos/ursa-labs/ursabot/merges", - "milestones_url":"https://api.github.com/repos/ursa-labs/ursabot/milestones{/number}", - "mirror_url":"None", - "name":"arrow", - "node_id":"R_kgDOHHgT2w", - "notifications_url":"https://api.github.com/repos/ursa-labs/ursabot/notifications{?since,all,participating}", - "open_issues":11, - "open_issues_count":11, - "owner":{ - "avatar_url":"https://avatars.githubusercontent.com/u/639755?v=4", - "email":"raulcumplido@gmail.com", - "events_url":"https://api.github.com/users/raulcd/events{/privacy}", - "followers_url":"https://api.github.com/users/raulcd/followers", - "following_url":"https://api.github.com/users/raulcd/following{/other_user}", - "gists_url":"https://api.github.com/users/raulcd/gists{/gist_id}", - "gravatar_id":"", - "html_url":"https://github.com/raulcd", - "id":639755, - "login":"raulcd", - "name":"raulcd", - "node_id":"MDQ6VXNlcjYzOTc1NQ==", - "organizations_url":"https://api.github.com/users/raulcd/orgs", - "received_events_url":"https://api.github.com/users/raulcd/received_events", - "repos_url":"https://api.github.com/users/raulcd/repos", - "site_admin":false, - "starred_url":"https://api.github.com/users/raulcd/starred{/owner}{/repo}", - "subscriptions_url":"https://api.github.com/users/raulcd/subscriptions", - "type":"User", - "url":"https://api.github.com/users/raulcd" - }, - "private":false, - "pulls_url":"https://api.github.com/repos/ursa-labs/ursabot/pulls{/number}", - "pushed_at":1676028624, - "releases_url":"https://api.github.com/repos/ursa-labs/ursabot/releases{/id}", - "size":150817, - "ssh_url":"git@github.com:ursa-labs/ursabot.git", - "stargazers":0, - "stargazers_count":0, - "stargazers_url":"https://api.github.com/repos/ursa-labs/ursabot/stargazers", - "statuses_url":"https://api.github.com/repos/ursa-labs/ursabot/statuses/{sha}", - "subscribers_url":"https://api.github.com/repos/ursa-labs/ursabot/subscribers", - "subscription_url":"https://api.github.com/repos/ursa-labs/ursabot/subscription", - "svn_url":"https://github.com/ursa-labs/ursabot", - "tags_url":"https://api.github.com/repos/ursa-labs/ursabot/tags", - "teams_url":"https://api.github.com/repos/ursa-labs/ursabot/teams", - "topics":[ - - ], - "trees_url":"https://api.github.com/repos/ursa-labs/ursabot/git/trees{/sha}", - "updated_at":"2022-11-24T17:34:08Z", - "url":"https://github.com/ursa-labs/ursabot", - "visibility":"public", - "watchers":0, - "watchers_count":0, - "web_commit_signoff_required":false - }, - "sender":{ - "avatar_url":"https://avatars.githubusercontent.com/u/639755?v=4", - "events_url":"https://api.github.com/users/raulcd/events{/privacy}", - "followers_url":"https://api.github.com/users/raulcd/followers", - "following_url":"https://api.github.com/users/raulcd/following{/other_user}", - "gists_url":"https://api.github.com/users/raulcd/gists{/gist_id}", - "gravatar_id":"", - "html_url":"https://github.com/raulcd", - "id":639755, - "login":"raulcd", - "node_id":"MDQ6VXNlcjYzOTc1NQ==", - "organizations_url":"https://api.github.com/users/raulcd/orgs", - "received_events_url":"https://api.github.com/users/raulcd/received_events", - "repos_url":"https://api.github.com/users/raulcd/repos", - "site_admin":false, - "starred_url":"https://api.github.com/users/raulcd/starred{/owner}{/repo}", - "subscriptions_url":"https://api.github.com/users/raulcd/subscriptions", - "type":"User", - "url":"https://api.github.com/users/raulcd" - } - } \ No newline at end of file diff --git a/dev/archery/archery/tests/test_bot.py b/dev/archery/archery/tests/test_bot.py index 21ba38064be69..17f6633ca5d5e 100644 --- a/dev/archery/archery/tests/test_bot.py +++ b/dev/archery/archery/tests/test_bot.py @@ -22,7 +22,6 @@ import click import pytest -from responses import matchers import responses as rsps from archery.bot import ( @@ -349,8 +348,10 @@ def test_issue_comment_with_commands_bot_not_first(load_fixture, responses): @pytest.mark.parametrize(('fixture_name', 'expected_label'), [ - ('event-pull-request-opened.json', PullRequestState.committer_review.value), - ('event-pull-request-opened-non-committer.json', PullRequestState.review.value), + ('event-pull-request-target-opened-committer.json', + PullRequestState.committer_review.value), + ('event-pull-request-target-opened-non-committer.json', + PullRequestState.review.value), ]) def test_open_pull_request(load_fixture, responses, fixture_name, expected_label): responses.add( @@ -374,7 +375,7 @@ def test_open_pull_request(load_fixture, responses, fixture_name, expected_label ) payload = load_fixture(fixture_name) - bot = PullRequestWorkflowBot('pull_request', payload, token='') + bot = PullRequestWorkflowBot('pull_request_target', payload, token='') bot.handle() # Setting awaiting committer review or awaiting review label @@ -383,7 +384,8 @@ def test_open_pull_request(load_fixture, responses, fixture_name, expected_label @pytest.mark.parametrize(('fixture_name', 'expected_label'), [ - ('event-pull-request-opened.json', PullRequestState.committer_review.value), + ('event-pull-request-target-opened-committer.json', + PullRequestState.committer_review.value), ]) def test_open_pull_request_with_existing_label( load_fixture, responses, fixture_name, expected_label): @@ -414,7 +416,7 @@ def test_open_pull_request_with_existing_label( payload = load_fixture(fixture_name) payload['pull_request']['labels'] = ['awaiting review'] - bot = PullRequestWorkflowBot('pull_request', payload, token='') + bot = PullRequestWorkflowBot('pull_request_target', payload, token='') bot.handle() post = responses.calls[-1] @@ -540,22 +542,10 @@ def test_pull_request_non_committer_review_awaiting_change_review( assert len(responses.calls) == 2 -def test_push_event_on_awaiting_changes( +def test_pull_request_synchronize_event_on_awaiting_changes( load_fixture, responses): - payload = load_fixture('event-push.json') - sha = '27313fc220561ef6b0d5edb485b29684b405c80b' - qualifiers = {'qualifiers': {'type': 'pr', 'repo': 'ursa-labs/ursabot', 'sha': sha}} - url_parameters = " ".join( - [f"{qualifier}:{value}" for qualifier, value in qualifiers.items()] - ) + payload = load_fixture('event-pull-request-target-synchronize.json') - responses.add( - responses.GET, - github_url('/search/issues'), - match=[matchers.query_string_matcher("q=" + url_parameters)], - json=load_fixture('commit-search.json'), - status=200 - ) responses.add( responses.GET, github_url('/repositories/169101701/pulls/26'), @@ -582,29 +572,17 @@ def test_push_event_on_awaiting_changes( status=201 ) - bot = PullRequestWorkflowBot('push', payload, token='') + bot = PullRequestWorkflowBot('pull_request_target', payload, token='') bot.handle() # after push event label changes. post = responses.calls[-1] assert json.loads(post.request.body) == ["awaiting change review"] -def test_push_event_on_awaiting_review( +def test_pull_request_synchronize_event_on_awaiting_review( load_fixture, responses): - payload = load_fixture('event-push.json') - sha = '27313fc220561ef6b0d5edb485b29684b405c80b' - qualifiers = {'qualifiers': {'type': 'pr', 'repo': 'ursa-labs/ursabot', 'sha': sha}} - url_parameters = " ".join( - [f"{qualifier}:{value}" for qualifier, value in qualifiers.items()] - ) + payload = load_fixture('event-pull-request-target-synchronize.json') - responses.add( - responses.GET, - github_url('/search/issues'), - match=[matchers.query_string_matcher("q=" + url_parameters)], - json=load_fixture('commit-search.json'), - status=200 - ) responses.add( responses.GET, github_url('/repositories/169101701/pulls/26'), @@ -618,28 +596,16 @@ def test_push_event_on_awaiting_review( status=200 ) - bot = PullRequestWorkflowBot('push', payload, token='') + bot = PullRequestWorkflowBot('pull_request_target', payload, token='') bot.handle() # No requests to delete or post new labels on push awaiting review - assert len(responses.calls) == 3 + assert len(responses.calls) == 2 -def test_push_event_on_existing_pr_without_state( +def test_pull_request_synchronize_event_on_existing_pr_without_state( load_fixture, responses): - payload = load_fixture('event-push.json') - sha = '27313fc220561ef6b0d5edb485b29684b405c80b' - qualifiers = {'qualifiers': {'type': 'pr', 'repo': 'ursa-labs/ursabot', 'sha': sha}} - url_parameters = " ".join( - [f"{qualifier}:{value}" for qualifier, value in qualifiers.items()] - ) + payload = load_fixture('event-pull-request-target-synchronize.json') - responses.add( - responses.GET, - github_url('/search/issues'), - match=[matchers.query_string_matcher("q=" + url_parameters)], - json=load_fixture('commit-search.json'), - status=200 - ) responses.add( responses.GET, github_url('/repositories/169101701/pulls/26'), @@ -660,7 +626,7 @@ def test_push_event_on_existing_pr_without_state( status=201 ) - bot = PullRequestWorkflowBot('push', payload, token='') + bot = PullRequestWorkflowBot('pull_request_target', payload, token='') bot.handle() # after push event label get set to default post = responses.calls[-1] From 7555d6f331245c2cde4c289798c615beb9f57c77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Wed, 22 Feb 2023 13:01:05 +0100 Subject: [PATCH 13/16] Add workflow_run from PR review to be able to add labels --- .github/workflows/pr_bot.yml | 48 +++++++++++++++++++++---- .github/workflows/pr_review_trigger.yml | 32 +++++++++++++++++ dev/archery/archery/bot.py | 1 - 3 files changed, 74 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/pr_review_trigger.yml diff --git a/.github/workflows/pr_bot.yml b/.github/workflows/pr_bot.yml index 704a8ea05d994..4b1eb3070c7c4 100644 --- a/.github/workflows/pr_bot.yml +++ b/.github/workflows/pr_bot.yml @@ -23,9 +23,9 @@ on: - converted_to_draft - ready_for_review - synchronize - pull_request_review: - types: - - submitted + workflow_run: + workflows: ["Label when reviewed"] + types: ['completed'] permissions: contents: read @@ -52,11 +52,47 @@ jobs: python-version: 3.8 - name: Install Archery and Crossbow dependencies run: pip install -e arrow/dev/archery[bot] + - name: 'Download PR review payload' + id: 'download' + if: github.event_name == 'workflow_run' + uses: actions/github-script@v6 + with: + script: | + const run_id = "${{ github.event.workflow_run.id }}"; + let artifacts = await github.rest.actions.listWorkflowRunArtifacts({ + owner: context.repo.owner, + repo: context.repo.repo, + run_id: run_id, + }); + let pr_review_artifact = artifacts.data.artifacts.filter((artifact) => { + return artifact.name == "pr_review_payload" + })[0]; + let pr_review_download = await github.rest.actions.downloadArtifact({ + owner: context.repo.owner, + repo: context.repo.repo, + artifact_id: pr_review_artifact.id, + archive_format: 'zip', + }); + var fs = require('fs'); + fs.writeFileSync('${{github.workspace}}/pr_review.zip', Buffer.from(pr_review_download.data)); + - name: Extract artifact + id: extract + if: github.event_name == 'workflow_run' + run: | + unzip pr_review.zip + echo "pr_review_path=$(pwd)/event.json" >> $GITHUB_OUTPUT - name: Handle PR workflow event env: ARROW_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} CROSSBOW_GITHUB_TOKEN: ${{ secrets.CROSSBOW_GITHUB_TOKEN }} run: | - archery trigger-bot \ - --event-name ${{ github.event_name }} \ - --event-payload ${{ github.event_path }} + if ${{ github.event_name == 'workflow_run' }}; then + # workflow_run is executed on PR review. Update to original event. + archery trigger-bot \ + --event-name "pull_request_review" \ + --event-payload ${{ steps.extract.outputs.pr_review_path }} + else + archery trigger-bot \ + --event-name ${{ github.event_name }} \ + --event-payload ${{ github.event_path }} + fi diff --git a/.github/workflows/pr_review_trigger.yml b/.github/workflows/pr_review_trigger.yml new file mode 100644 index 0000000000000..a1819a75497f1 --- /dev/null +++ b/.github/workflows/pr_review_trigger.yml @@ -0,0 +1,32 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +name: "Label when reviewed" +on: pull_request_review + +jobs: + # due to GitHub actions permissions we can't change labels on the pull_request_review + # workflow. We trigger a new workflow run which will have permissions to add labels. + label-when-reviewed: + name: "Label PRs when reviewed" + runs-on: ubuntu-latest + steps: + - name: "Upload PR review Payload" + uses: actions/upload-artifact@v3 + with: + path: "${{ github.event_path }}" + name: "pr_review_payload" diff --git a/dev/archery/archery/bot.py b/dev/archery/archery/bot.py index c31f3f15ee7fd..7571970757e08 100644 --- a/dev/archery/archery/bot.py +++ b/dev/archery/archery/bot.py @@ -123,7 +123,6 @@ def repo(self): return self.github.get_repo(self.event_payload['repository']['id'], lazy=True) def handle(self): - print(f"event_name: {self.event_name} - event_payload: {self.event_payload}") current_state = None try: current_state = self.get_current_state() From 08f961e67faf3f3c88a3e53e7ee1042dcd1a0675 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Wed, 22 Feb 2023 13:05:56 +0100 Subject: [PATCH 14/16] Remove unnecessary fixture and fix review comment --- .github/workflows/pr_bot.yml | 1 - .../archery/tests/fixtures/commit-search.json | 80 ------------------- 2 files changed, 81 deletions(-) delete mode 100644 dev/archery/archery/tests/fixtures/commit-search.json diff --git a/.github/workflows/pr_bot.yml b/.github/workflows/pr_bot.yml index 4b1eb3070c7c4..74175b16340cb 100644 --- a/.github/workflows/pr_bot.yml +++ b/.github/workflows/pr_bot.yml @@ -84,7 +84,6 @@ jobs: - name: Handle PR workflow event env: ARROW_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - CROSSBOW_GITHUB_TOKEN: ${{ secrets.CROSSBOW_GITHUB_TOKEN }} run: | if ${{ github.event_name == 'workflow_run' }}; then # workflow_run is executed on PR review. Update to original event. diff --git a/dev/archery/archery/tests/fixtures/commit-search.json b/dev/archery/archery/tests/fixtures/commit-search.json deleted file mode 100644 index c3da9aa0c4d37..0000000000000 --- a/dev/archery/archery/tests/fixtures/commit-search.json +++ /dev/null @@ -1,80 +0,0 @@ -{ - "total_count": 1, - "incomplete_results": false, - "items": [ - { - "url": "https://api.github.com/repos/ursa-labs/ursabot/issues/26", - "repository_url": "https://api.github.com/repos/ursa-labs/ursabot", - "labels_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/26/labels{/name}", - "comments_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/26/comments", - "events_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/26/events", - "html_url": "https://github.com/ursa-labs/ursabot/pull/26", - "id": 1572348024, - "node_id": "PR_kwDOHHgT285JU-KQ", - "number": 26, - "title": "Pr workflow automation poc", - "user": { - "login": "raulcd", - "id": 639755, - "node_id": "MDQ6VXNlcjYzOTc1NQ==", - "avatar_url": "https://avatars.githubusercontent.com/u/639755?v=4", - "gravatar_id": "", - "url": "https://api.github.com/users/raulcd", - "html_url": "https://github.com/raulcd", - "followers_url": "https://api.github.com/users/raulcd/followers", - "following_url": "https://api.github.com/users/raulcd/following{/other_user}", - "gists_url": "https://api.github.com/users/raulcd/gists{/gist_id}", - "starred_url": "https://api.github.com/users/raulcd/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/raulcd/subscriptions", - "organizations_url": "https://api.github.com/users/raulcd/orgs", - "repos_url": "https://api.github.com/users/raulcd/repos", - "events_url": "https://api.github.com/users/raulcd/events{/privacy}", - "received_events_url": "https://api.github.com/users/raulcd/received_events", - "type": "User", - "site_admin": false - }, - "labels": [ - - ], - "state": "open", - "locked": false, - "assignee": null, - "assignees": [ - - ], - "milestone": null, - "comments": 1, - "created_at": "2023-02-06T10:56:32Z", - "updated_at": "2023-02-10T11:30:31Z", - "closed_at": null, - "author_association": "OWNER", - "active_lock_reason": null, - "draft": true, - "pull_request": { - "url": "https://api.github.com/repos/ursa-labs/ursabot/pulls/26", - "html_url": "https://github.com/ursa-labs/ursabot/pull/26", - "diff_url": "https://github.com/ursa-labs/ursabot/pull/26.diff", - "patch_url": "https://github.com/ursa-labs/ursabot/pull/26.patch", - "merged_at": null - }, - "body": "\r\n\r\n### Rationale for this change\r\n\r\n\r\n\r\n### What changes are included in this PR?\r\n\r\n\r\n\r\n### Are these changes tested?\r\n\r\n\r\n\r\n### Are there any user-facing changes?\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n", - "reactions": { - "url": "https://api.github.com/repos/ursa-labs/ursabot/issues/26/reactions", - "total_count": 0, - "+1": 0, - "-1": 0, - "laugh": 0, - "hooray": 0, - "confused": 0, - "heart": 0, - "rocket": 0, - "eyes": 0 - }, - "timeline_url": "https://api.github.com/repos/ursa-labs/ursabot/issues/26/timeline", - "performed_via_github_app": null, - "state_reason": null, - "score": 1.0 - } - ] - } - \ No newline at end of file From a2bf37d900130d85d4d361ec8ec1970c278ed5a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Wed, 22 Feb 2023 13:07:21 +0100 Subject: [PATCH 15/16] Update ref in workflow to main instead of master --- .github/workflows/pr_bot.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr_bot.yml b/.github/workflows/pr_bot.yml index 74175b16340cb..4a09f214906c9 100644 --- a/.github/workflows/pr_bot.yml +++ b/.github/workflows/pr_bot.yml @@ -42,7 +42,7 @@ jobs: with: path: arrow repository: apache/arrow - ref: master + ref: main persist-credentials: false # fetch the tags for version number generation fetch-depth: 0 From 2b4d62e1e6202aa81ae82601c467507326c1490f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Mon, 27 Feb 2023 12:16:03 +0100 Subject: [PATCH 16/16] Several review comments --- .github/workflows/pr_bot.yml | 38 ++++++++++++------------- .github/workflows/pr_review_trigger.yml | 2 +- dev/archery/archery/bot.py | 31 ++++++++++---------- 3 files changed, 36 insertions(+), 35 deletions(-) diff --git a/.github/workflows/pr_bot.yml b/.github/workflows/pr_bot.yml index 4a09f214906c9..d9a3d10e6b359 100644 --- a/.github/workflows/pr_bot.yml +++ b/.github/workflows/pr_bot.yml @@ -37,21 +37,6 @@ jobs: name: "PR Workflow bot" runs-on: ubuntu-latest steps: - - name: Checkout Arrow - uses: actions/checkout@v3 - with: - path: arrow - repository: apache/arrow - ref: main - persist-credentials: false - # fetch the tags for version number generation - fetch-depth: 0 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: 3.8 - - name: Install Archery and Crossbow dependencies - run: pip install -e arrow/dev/archery[bot] - name: 'Download PR review payload' id: 'download' if: github.event_name == 'workflow_run' @@ -81,17 +66,32 @@ jobs: run: | unzip pr_review.zip echo "pr_review_path=$(pwd)/event.json" >> $GITHUB_OUTPUT + - name: Checkout Arrow + uses: actions/checkout@v3 + with: + path: arrow + repository: apache/arrow + ref: main + persist-credentials: false + # fetch the tags for version number generation + fetch-depth: 0 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: 3.8 + - name: Install Archery and Crossbow dependencies + run: pip install -e arrow/dev/archery[bot] - name: Handle PR workflow event env: ARROW_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - if ${{ github.event_name == 'workflow_run' }}; then + if [ "${GITHUB_EVENT_NAME}" = "workflow_run" ]; then # workflow_run is executed on PR review. Update to original event. archery trigger-bot \ --event-name "pull_request_review" \ - --event-payload ${{ steps.extract.outputs.pr_review_path }} + --event-payload "${{ steps.extract.outputs.pr_review_path }}" else archery trigger-bot \ - --event-name ${{ github.event_name }} \ - --event-payload ${{ github.event_path }} + --event-name "${{ github.event_name }}" \ + --event-payload "${{ github.event_path }}" fi diff --git a/.github/workflows/pr_review_trigger.yml b/.github/workflows/pr_review_trigger.yml index a1819a75497f1..e765de184d4f6 100644 --- a/.github/workflows/pr_review_trigger.yml +++ b/.github/workflows/pr_review_trigger.yml @@ -19,7 +19,7 @@ name: "Label when reviewed" on: pull_request_review jobs: - # due to GitHub actions permissions we can't change labels on the pull_request_review + # due to GitHub Actions permissions we can't change labels on the pull_request_review # workflow. We trigger a new workflow run which will have permissions to add labels. label-when-reviewed: name: "Label PRs when reviewed" diff --git a/dev/archery/archery/bot.py b/dev/archery/archery/bot.py index 7571970757e08..3e394b982aa7e 100644 --- a/dev/archery/archery/bot.py +++ b/dev/archery/archery/bot.py @@ -130,15 +130,15 @@ def handle(self): # In case of error (more than one state) we clear state labels # only possible if a label has been manually added. self.clear_current_state() - new_state = self.get_target_state(current_state) - if current_state != new_state.value: + next_state = self.compute_next_state(current_state) + if not current_state or current_state != next_state: if current_state: self.clear_current_state() - self.set_state(new_state) + self.set_state(next_state) def get_current_state(self): """ - Returns a string with the current PR state label + Returns a PullRequestState with the current PR state label based on label starting with LABEL_PREFIX. If more than one label is found raises EventError. If no label is found returns None. @@ -148,7 +148,7 @@ def get_current_state(self): if len(states) > 1: raise EventError(f"PR cannot be on more than one states - {states}") elif states: - return states[0] + return PullRequestState(states[0]) def clear_current_state(self): """ @@ -158,9 +158,9 @@ def clear_current_state(self): if label.name.startswith(LABEL_PREFIX): self.pull.remove_from_labels(label) - def get_target_state(self, current_state): + def compute_next_state(self, current_state): """ - Returns the expected target state based on the event and + Returns the expected next state based on the event and the current state. """ if (self.event_name == "pull_request_target" and @@ -177,25 +177,26 @@ def get_target_state(self, current_state): in COMMITTER_ROLES) if not is_committer_review: # Non-committer reviews cannot change state once committer has already - # reviewed and requested changes. + # reviewed, requested changes or approved if current_state in ( - PullRequestState.change_review.value, - PullRequestState.changes.value): - return PullRequestState(current_state) + PullRequestState.change_review, + PullRequestState.changes, + PullRequestState.merge): + return current_state else: return PullRequestState.committer_review if review_state == 'approved': return PullRequestState.merge - elif review_state in ("changes_requested", "commented"): + else: return PullRequestState.changes elif (self.event_name == "pull_request_target" and self.event_payload['action'] == 'synchronize' and - current_state == PullRequestState.changes.value): + current_state == PullRequestState.changes): return PullRequestState.change_review # Default already opened PRs to Review state. if current_state is None: - current_state = PullRequestState.review.value - return PullRequestState(current_state) + current_state = PullRequestState.review + return current_state def set_state(self, state): """Sets the State label to the PR."""