├── .drone.yml.bak ├── .github_changelog_generator ├── .gitignore ├── .golangci.json ├── BUILDING ├── CHANGELOG.md ├── COPYRIGHT ├── HISTORY.md ├── LICENSE ├── README.md ├── go.mod ├── go.sum └── scm ├── client.go ├── client_test.go ├── const.go ├── content.go ├── driver ├── azure │ ├── azure.go │ ├── azure_test.go │ ├── content.go │ ├── content_test.go │ ├── git.go │ ├── git_test.go │ ├── integration │ │ ├── content_test.go │ │ ├── git_test.go │ │ ├── integration.go │ │ ├── pr_test.go │ │ └── repo_test.go │ ├── issue.go │ ├── linker.go │ ├── org.go │ ├── pr.go │ ├── pr_test.go │ ├── repo.go │ ├── repo_test.go │ ├── review.go │ ├── testdata │ │ ├── branch_create.json │ │ ├── branches.json │ │ ├── branches.json.golden │ │ ├── branches_filter.json │ │ ├── branches_filter.json.golden │ │ ├── commit.json │ │ ├── commit.json.golden │ │ ├── commits.json │ │ ├── commits.json.golden │ │ ├── compare.json │ │ ├── compare.json.golden │ │ ├── content.json │ │ ├── content.json.golden │ │ ├── content_create.json │ │ ├── content_delete.json │ │ ├── content_list.json │ │ ├── content_list.json.golden │ │ ├── content_update.json │ │ ├── hook.json │ │ ├── hook.json.golden │ │ ├── hooks.json │ │ ├── hooks.json.golden │ │ ├── pr.json │ │ ├── pr.json.golden │ │ ├── projects.json │ │ ├── repo.json │ │ ├── repo.json.golden │ │ ├── repos.json │ │ ├── repos.json.golden │ │ └── webhooks │ │ │ ├── issue_comment.json │ │ │ ├── issue_comment.json.golden │ │ │ ├── issue_comment_delete.json │ │ │ ├── issue_comment_delete.json.golden │ │ │ ├── issue_comment_edit.json │ │ │ ├── issue_comment_edit.json.golden │ │ │ ├── pr_created.json │ │ │ ├── pr_created.json.golden │ │ │ ├── pr_merged.json │ │ │ ├── pr_merged.json.golden │ │ │ ├── pr_updated.json │ │ │ ├── pr_updated.json.golden │ │ │ ├── push.json │ │ │ └── push.json.golden │ ├── user.go │ ├── util.go │ ├── webhook.go │ └── webhook_test.go ├── bitbucket │ ├── bitbucket.go │ ├── bitbucket_test.go │ ├── content.go │ ├── content_test.go │ ├── git.go │ ├── git_test.go │ ├── integration │ │ ├── integration.go │ │ └── integration_test.go │ ├── issue.go │ ├── issue_test.go │ ├── linker.go │ ├── linker_test.go │ ├── milestone.go │ ├── org.go │ ├── org_test.go │ ├── pr.go │ ├── pr_test.go │ ├── release.go │ ├── repo.go │ ├── repo_test.go │ ├── review.go │ ├── review_test.go │ ├── testdata │ │ ├── branch.json │ │ ├── branch.json.golden │ │ ├── branch_create.json │ │ ├── branches.json │ │ ├── branches.json.golden │ │ ├── branches_filter.json │ │ ├── branches_filter.json.golden │ │ ├── commit.json │ │ ├── commit.json.golden │ │ ├── commits.json │ │ ├── commits.json.golden │ │ ├── content.json │ │ ├── content.json.fail │ │ ├── content.json.golden │ │ ├── content.txt │ │ ├── content_fail.json │ │ ├── content_list.json │ │ ├── content_list.json.golden │ │ ├── content_update.json.fail │ │ ├── diffstat.json │ │ ├── diffstat.json.golden │ │ ├── error.json │ │ ├── hook.json │ │ ├── hook.json.golden │ │ ├── hooks.json │ │ ├── hooks.json.golden │ │ ├── perms.json │ │ ├── perms.json.golden │ │ ├── pr.json │ │ ├── pr.json.golden │ │ ├── pr_diffstat.json │ │ ├── pr_diffstat.json.golden │ │ ├── prcomment.json │ │ ├── prcomment.json.golden │ │ ├── prs.json │ │ ├── prs.json.golden │ │ ├── repo.json │ │ ├── repo.json.golden │ │ ├── repos-2.json │ │ ├── repos.json │ │ ├── repos.json.golden │ │ ├── repos_filter.json │ │ ├── repos_filter.json.golden │ │ ├── status.json │ │ ├── status.json.golden │ │ ├── statuses.json │ │ ├── statuses.json.golden │ │ ├── tag.json │ │ ├── tag.json.golden │ │ ├── tags.json │ │ ├── tags.json.golden │ │ ├── team.json │ │ ├── team.json.golden │ │ ├── teams.json │ │ ├── teams.json.golden │ │ ├── user.json │ │ ├── user.json.golden │ │ ├── userEmail.json │ │ └── webhooks │ │ │ ├── pipeline_hook_created.json │ │ │ ├── pipeline_hook_created.json.golden │ │ │ ├── pipeline_hook_update.json │ │ │ ├── pipeline_hook_update.json.golden │ │ │ ├── pr_comment_created.json │ │ │ ├── pr_comment_created.json.golden │ │ │ ├── pr_comment_deleted.json │ │ │ ├── pr_comment_deleted.json.golden │ │ │ ├── pr_created.json │ │ │ ├── pr_created.json.golden │ │ │ ├── pr_declined.json │ │ │ ├── pr_declined.json.golden │ │ │ ├── pr_fulfilled.json │ │ │ ├── pr_fulfilled.json.golden │ │ │ ├── pr_updated.json │ │ │ ├── pr_updated.json.golden │ │ │ ├── push.json │ │ │ ├── push.json.golden │ │ │ ├── push_branch_create.json │ │ │ ├── push_branch_create.json.golden │ │ │ ├── push_branch_delete.json │ │ │ ├── push_branch_delete.json.golden │ │ │ ├── push_tag_create.json │ │ │ ├── push_tag_create.json.golden │ │ │ ├── push_tag_delete.json │ │ │ └── push_tag_delete.json.golden │ ├── user.go │ ├── user_test.go │ ├── util.go │ ├── util_test.go │ ├── webhook.go │ └── webhook_test.go ├── gitea │ ├── content.go │ ├── content_test.go │ ├── git.go │ ├── git_test.go │ ├── gitea.go │ ├── gitea_test.go │ ├── issue.go │ ├── issue_test.go │ ├── linker.go │ ├── linker_test.go │ ├── milestone.go │ ├── milestone_test.go │ ├── org.go │ ├── org_test.go │ ├── pr.go │ ├── pr_test.go │ ├── release.go │ ├── release_test.go │ ├── repo.go │ ├── repo_test.go │ ├── review.go │ ├── review_test.go │ ├── testdata │ │ ├── branch.json │ │ ├── branch.json.golden │ │ ├── branches.json │ │ ├── branches.json.golden │ │ ├── comment.json │ │ ├── comment.json.golden │ │ ├── comments.json │ │ ├── comments.json.golden │ │ ├── commit.json │ │ ├── commit.json.golden │ │ ├── commits.json │ │ ├── commits.json.golden │ │ ├── content_list.json │ │ ├── content_list.json.golden │ │ ├── hook.json │ │ ├── hook.json.golden │ │ ├── hooks.json │ │ ├── hooks.json.golden │ │ ├── issue.json │ │ ├── issue.json.golden │ │ ├── issues.json │ │ ├── issues.json.golden │ │ ├── membership.json.golden │ │ ├── milestone.json │ │ ├── milestone.json.golden │ │ ├── milestone_create.json │ │ ├── milestones.json │ │ ├── milestones.json.golden │ │ ├── organization.json │ │ ├── organization.json.golden │ │ ├── organizations.json │ │ ├── organizations.json.golden │ │ ├── permissions.json │ │ ├── pr.json │ │ ├── pr.json.golden │ │ ├── prs.json │ │ ├── prs.json.golden │ │ ├── release.json │ │ ├── release.json.golden │ │ ├── release_create.json │ │ ├── release_update.json │ │ ├── releases.json │ │ ├── releases.json.golden │ │ ├── repo.json │ │ ├── repo.json.golden │ │ ├── repos.json │ │ ├── repos.json.golden │ │ ├── status.json │ │ ├── status.json.golden │ │ ├── statuses.json │ │ ├── statuses.json.golden │ │ ├── tag.json │ │ ├── tag.json.golden │ │ ├── tags.json │ │ ├── tags.json.golden │ │ ├── user.json │ │ ├── user.json.golden │ │ └── webhooks │ │ │ ├── branch_create.json │ │ │ ├── branch_create.json.golden │ │ │ ├── branch_delete.json │ │ │ ├── branch_delete.json.golden │ │ │ ├── issue_comment_created.json │ │ │ ├── issue_comment_created.json.golden │ │ │ ├── issue_comment_deleted.json │ │ │ ├── issue_comment_edited.json │ │ │ ├── issues_closed.json │ │ │ ├── issues_opened.json │ │ │ ├── issues_opened.json.golden │ │ │ ├── pull_request_closed.json │ │ │ ├── pull_request_closed.json.golden │ │ │ ├── pull_request_comment_created.json │ │ │ ├── pull_request_comment_created.json.golden │ │ │ ├── pull_request_comment_deleted.json │ │ │ ├── pull_request_comment_edited.json │ │ │ ├── pull_request_edited.json │ │ │ ├── pull_request_edited.json.golden │ │ │ ├── pull_request_merged.json │ │ │ ├── pull_request_merged.json.golden │ │ │ ├── pull_request_opened.json │ │ │ ├── pull_request_opened.json.golden │ │ │ ├── pull_request_reopened.json │ │ │ ├── pull_request_reopened.json.golden │ │ │ ├── pull_request_synchronized.json │ │ │ ├── pull_request_synchronized.json.golden │ │ │ ├── push.json │ │ │ ├── push.json.golden │ │ │ ├── tag_create.json │ │ │ ├── tag_create.json.golden │ │ │ ├── tag_delete.json │ │ │ └── tag_delete.json.golden │ ├── user.go │ ├── user_test.go │ ├── util.go │ ├── util_test.go │ ├── webhook.go │ └── webhook_test.go ├── gitee │ ├── content.go │ ├── content_test.go │ ├── git.go │ ├── git_test.go │ ├── gitee.go │ ├── gitee_test.go │ ├── integration │ │ ├── content_test.go │ │ ├── git_test.go │ │ ├── gitee_test.go │ │ ├── integration.go │ │ ├── issue_test.go │ │ ├── org_test.go │ │ ├── pr_test.go │ │ ├── repo_test.go │ │ └── user_test.go │ ├── issue.go │ ├── issue_test.go │ ├── linker.go │ ├── linker_test.go │ ├── org.go │ ├── org_test.go │ ├── pr.go │ ├── pr_test.go │ ├── repo.go │ ├── repo_test.go │ ├── review.go │ ├── review_test.go │ ├── testdata │ │ ├── branch.json │ │ ├── branch.json.golden │ │ ├── branches.json │ │ ├── branches.json.golden │ │ ├── changes.json │ │ ├── changes.json.golden │ │ ├── commit.json │ │ ├── commit.json.golden │ │ ├── commits.json │ │ ├── commits.json.golden │ │ ├── compare.json │ │ ├── compare.json.golden │ │ ├── content.json │ │ ├── content.json.golden │ │ ├── content_create.json │ │ ├── content_delete.json │ │ ├── content_list.json │ │ ├── content_list.json.golden │ │ ├── content_update.json │ │ ├── error.json │ │ ├── hook.json │ │ ├── hook.json.golden │ │ ├── hooks.json │ │ ├── hooks.json.golden │ │ ├── issue.json │ │ ├── issue.json.golden │ │ ├── issue_comment.json │ │ ├── issue_comment.json.golden │ │ ├── issue_comments.json │ │ ├── issue_comments.json.golden │ │ ├── issues.json │ │ ├── issues.json.golden │ │ ├── membership.json │ │ ├── membership.json.golden │ │ ├── org.json │ │ ├── org.json.golden │ │ ├── orgs.json │ │ ├── orgs.json.golden │ │ ├── pr.json │ │ ├── pr.json.golden │ │ ├── pr_comment.json │ │ ├── pr_comment.json.golden │ │ ├── pr_comments.json │ │ ├── pr_comments.json.golden │ │ ├── pr_commits.json │ │ ├── pr_commits.json.golden │ │ ├── pr_files.json │ │ ├── pr_files.json.golden │ │ ├── pulls.json │ │ ├── pulls.json.golden │ │ ├── repo.json │ │ ├── repo.json.golden │ │ ├── repos.json │ │ ├── repos.json.golden │ │ ├── tag.json │ │ ├── tag.json.golden │ │ ├── tags.json │ │ ├── tags.json.golden │ │ ├── user.json │ │ ├── user.json.golden │ │ └── webhooks │ │ │ ├── issue_hook_assign.json │ │ │ ├── issue_hook_assign.json.golden │ │ │ ├── issue_hook_delete.json │ │ │ ├── issue_hook_delete.json.golden │ │ │ ├── issue_hook_open.json │ │ │ ├── issue_hook_open.json.golden │ │ │ ├── issue_hook_state_change.json │ │ │ ├── issue_hook_state_change.json.golden │ │ │ ├── note_hook_issue_comment.json │ │ │ ├── note_hook_issue_comment.json.golden │ │ │ ├── note_hook_pr_comment.json │ │ │ ├── note_hook_pr_comment.json.golden │ │ │ ├── pr_close.json │ │ │ ├── pr_close.json.golden │ │ │ ├── pr_labeled.json │ │ │ ├── pr_labeled.json.golden │ │ │ ├── pr_merge.json │ │ │ ├── pr_merge.json.golden │ │ │ ├── pr_open.json │ │ │ ├── pr_open.json.golden │ │ │ ├── pr_unlabeled.json │ │ │ ├── pr_unlabeled.json.golden │ │ │ ├── pr_update.json │ │ │ ├── pr_update.json.golden │ │ │ ├── push.json │ │ │ ├── push.json.golden │ │ │ ├── push_branch_create.json │ │ │ ├── push_branch_create.json.golden │ │ │ ├── push_branch_delete.json │ │ │ ├── push_branch_delete.json.golden │ │ │ ├── tag_create.json │ │ │ ├── tag_create.json.golden │ │ │ ├── tag_delete.json │ │ │ └── tag_delete.json.golden │ ├── user.go │ ├── user_test.go │ ├── util.go │ ├── util_test.go │ ├── webhook.go │ └── webhook_test.go ├── github │ ├── content.go │ ├── content_test.go │ ├── git.go │ ├── git_test.go │ ├── github.go │ ├── github_test.go │ ├── integration │ │ ├── content_test.go │ │ ├── git_test.go │ │ ├── github_test.go │ │ ├── integration.go │ │ ├── issue_test.go │ │ ├── org_test.go │ │ ├── pr_test.go │ │ ├── repo_test.go │ │ └── user_test.go │ ├── issue.go │ ├── issue_test.go │ ├── linker.go │ ├── linker_test.go │ ├── milestone.go │ ├── milestone_test.go │ ├── org.go │ ├── org_test.go │ ├── pr.go │ ├── pr_test.go │ ├── release.go │ ├── release_test.go │ ├── repo.go │ ├── repo_test.go │ ├── review.go │ ├── review_test.go │ ├── testdata │ │ ├── branch.json │ │ ├── branch.json.golden │ │ ├── branch_create.json │ │ ├── branches.json │ │ ├── branches.json.golden │ │ ├── changes.json │ │ ├── changes.json.golden │ │ ├── commit.json │ │ ├── commit.json.golden │ │ ├── commits.json │ │ ├── commits.json.golden │ │ ├── compare.json │ │ ├── compare.json.golden │ │ ├── content.json │ │ ├── content.json.golden │ │ ├── content_create.json │ │ ├── content_delete.json │ │ ├── content_list.json │ │ ├── content_list.json.golden │ │ ├── content_update.json │ │ ├── content_update.json.fail │ │ ├── deployment.json │ │ ├── deployment.json.golden │ │ ├── emails.json │ │ ├── emails.json.golden │ │ ├── error.json │ │ ├── github_app_repos.json │ │ ├── hook.json │ │ ├── hook.json.golden │ │ ├── hooks.json │ │ ├── hooks.json.golden │ │ ├── issue.json │ │ ├── issue.json.golden │ │ ├── issue_comment.json │ │ ├── issue_comment.json.golden │ │ ├── issue_comments.json │ │ ├── issue_comments.json.golden │ │ ├── issues.json │ │ ├── issues.json.golden │ │ ├── membership.json │ │ ├── membership.json.golden │ │ ├── milestone.json │ │ ├── milestone.json.golden │ │ ├── milestone_create.json │ │ ├── milestones.json │ │ ├── milestones.json.golden │ │ ├── org.json │ │ ├── org.json.golden │ │ ├── orgs.json │ │ ├── orgs.json.golden │ │ ├── pr.json │ │ ├── pr.json.golden │ │ ├── pr_comment.json │ │ ├── pr_comment.json.golden │ │ ├── pr_comments.json │ │ ├── pr_comments.json.golden │ │ ├── pr_files.json │ │ ├── pr_files.json.golden │ │ ├── pulls.json │ │ ├── pulls.json.golden │ │ ├── release.json │ │ ├── release.json.golden │ │ ├── releases.json │ │ ├── releases.json.golden │ │ ├── repo.json │ │ ├── repo.json.golden │ │ ├── repos.json │ │ ├── repos.json.golden │ │ ├── reposWithNull.json │ │ ├── repos_filter.json │ │ ├── repos_filter.json.golden │ │ ├── status.json │ │ ├── status.json.golden │ │ ├── statuses.json │ │ ├── statuses.json.golden │ │ ├── tag.json │ │ ├── tag.json.golden │ │ ├── tags.json │ │ ├── tags.json.golden │ │ ├── user.json │ │ ├── user.json.golden │ │ └── webhooks │ │ │ ├── branch_create.json │ │ │ ├── branch_create.json.golden │ │ │ ├── branch_delete.json │ │ │ ├── branch_delete.json.golden │ │ │ ├── comment.json │ │ │ ├── comment.json.golden │ │ │ ├── deployment.json │ │ │ ├── deployment.json.golden │ │ │ ├── deployment_commit.json │ │ │ ├── deployment_commit.json.golden │ │ │ ├── pipeline_hook.json │ │ │ ├── pipeline_hook.json.golden │ │ │ ├── pr_closed.json │ │ │ ├── pr_closed.json.golden │ │ │ ├── pr_edited.json │ │ │ ├── pr_edited.json.golden │ │ │ ├── pr_labeled.json │ │ │ ├── pr_labeled.json.golden │ │ │ ├── pr_opened.json │ │ │ ├── pr_opened.json.golden │ │ │ ├── pr_ready_for_review.json │ │ │ ├── pr_ready_for_review.json.golden │ │ │ ├── pr_reopened.json │ │ │ ├── pr_reopened.json.golden │ │ │ ├── pr_sync.json │ │ │ ├── pr_sync.json.golden │ │ │ ├── pr_unlabeled.json │ │ │ ├── pr_unlabeled.json.golden │ │ │ ├── push.json │ │ │ ├── push.json.golden │ │ │ ├── push_branch_create.json │ │ │ ├── push_branch_create.json.golden │ │ │ ├── push_branch_delete.json │ │ │ ├── push_branch_delete.json.golden │ │ │ ├── push_tag.json │ │ │ ├── push_tag.json.golden │ │ │ ├── push_tag_delete.json │ │ │ ├── push_tag_delete.json.golden │ │ │ ├── release_created.json │ │ │ ├── release_created.json.golden │ │ │ ├── release_deleted.json │ │ │ ├── release_deleted.json.golden │ │ │ ├── release_edited.json │ │ │ ├── release_edited.json.golden │ │ │ ├── release_prereleased.json │ │ │ ├── release_prereleased.json.golden │ │ │ ├── release_published.json │ │ │ ├── release_published.json.golden │ │ │ ├── release_released.json │ │ │ ├── release_released.json.golden │ │ │ ├── release_unpublished.json │ │ │ ├── release_unpublished.json.golden │ │ │ ├── tag_create.json │ │ │ ├── tag_create.json.golden │ │ │ ├── tag_delete.json │ │ │ └── tag_delete.json.golden │ ├── user.go │ ├── user_test.go │ ├── util.go │ ├── util_test.go │ ├── webhook.go │ └── webhook_test.go ├── gitlab │ ├── content.go │ ├── content_test.go │ ├── git.go │ ├── git_test.go │ ├── gitlab.go │ ├── gitlab_test.go │ ├── integration │ │ ├── content_test.go │ │ ├── git_test.go │ │ ├── gitlab_test.go │ │ ├── integration.go │ │ ├── issue_test.go │ │ ├── org_test.go │ │ ├── pr_test.go │ │ ├── repo_test.go │ │ └── user_test.go │ ├── issue.go │ ├── issue_test.go │ ├── linker.go │ ├── linker_test.go │ ├── milestone.go │ ├── milestone_test.go │ ├── org.go │ ├── org_test.go │ ├── pr.go │ ├── pr_test.go │ ├── release.go │ ├── release_test.go │ ├── repo.go │ ├── repo_test.go │ ├── review.go │ ├── review_test.go │ ├── testdata │ │ ├── branch.json │ │ ├── branch.json.golden │ │ ├── branch_create.json │ │ ├── branches.json │ │ ├── branches.json.golden │ │ ├── branches_filter.json │ │ ├── branches_filter.json.golden │ │ ├── commit.json │ │ ├── commit.json.golden │ │ ├── commit_diff.json │ │ ├── commit_diff.json.golden │ │ ├── commits.json │ │ ├── commits.json.golden │ │ ├── compare.json │ │ ├── compare.json.golden │ │ ├── content.json │ │ ├── content.json.golden │ │ ├── content.rb │ │ ├── content_create.json │ │ ├── content_list.json │ │ ├── content_list.json.golden │ │ ├── content_update.json │ │ ├── content_update.json.fail │ │ ├── emails.json │ │ ├── emails.json.golden │ │ ├── group.json │ │ ├── group.json.golden │ │ ├── groups.json │ │ ├── groups.json.golden │ │ ├── hook.json │ │ ├── hook.json.golden │ │ ├── hook_skip_verification.json │ │ ├── hook_skip_verification.json.golden │ │ ├── hooks.json │ │ ├── hooks.json.golden │ │ ├── issue.json │ │ ├── issue.json.golden │ │ ├── issue_note.json │ │ ├── issue_note.json.golden │ │ ├── issue_notes.json │ │ ├── issue_notes.json.golden │ │ ├── issues.json │ │ ├── issues.json.golden │ │ ├── merge.json │ │ ├── merge.json.golden │ │ ├── merge_diff.json │ │ ├── merge_diff.json.golden │ │ ├── merge_note.json │ │ ├── merge_note.json.golden │ │ ├── merge_notes.json │ │ ├── merge_notes.json.golden │ │ ├── merges.json │ │ ├── merges.json.golden │ │ ├── milestone.json │ │ ├── milestone.json.golden │ │ ├── milestone_create.json │ │ ├── milestone_update.json │ │ ├── milestones.json │ │ ├── milestones.json.golden │ │ ├── release.json │ │ ├── release.json.golden │ │ ├── releases.json │ │ ├── releases.json.golden │ │ ├── repo.json │ │ ├── repo.json.golden │ │ ├── repos.json │ │ ├── repos.json.golden │ │ ├── repos_filter.json │ │ ├── repos_filter.json.golden │ │ ├── status.json │ │ ├── status.json.golden │ │ ├── statuses.json │ │ ├── statuses.json.golden │ │ ├── subgroup.json │ │ ├── subgroup.json.golden │ │ ├── tag.json │ │ ├── tag.json.golden │ │ ├── tags.json │ │ ├── tags.json.golden │ │ ├── user.json │ │ ├── user.json.golden │ │ ├── user_search.json │ │ ├── user_search.json.golden │ │ └── webhooks │ │ │ ├── branch_create.json │ │ │ ├── branch_create.json.golden │ │ │ ├── branch_delete.json │ │ │ ├── branch_delete.json.golden │ │ │ ├── issue_closed.json │ │ │ ├── issue_closed.json.golden │ │ │ ├── issue_comment_create.json │ │ │ ├── issue_comment_create.json.golden │ │ │ ├── issue_create.json │ │ │ ├── issue_create.json.golden │ │ │ ├── issue_edited.json │ │ │ ├── issue_edited.json.golden │ │ │ ├── issue_labeled.json │ │ │ ├── issue_labeled.json.golden │ │ │ ├── issue_reopen.json │ │ │ ├── issue_reopen.json.golden │ │ │ ├── merge_request_comment_create.json │ │ │ ├── merge_request_comment_create.json.golden │ │ │ ├── pipeline_hook.json │ │ │ ├── pipeline_hook.json.golden │ │ │ ├── pull_request_close.json │ │ │ ├── pull_request_close.json.golden │ │ │ ├── pull_request_create.json │ │ │ ├── pull_request_create.json.golden │ │ │ ├── pull_request_merge.json │ │ │ ├── pull_request_merge.json.golden │ │ │ ├── pull_request_reopen.json │ │ │ ├── pull_request_reopen.json.golden │ │ │ ├── pull_request_review_ready.json │ │ │ ├── pull_request_review_ready.json.golden │ │ │ ├── push.json │ │ │ ├── push.json.golden │ │ │ ├── push_merge.json │ │ │ ├── push_merge.json.golden │ │ │ ├── review_comment_create.json │ │ │ ├── review_comment_create.json.golden │ │ │ ├── tag_create.json │ │ │ ├── tag_create.json.golden │ │ │ ├── tag_delete.json │ │ │ └── tag_delete.json.golden │ ├── user.go │ ├── user_test.go │ ├── util.go │ ├── util_test.go │ ├── webhook.go │ └── webhook_test.go ├── gogs │ ├── content.go │ ├── content_test.go │ ├── git.go │ ├── git_test.go │ ├── gogs.go │ ├── gogs_test.go │ ├── issue.go │ ├── issue_test.go │ ├── linker.go │ ├── linker_test.go │ ├── milestone.go │ ├── org.go │ ├── org_test.go │ ├── pr.go │ ├── pr_test.go │ ├── release.go │ ├── repo.go │ ├── repo_test.go │ ├── review.go │ ├── review_test.go │ ├── testdata │ │ ├── branch.json │ │ ├── branch.json.golden │ │ ├── branches.json │ │ ├── branches.json.golden │ │ ├── comment.json │ │ ├── comment.json.golden │ │ ├── comments.json │ │ ├── comments.json.golden │ │ ├── commits.json │ │ ├── commits.json.golden │ │ ├── hook.json │ │ ├── hook.json.golden │ │ ├── hooks.json │ │ ├── hooks.json.golden │ │ ├── issue.json │ │ ├── issue.json.golden │ │ ├── issues.json │ │ ├── issues.json.golden │ │ ├── organization.json │ │ ├── organization.json.golden │ │ ├── organizations.json │ │ ├── organizations.json.golden │ │ ├── repo.json │ │ ├── repo.json.golden │ │ ├── repos.json │ │ ├── repos.json.golden │ │ ├── user.json │ │ ├── user.json.golden │ │ └── webhooks │ │ │ ├── branch_create.json │ │ │ ├── branch_create.json.golden │ │ │ ├── branch_delete.json │ │ │ ├── branch_delete.json.golden │ │ │ ├── issue_comment_created.json │ │ │ ├── issue_comment_created.json.golden │ │ │ ├── issue_comment_deleted.json │ │ │ ├── issue_comment_edited.json │ │ │ ├── issues_closed.json │ │ │ ├── issues_opened.json │ │ │ ├── issues_opened.json.golden │ │ │ ├── pull_request_closed.json │ │ │ ├── pull_request_closed.json.golden │ │ │ ├── pull_request_comment_created.json │ │ │ ├── pull_request_comment_created.json.golden │ │ │ ├── pull_request_comment_deleted.json │ │ │ ├── pull_request_comment_edited.json │ │ │ ├── pull_request_edited.json │ │ │ ├── pull_request_edited.json.golden │ │ │ ├── pull_request_opened.json │ │ │ ├── pull_request_opened.json.golden │ │ │ ├── pull_request_synchronized.json │ │ │ ├── pull_request_synchronized.json.golden │ │ │ ├── push.json │ │ │ ├── push.json.golden │ │ │ ├── tag_create.json │ │ │ ├── tag_create.json.golden │ │ │ ├── tag_delete.json │ │ │ └── tag_delete.json.golden │ ├── user.go │ ├── user_test.go │ ├── webhook.go │ └── webhook_test.go ├── harness │ ├── content.go │ ├── content_test.go │ ├── git.go │ ├── git_test.go │ ├── harness.go │ ├── harness_test.go │ ├── issue.go │ ├── issue_test.go │ ├── linker.go │ ├── linker_test.go │ ├── milestone.go │ ├── milestone_test.go │ ├── org.go │ ├── org_test.go │ ├── pr.go │ ├── pr_test.go │ ├── release.go │ ├── release_test.go │ ├── repo.go │ ├── repo_test.go │ ├── review.go │ ├── review_test.go │ ├── testdata │ │ ├── branch.json │ │ ├── branch.json.golden │ │ ├── branches.json │ │ ├── branches.json.golden │ │ ├── comment.json │ │ ├── comment.json.golden │ │ ├── commit.json │ │ ├── commit.json.golden │ │ ├── commits.json │ │ ├── commits.json.golden │ │ ├── content.json │ │ ├── content_list.json │ │ ├── content_list.json.golden │ │ ├── gitdiff.json │ │ ├── gitdiff.json.golden │ │ ├── hook.json │ │ ├── hook.json.golden │ │ ├── hook_create.json │ │ ├── hook_create.json.golden │ │ ├── hooks.json │ │ ├── hooks.json.golden │ │ ├── pr.json │ │ ├── pr.json.golden │ │ ├── pr_commits.json │ │ ├── pr_commits.json.golden │ │ ├── repo.json │ │ ├── repo.json.golden │ │ ├── repos.json │ │ ├── repos.json.golden │ │ ├── user.json │ │ ├── user.json.golden │ │ └── webhooks │ │ │ ├── branch_create.json │ │ │ ├── branch_create.json.golden │ │ │ ├── branch_delete.json │ │ │ ├── branch_delete.json.golden │ │ │ ├── branch_updated.json │ │ │ ├── branch_updated.json.golden │ │ │ ├── pull_request_branch_updated.json │ │ │ ├── pull_request_branch_updated.json.golden │ │ │ ├── pull_request_closed.json │ │ │ ├── pull_request_closed.json.golden │ │ │ ├── pull_request_comment_created.json │ │ │ ├── pull_request_comment_created.json.golden │ │ │ ├── pull_request_merged.json │ │ │ ├── pull_request_merged.json.golden │ │ │ ├── pull_request_opened.json │ │ │ ├── pull_request_opened.json.golden │ │ │ ├── pull_request_reopened.json │ │ │ ├── pull_request_reopened.json.golden │ │ │ ├── tag_create.json │ │ │ ├── tag_create.json.golden │ │ │ ├── tag_delete.json │ │ │ ├── tag_delete.json.golden │ │ │ ├── tag_update.json │ │ │ └── tag_update.json.golden │ ├── user.go │ ├── user_test.go │ ├── util.go │ ├── util_test.go │ ├── webhook.go │ └── webhook_test.go ├── internal │ ├── hmac │ │ ├── hmac.go │ │ └── hmac_test.go │ └── null │ │ ├── bool.go │ │ ├── int.go │ │ ├── string.go │ │ └── time.go └── stash │ ├── content.go │ ├── content_test.go │ ├── git.go │ ├── git_test.go │ ├── integration │ ├── content_test.go │ ├── git_test.go │ ├── integration.go │ └── repo_test.go │ ├── issue.go │ ├── issue_test.go │ ├── linker.go │ ├── linker_test.go │ ├── milestone.go │ ├── multipart.go │ ├── org.go │ ├── org_test.go │ ├── pr.go │ ├── pr_test.go │ ├── release.go │ ├── repo.go │ ├── repo_test.go │ ├── review.go │ ├── review_test.go │ ├── stash.go │ ├── stash_test.go │ ├── testdata │ ├── branch.json │ ├── branch.json.golden │ ├── branch_create.json │ ├── branches.json │ ├── branches.json.golden │ ├── branches_filter.json │ ├── branches_filter.json.golden │ ├── changes.json │ ├── changes.json.golden │ ├── commit.json │ ├── commit.json.golden │ ├── commits.json │ ├── commits.json.golden │ ├── compare.json │ ├── compare.json.golden │ ├── content.json.golden │ ├── content.txt │ ├── content_create.json │ ├── content_list.json │ ├── content_list.json.golden │ ├── content_update.json │ ├── default_branch.json │ ├── error.json │ ├── pr.json │ ├── pr.json.golden │ ├── pr_change.json │ ├── pr_change.json.golden │ ├── pr_comment.json │ ├── pr_comment.json.golden │ ├── pr_comments.json │ ├── pr_comments.json.golden │ ├── prs.json │ ├── prs.json.golden │ ├── repo.json │ ├── repo.json.golden │ ├── repos.json │ ├── repos.json.golden │ ├── repos_filter.json │ ├── repos_filter.json.golden │ ├── tag.json │ ├── tag.json.golden │ ├── tags.json │ ├── tags.json.golden │ ├── user.json │ ├── user.json.golden │ ├── user_search.json │ ├── user_search.json.golden │ ├── webhook.json │ ├── webhook.json.golden │ ├── webhooks.json │ ├── webhooks.json.golden │ └── webhooks │ │ ├── pr_declined.json │ │ ├── pr_declined.json.golden │ │ ├── pr_deleted.json │ │ ├── pr_deleted.json.golden │ │ ├── pr_from_ref_updated.json │ │ ├── pr_from_ref_updated.json.golden │ │ ├── pr_merged.json │ │ ├── pr_merged.json.golden │ │ ├── pr_modified_meta.json │ │ ├── pr_modified_meta.json.golden │ │ ├── pr_modified_toref.json │ │ ├── pr_modified_toref.json.golden │ │ ├── pr_open.json │ │ ├── pr_open.json.golden │ │ ├── push.json │ │ ├── push.json.golden │ │ ├── push_branch_create.json │ │ ├── push_branch_create.json.golden │ │ ├── push_branch_delete.json │ │ ├── push_branch_delete.json.golden │ │ ├── push_tag_create.json │ │ ├── push_tag_create.json.golden │ │ ├── push_tag_delete.json │ │ ├── push_tag_delete.json.golden │ │ ├── push_v5.json │ │ └── push_v5.json.golden │ ├── user.go │ ├── user_test.go │ ├── util.go │ ├── util_test.go │ ├── webhook.go │ └── webhook_test.go ├── enrich ├── doc.go ├── webhook.go └── webhook_test.go ├── example_test.go ├── git.go ├── issue.go ├── linker.go ├── milestone.go ├── org.go ├── pr.go ├── release.go ├── repo.go ├── review.go ├── token.go ├── transport ├── auth.go ├── auth_test.go ├── basicauth.go ├── basicauth_test.go ├── bearer.go ├── bearer_test.go ├── custom.go ├── custom_test.go ├── doc.go ├── internal │ ├── clone.go │ └── clone_test.go ├── oauth1 │ ├── encode.go │ ├── encode_test.go │ ├── oauth1.go │ ├── oauth1_test.go │ ├── sign.go │ ├── sign_test.go │ ├── sort.go │ ├── sort_test.go │ ├── source.go │ ├── source_test.go │ ├── url.go │ └── url_test.go ├── oauth2 │ ├── oauth2.go │ ├── oauth2_test.go │ ├── refresh.go │ ├── refresh_test.go │ ├── source.go │ └── source_test.go ├── private.go ├── private_test.go ├── util.go └── util_test.go ├── traverse ├── doc.go ├── repos.go └── repos_test.go ├── user.go ├── util.go ├── util_test.go └── webhook.go /.github_changelog_generator: -------------------------------------------------------------------------------- 1 | since-tag=v1.15.1 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.bak 2 | *.env 3 | *.out 4 | _*.md 5 | .vscode 6 | .idea 7 | cmd -------------------------------------------------------------------------------- /BUILDING: -------------------------------------------------------------------------------- 1 | 1. Install go 1.9 or later 2 | 2. Install dependencies: 3 | 4 | go get github.com/google/go-cmp 5 | 6 | 3. Compile and test: 7 | 8 | go install ./... 9 | go test ./... 10 | -------------------------------------------------------------------------------- /COPYRIGHT: -------------------------------------------------------------------------------- 1 | Copyright 2017 Drone.IO Inc. All rights reserved. 2 | Use of this source code is governed by a BSD-style 3 | license that can be found in the LICENSE file. -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/drone/go-scm 2 | 3 | require ( 4 | github.com/google/go-cmp v0.2.0 5 | github.com/h2non/gock v1.0.9 6 | github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32 // indirect 7 | ) 8 | 9 | go 1.13 10 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ= 2 | github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= 3 | github.com/h2non/gock v1.0.9 h1:17gCehSo8ZOgEsFKpQgqHiR7VLyjxdAG3lkhVvO9QZU= 4 | github.com/h2non/gock v1.0.9/go.mod h1:CZMcB0Lg5IWnr9bF79pPMg9WeV6WumxQiUJ1UvdO1iE= 5 | github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32 h1:W6apQkHrMkS0Muv8G/TipAy/FJl/rCYT0+EuS8+Z0z4= 6 | github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms= 7 | -------------------------------------------------------------------------------- /scm/driver/azure/integration/integration.go: -------------------------------------------------------------------------------- 1 | package integration 2 | 3 | import ( 4 | "context" 5 | "os" 6 | 7 | "github.com/drone/go-scm/scm" 8 | ) 9 | 10 | var ( 11 | client *scm.Client 12 | token = os.Getenv("AZURE_TOKEN") 13 | 14 | organization = "tphoney" 15 | project = "test_project" 16 | repoID = "fde2d21f-13b9-4864-a995-83329045289a" 17 | ) 18 | 19 | func GetCurrentCommitOfBranch(client *scm.Client, branch string) (string, error) { 20 | commit, _, err := client.Contents.List(context.Background(), repoID, "", "main", scm.ListOptions{}) 21 | if err != nil { 22 | return "", err 23 | } 24 | return commit[0].Sha, nil 25 | } 26 | -------------------------------------------------------------------------------- /scm/driver/azure/linker.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 Drone.IO Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package azure 6 | 7 | import ( 8 | "context" 9 | 10 | "github.com/drone/go-scm/scm" 11 | ) 12 | 13 | type linker struct { 14 | base string 15 | } 16 | 17 | // Resource returns a link to the resource. 18 | func (l *linker) Resource(ctx context.Context, repo string, ref scm.Reference) (string, error) { 19 | return "", scm.ErrNotSupported 20 | } 21 | 22 | // Diff returns a link to the diff. 23 | func (l *linker) Diff(ctx context.Context, repo string, source, target scm.Reference) (string, error) { 24 | return "", scm.ErrNotSupported 25 | } 26 | -------------------------------------------------------------------------------- /scm/driver/azure/org.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 Drone.IO Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package azure 6 | 7 | import ( 8 | "context" 9 | 10 | "github.com/drone/go-scm/scm" 11 | ) 12 | 13 | type organizationService struct { 14 | client *wrapper 15 | } 16 | 17 | func (s *organizationService) Find(ctx context.Context, name string) (*scm.Organization, *scm.Response, error) { 18 | return nil, nil, scm.ErrNotSupported 19 | } 20 | 21 | func (s *organizationService) FindMembership(ctx context.Context, name, username string) (*scm.Membership, *scm.Response, error) { 22 | return nil, nil, scm.ErrNotSupported 23 | } 24 | 25 | func (s *organizationService) List(ctx context.Context, opts scm.ListOptions) ([]*scm.Organization, *scm.Response, error) { 26 | return nil, nil, scm.ErrNotSupported 27 | } 28 | -------------------------------------------------------------------------------- /scm/driver/azure/testdata/branch_create.json: -------------------------------------------------------------------------------- 1 | { 2 | "value": [ 3 | { 4 | "repositoryId": "d3d1760b-311c-4175-a726-20dfc6a7f885", 5 | "name": "refs/heads/vsts-api-sample/answer-woman-flame", 6 | "oldObjectId": "0000000000000000000000000000000000000000", 7 | "newObjectId": "ffe9cba521f00d7f60e322845072238635edb451", 8 | "isLocked": false, 9 | "updateStatus": "succeeded", 10 | "success": true 11 | } 12 | ], 13 | "count": 1 14 | } -------------------------------------------------------------------------------- /scm/driver/azure/testdata/branches.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Name": "main", 4 | "Path": "refs/heads/main", 5 | "Sha": "e0aee6aa543294d62520fb906689da6710af149c" 6 | }, 7 | { 8 | "Name": "pr_branch", 9 | "Path": "refs/heads/pr_branch", 10 | "Sha": "01768d964c03e97260af0bd8cd9e5cd1f9ac6356" 11 | }, 12 | { 13 | "Name": "test_branch", 14 | "Path": "refs/heads/test_branch", 15 | "Sha": "d2036abdecd80290e971e263fe668ca87608f8d1" 16 | }, 17 | { 18 | "Name": "refs/pull/1/merge", 19 | "Path": "refs/pull/1/merge", 20 | "Sha": "e29c0a25614589e1310574b42f799101903b7e30" 21 | } 22 | ] -------------------------------------------------------------------------------- /scm/driver/azure/testdata/branches_filter.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Name": "main", 4 | "Path": "refs/heads/main", 5 | "Sha": "e0aee6aa543294d62520fb906689da6710af149c" 6 | }, 7 | { 8 | "Name": "main-patch", 9 | "Path": "refs/heads/main-patch", 10 | "Sha": "01768d964c03e97260af0bd8cd9e5cd1f9ac6356" 11 | } 12 | ] -------------------------------------------------------------------------------- /scm/driver/azure/testdata/commit.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Sha": "14897f4465d2d63508242b5cbf68aa2865f693e7", 3 | "Message": "update CRUD", 4 | "Author": { 5 | "Name": "tp", 6 | "Email": "tp@harness.io", 7 | "Date": "2022-03-15T17:08:22Z", 8 | "Login": "tp", 9 | "Avatar": "" 10 | }, 11 | "Committer": { 12 | "Name": "tp", 13 | "Email": "tp@harness.io", 14 | "Date": "2022-03-15T17:08:22Z", 15 | "Login": "tp", 16 | "Avatar": "" 17 | }, 18 | "Link": "https://dev.azure.com/tphoney/d350c9c0-7749-4ff8-a78f-f9c1f0e56729/_apis/git/repositories/fde2d21f-13b9-4864-a995-83329045289a/commits/14897f4465d2d63508242b5cbf68aa2865f693e7" 19 | } -------------------------------------------------------------------------------- /scm/driver/azure/testdata/compare.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Path": "/testfile", 4 | "Added": false, 5 | "Renamed": false, 6 | "Deleted": false, 7 | "BlobID": "" 8 | } 9 | ] 10 | -------------------------------------------------------------------------------- /scm/driver/azure/testdata/content.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Path": "/README.md", 3 | "Data": "SGVsbG8gV29ybGQhCg==", 4 | "Sha": "2c0c712b26c3328ed66d5771213360812be9d035", 5 | "BlobID": "0ca446aab9d09eac8625b53e3df8da661976c458" 6 | } -------------------------------------------------------------------------------- /scm/driver/azure/testdata/content_list.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "path": "/", 4 | "kind": "directory", 5 | "Sha": "e25d5d5f8dba6a25d5d66c020b101278d818a8b8", 6 | "BlobID": "9804b758e84cac41a6acc4d011f57310a1f63102" 7 | }, 8 | { 9 | "path": "/README.md", 10 | "kind": "file", 11 | "Sha": "e25d5d5f8dba6a25d5d66c020b101278d818a8b8", 12 | "BlobID": "0ca446aab9d09eac8625b53e3df8da661976c458" 13 | } 14 | ] -------------------------------------------------------------------------------- /scm/driver/azure/testdata/hook.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "ID": "d455cb11-20a0-4b15-b546-7e9fb9973cc6", 3 | "Name": "", 4 | "Target": "http://www.bla.com", 5 | "Events": [ 6 | "git.pullrequest.created" 7 | ], 8 | "Active": true, 9 | "SkipVerify": true 10 | } -------------------------------------------------------------------------------- /scm/driver/azure/testdata/hooks.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "ID": "d455cb11-20a0-4b15-b546-7e9fb9973cc6", 4 | "Name": "", 5 | "Target": "http://www.bla.com", 6 | "Events": [ 7 | "git.pullrequest.created" 8 | ], 9 | "Active": true, 10 | "SkipVerify": true 11 | }, 12 | { 13 | "ID": "d455cb11-20a0-4b15-b546-7e9fb9973cc7", 14 | "Name": "", 15 | "Target": "http://www.bla.com", 16 | "Events": [ 17 | "git.pullrequest.merged" 18 | ], 19 | "Active": true, 20 | "SkipVerify": true 21 | } 22 | ] -------------------------------------------------------------------------------- /scm/driver/azure/testdata/projects.json: -------------------------------------------------------------------------------- 1 | { 2 | "count": 1, 3 | "value": [ 4 | { 5 | "id": "d350c9c0-7749-4ff8-a78f-f9c1f0e56729", 6 | "name": "test_project", 7 | "url": "https://dev.azure.com/tphoney/_apis/projects/d350c9c0-7749-4ff8-a78f-f9c1f0e56729", 8 | "state": "wellFormed", 9 | "revision": 11, 10 | "visibility": "private", 11 | "lastUpdateTime": "2022-02-24T15:31:27.89Z" 12 | } 13 | ] 14 | } -------------------------------------------------------------------------------- /scm/driver/azure/testdata/repo.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "91f0d4cb-4c36-49a5-b28d-2d72da089c4d", 3 | "name": "test_project", 4 | "url": "https://dev.azure.com/tphoney/d350c9c0-7749-4ff8-a78f-f9c1f0e56729/_apis/git/repositories/91f0d4cb-4c36-49a5-b28d-2d72da089c4d", 5 | "project": { 6 | "id": "d350c9c0-7749-4ff8-a78f-f9c1f0e56729", 7 | "name": "test_project", 8 | "url": "https://dev.azure.com/tphoney/_apis/projects/d350c9c0-7749-4ff8-a78f-f9c1f0e56729", 9 | "state": "wellFormed", 10 | "revision": 11, 11 | "visibility": "private", 12 | "lastUpdateTime": "2022-02-24T15:31:27.89Z" 13 | }, 14 | "defaultBranch": "refs/heads/main", 15 | "size": 1232, 16 | "remoteUrl": "https://tphoney@dev.azure.com/tphoney/test_project/_git/test_project", 17 | "sshUrl": "git@ssh.dev.azure.com:v3/tphoney/test_project/test_project", 18 | "webUrl": "https://dev.azure.com/tphoney/test_project/_git/test_project", 19 | "isDisabled": false 20 | } -------------------------------------------------------------------------------- /scm/driver/azure/testdata/repo.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "ID": "91f0d4cb-4c36-49a5-b28d-2d72da089c4d", 3 | "Name": "test_project", 4 | "Namespace": "ORG/test_project", 5 | "Branch": "main", 6 | "Link": "https://dev.azure.com/tphoney/d350c9c0-7749-4ff8-a78f-f9c1f0e56729/_apis/git/repositories/91f0d4cb-4c36-49a5-b28d-2d72da089c4d", 7 | "Clone": "https://tphoney@dev.azure.com/tphoney/test_project/_git/test_project", 8 | "Private": true, 9 | "Visibility": 3 10 | } -------------------------------------------------------------------------------- /scm/driver/azure/user.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 Drone.IO Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package azure 6 | 7 | import ( 8 | "context" 9 | 10 | "github.com/drone/go-scm/scm" 11 | ) 12 | 13 | type userService struct { 14 | client *wrapper 15 | } 16 | 17 | func (s *userService) Find(ctx context.Context) (*scm.User, *scm.Response, error) { 18 | return nil, nil, scm.ErrNotSupported 19 | } 20 | 21 | func (s *userService) FindLogin(ctx context.Context, login string) (*scm.User, *scm.Response, error) { 22 | return nil, nil, scm.ErrNotSupported 23 | } 24 | 25 | func (s *userService) FindEmail(ctx context.Context) (string, *scm.Response, error) { 26 | return "", nil, scm.ErrNotSupported 27 | } 28 | 29 | func (s *userService) ListEmail(context.Context, scm.ListOptions) ([]*scm.Email, *scm.Response, error) { 30 | return nil, nil, scm.ErrNotSupported 31 | } 32 | -------------------------------------------------------------------------------- /scm/driver/azure/util.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 Drone.IO Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package azure 6 | 7 | import ( 8 | "net/url" 9 | "strconv" 10 | 11 | "github.com/drone/go-scm/scm" 12 | ) 13 | 14 | func encodeListOptions(opts scm.ListOptions) string { 15 | params := url.Values{} 16 | if opts.Page != 0 { 17 | params.Set("page", strconv.Itoa(opts.Page)) 18 | } 19 | if opts.Size != 0 { 20 | params.Set("per_page", strconv.Itoa(opts.Size)) 21 | } 22 | return params.Encode() 23 | } 24 | -------------------------------------------------------------------------------- /scm/driver/bitbucket/integration/integration.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 Drone.IO Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Package integration implements a Bitbucket Cloud integration 6 | // tests. 7 | package integration 8 | -------------------------------------------------------------------------------- /scm/driver/bitbucket/integration/integration_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 Drone.IO Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package integration 6 | 7 | import ( 8 | "context" 9 | "net/http" 10 | "os" 11 | "testing" 12 | 13 | "github.com/drone/go-scm/scm/driver/bitbucket" 14 | "github.com/drone/go-scm/scm/transport" 15 | ) 16 | 17 | var noContext = context.Background() 18 | 19 | func TestIntegration(t *testing.T) { 20 | client := bitbucket.NewDefault() 21 | client.Client = &http.Client{ 22 | Transport: &transport.BearerToken{ 23 | Token: os.Getenv("BITBUCKET_TOKEN"), 24 | }, 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /scm/driver/bitbucket/testdata/branch.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Name": "master", 3 | "Path": "refs/heads/master", 4 | "Sha": "a6e5e7d797edf751cbd839d6bd4aef86c941eec9" 5 | } -------------------------------------------------------------------------------- /scm/driver/bitbucket/testdata/branches.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Name": "master", 4 | "Path": "refs/heads/master", 5 | "Sha": "a6e5e7d797edf751cbd839d6bd4aef86c941eec9" 6 | } 7 | ] -------------------------------------------------------------------------------- /scm/driver/bitbucket/testdata/branches_filter.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Name": "master", 4 | "Path": "refs/heads/master", 5 | "Sha": "a6e5e7d797edf751cbd839d6bd4aef86c941eec9" 6 | }, 7 | { 8 | "Name": "master-patch", 9 | "Path": "refs/heads/master-patch", 10 | "Sha": "a6e5e7d797edf751cbd839d6bd4aef86c941eec8" 11 | } 12 | ] -------------------------------------------------------------------------------- /scm/driver/bitbucket/testdata/commit.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Sha": "a6e5e7d797edf751cbd839d6bd4aef86c941eec9", 3 | "Message": "Add Apache 2.0 License\n", 4 | "Author": { 5 | "Name": "Adam Ahmed", 6 | "Email": "aahmed@atlassian.com", 7 | "Date": "2015-08-27T03:25:04Z", 8 | "Login": "aahmed", 9 | "Avatar": "https://bitbucket.org/account/aahmed/avatar/32/" 10 | }, 11 | "Committer": { 12 | "Name": "Adam Ahmed", 13 | "Email": "aahmed@atlassian.com", 14 | "Date": "2015-08-27T03:25:04Z", 15 | "Login": "aahmed", 16 | "Avatar": "https://bitbucket.org/account/aahmed/avatar/32/" 17 | }, 18 | "Link": "https://bitbucket.org/atlassian/stash-example-plugin/commits/a6e5e7d797edf751cbd839d6bd4aef86c941eec9" 19 | } -------------------------------------------------------------------------------- /scm/driver/bitbucket/testdata/commits.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Sha": "a6e5e7d797edf751cbd839d6bd4aef86c941eec9", 4 | "Message": "Add Apache 2.0 License\n", 5 | "Author": { 6 | "Name": "Adam Ahmed", 7 | "Email": "aahmed@atlassian.com", 8 | "Date": "2015-08-27T03:25:04Z", 9 | "Login": "aahmed", 10 | "Avatar": "https://bitbucket.org/account/aahmed/avatar/32/" 11 | }, 12 | "Committer": { 13 | "Name": "Adam Ahmed", 14 | "Email": "aahmed@atlassian.com", 15 | "Date": "2015-08-27T03:25:04Z", 16 | "Login": "aahmed", 17 | "Avatar": "https://bitbucket.org/account/aahmed/avatar/32/" 18 | }, 19 | "Link": "https://bitbucket.org/atlassian/stash-example-plugin/commits/a6e5e7d797edf751cbd839d6bd4aef86c941eec9" 20 | } 21 | ] -------------------------------------------------------------------------------- /scm/driver/bitbucket/testdata/content.json.fail: -------------------------------------------------------------------------------- 1 | { 2 | "Path": "README", 3 | "Data": "SEVMTE8gV09STEQK" 4 | } 5 | -------------------------------------------------------------------------------- /scm/driver/bitbucket/testdata/content.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Path": "README", 3 | "Data": "SEVMTE8gV09STEQK", 4 | "Sha": "0846a192175701903ddd9264ece31922d8437c1a" 5 | } 6 | -------------------------------------------------------------------------------- /scm/driver/bitbucket/testdata/content.txt: -------------------------------------------------------------------------------- 1 | HELLO WORLD 2 | -------------------------------------------------------------------------------- /scm/driver/bitbucket/testdata/content_fail.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "error", 3 | "error": { 4 | "message": "No such file or directory: README.md.asdas" 5 | } 6 | } -------------------------------------------------------------------------------- /scm/driver/bitbucket/testdata/content_update.json.fail: -------------------------------------------------------------------------------- 1 | { 2 | "type": "error", 3 | "error": { 4 | "fields": { 5 | "parents": [] 6 | }, 7 | "message": "parents: Commit not found: 1a7eba6c-d4fe-47b7-b767-859abc660efc" 8 | } 9 | } -------------------------------------------------------------------------------- /scm/driver/bitbucket/testdata/diffstat.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Path": "CONTRIBUTING.md", 4 | "Added": false, 5 | "Renamed": false, 6 | "Deleted": false 7 | }, 8 | { 9 | "Path": "new-folder/CONTRIBUTING.md", 10 | "Added": false, 11 | "Renamed": true, 12 | "Deleted": false, 13 | "PrevFilePath": "old-folder/CONTRIBUTING.md" 14 | }, 15 | { 16 | "Path": "CONTRIBUTING.md", 17 | "Added": false, 18 | "Renamed": false, 19 | "Deleted": true 20 | } 21 | ] -------------------------------------------------------------------------------- /scm/driver/bitbucket/testdata/error.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "error", 3 | "error": { 4 | "message": "Repository dev/null not found" 5 | } 6 | } -------------------------------------------------------------------------------- /scm/driver/bitbucket/testdata/hook.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "ID": "{d53603cc-3f67-45ea-b310-aaa5ef6ec061}", 3 | "Name": "beta.drone.io", 4 | "Target": "http://example.com/webhook", 5 | "Events": [ 6 | "pullrequest:created", 7 | "pullrequest:updated", 8 | "repo:push" 9 | ], 10 | "Active": true, 11 | "SkipVerify": false 12 | } -------------------------------------------------------------------------------- /scm/driver/bitbucket/testdata/hooks.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "ID": "{d53603cc-3f67-45ea-b310-aaa5ef6ec061}", 4 | "Name": "example.com", 5 | "Target": "http://example.com/webhook", 6 | "Events": [ 7 | "pullrequest:created", 8 | "pullrequest:updated", 9 | "repo:push" 10 | ], 11 | "Active": true, 12 | "SkipVerify": false 13 | } 14 | ] -------------------------------------------------------------------------------- /scm/driver/bitbucket/testdata/perms.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Pull": true, 3 | "Push": true, 4 | "Admin": true 5 | } -------------------------------------------------------------------------------- /scm/driver/bitbucket/testdata/pr_diffstat.json: -------------------------------------------------------------------------------- 1 | { 2 | "pagelen": 30, 3 | "values": [ 4 | { 5 | "status": "modified", 6 | "old": { 7 | "path": "CONTRIBUTING.md", 8 | "type": "commit_file", 9 | "links": { 10 | "self": { 11 | "href": "https:\/\/api.bitbucket.org\/2.0\/repositories\/atlassian\/atlaskit\/src\/dec26e0fe887167743c2b7e36531dedfeb6cd478\/CONTRIBUTING.md" 12 | } 13 | } 14 | }, 15 | "lines_removed": 15, 16 | "lines_added": 15, 17 | "new": { 18 | "path": "CONTRIBUTING.md", 19 | "type": "commit_file", 20 | "links": { 21 | "self": { 22 | "href": "https:\/\/api.bitbucket.org\/2.0\/repositories\/atlassian\/atlaskit\/src\/425863f9dbe56d70c8dcdbf2e4e0805e85591fcc\/CONTRIBUTING.md" 23 | } 24 | } 25 | }, 26 | "type": "diffstat" 27 | } 28 | ], 29 | "page": 1, 30 | "size": 1 31 | } -------------------------------------------------------------------------------- /scm/driver/bitbucket/testdata/pr_diffstat.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Path": "CONTRIBUTING.md", 4 | "Added": false, 5 | "Renamed": false, 6 | "Deleted": false 7 | } 8 | ] -------------------------------------------------------------------------------- /scm/driver/bitbucket/testdata/prcomment.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "ID": 419169807, 3 | "Body": "Lovely comment", 4 | "Author": { 5 | "ID": "{6b408a94-1b8b-4f62-b37f-3069e13bc33e}", 6 | "Login": "brian.jacobson", 7 | "Name": "Brian Jacobson", 8 | "Avatar": "http://localhost:3000/avatars/1" 9 | }, 10 | "Created": "2023-08-14T11:38:53.460132+00:00", 11 | "Updated": "2023-08-14T11:38:53.460205+00:00" 12 | } 13 | -------------------------------------------------------------------------------- /scm/driver/bitbucket/testdata/repo.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "ID": "{7dd600e6-0d9c-4801-b967-cb4cc17359ff}", 3 | "Namespace": "atlassian", 4 | "Name": "stash-example-plugin", 5 | "Perm": null, 6 | "Branch": "master", 7 | "Private": true, 8 | "Clone": "https://bitbucket.org/atlassian/stash-example-plugin.git", 9 | "CloneSSH": "git@bitbucket.org:atlassian/stash-example-plugin.git", 10 | "Link": "https://bitbucket.org/atlassian/stash-example-plugin", 11 | "Created": "2013-04-15T03:05:05.595458Z", 12 | "Updated": "2018-04-01T16:36:35.970175Z" 13 | } -------------------------------------------------------------------------------- /scm/driver/bitbucket/testdata/repos_filter.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "ID": "{7dd600e6-0d9c-4801-b967-cb4cc17359ff}", 4 | "Namespace": "atlassian", 5 | "Name": "stash-example-plugin1", 6 | "Perm": null, 7 | "Branch": "master", 8 | "Private": true, 9 | "Clone": "https://bitbucket.org/atlassian/stash-example-plugin1.git", 10 | "CloneSSH": "git@bitbucket.org:atlassian/stash-example-plugin1.git", 11 | "Link": "https://bitbucket.org/atlassian/stash-example-plugin1", 12 | "Created": "2013-04-15T03:05:05.595458Z", 13 | "Updated": "2018-04-01T16:36:35.970175Z" 14 | } 15 | ] -------------------------------------------------------------------------------- /scm/driver/bitbucket/testdata/status.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "State": 3, 3 | "Label": "drone", 4 | "Desc": "Build has completed successfully", 5 | "Title": "build-22", 6 | "Target": "https://ci.example.com/1000/output" 7 | } -------------------------------------------------------------------------------- /scm/driver/bitbucket/testdata/statuses.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "State": 3, 4 | "Label": "drone", 5 | "Desc": "Build has completed successfully", 6 | "Target": "https://ci.example.com/1000/output" 7 | } 8 | ] -------------------------------------------------------------------------------- /scm/driver/bitbucket/testdata/tag.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Name": "@atlaskit/activity@1.0.3", 3 | "Path": "refs/tags/@atlaskit/activity@1.0.3", 4 | "Sha": "ceb01356c3f062579bdfeb15bc53fe151b9e00f0" 5 | } -------------------------------------------------------------------------------- /scm/driver/bitbucket/testdata/tags.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Name": "@atlaskit\/activity@1.0.3", 4 | "Path": "refs/tags/@atlaskit\/activity@1.0.3", 5 | "Sha": "ceb01356c3f062579bdfeb15bc53fe151b9e00f0" 6 | } 7 | ] -------------------------------------------------------------------------------- /scm/driver/bitbucket/testdata/team.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Name": "atlassian", 3 | "Avatar": "https://bitbucket.org/account/atlassian/avatar/32/" 4 | } -------------------------------------------------------------------------------- /scm/driver/bitbucket/testdata/teams.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Name": "atlassian", 4 | "Avatar": "https://bitbucket.org/account/atlassian/avatar/32/" 5 | } 6 | ] -------------------------------------------------------------------------------- /scm/driver/bitbucket/testdata/user.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Login": "brydzewski", 3 | "Name": "Brad Rydzewski", 4 | "Email": "", 5 | "Avatar": "https://bitbucket.org/account/brydzewski/avatar/32/" 6 | } -------------------------------------------------------------------------------- /scm/driver/bitbucket/testdata/userEmail.json: -------------------------------------------------------------------------------- 1 | { 2 | "Values": [ 3 | { 4 | "email": "test@harness.io", 5 | "is_primary": true 6 | } 7 | ] 8 | } -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/branch.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "master", 3 | "commit": { 4 | "id": "f05f642b892d59a0a9ef6a31f6c905a24b5db13a", 5 | "message": "update README\n", 6 | "author": { 7 | "name": "Jane Doe", 8 | "email": "jane.doe@mail.com", 9 | "username": "janedoe" 10 | }, 11 | "committer": { 12 | "name": "Jane Doe", 13 | "email": "jane.doe@mail.com", 14 | "username": "janedoe" 15 | }, 16 | "added": null, 17 | "removed": null, 18 | "modified": null, 19 | "timestamp": "2017-11-16T22:06:53Z" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/branch.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Name": "master", 3 | "Path": "refs/heads/master", 4 | "Sha": "f05f642b892d59a0a9ef6a31f6c905a24b5db13a" 5 | } -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/branches.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "master", 4 | "commit": { 5 | "id": "f05f642b892d59a0a9ef6a31f6c905a24b5db13a", 6 | "message": "update README\n", 7 | "author": { 8 | "name": "Jane Doe", 9 | "email": "jane.doe@mail.com", 10 | "username": "janedoe" 11 | }, 12 | "committer": { 13 | "name": "Jane Doe", 14 | "email": "jane.doe@mail.com", 15 | "username": "janedoe" 16 | }, 17 | "added": null, 18 | "removed": null, 19 | "modified": null, 20 | "timestamp": "2017-11-16T22:06:53Z" 21 | } 22 | } 23 | ] -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/branches.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Name": "master", 4 | "Path": "refs/heads/master", 5 | "Sha": "f05f642b892d59a0a9ef6a31f6c905a24b5db13a" 6 | } 7 | ] -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/comment.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": 74, 3 | "user": { 4 | "id": 1, 5 | "username": "unknwon", 6 | "full_name": "无闻", 7 | "email": "u@gogs.io", 8 | "avatar_url": "http://localhost:3000/avatars/1" 9 | }, 10 | "body": "what?", 11 | "created_at": "2016-08-26T11:58:18-07:00", 12 | "updated_at": "2016-08-26T11:58:18-07:00" 13 | } -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/comment.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "ID": 74, 3 | "Body": "what?", 4 | "Author": { 5 | "Login": "unknwon", 6 | "Name": "无闻", 7 | "Email": "u@gogs.io", 8 | "Avatar": "http://localhost:3000/avatars/1" 9 | }, 10 | "Created": "2016-08-26T11:58:18-07:00", 11 | "Updated": "2016-08-26T11:58:18-07:00" 12 | } -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/comments.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": 74, 4 | "user": { 5 | "id": 1, 6 | "username": "unknwon", 7 | "full_name": "无闻", 8 | "email": "u@gogs.io", 9 | "avatar_url": "http://localhost:3000/avatars/1" 10 | }, 11 | "body": "what?", 12 | "created_at": "2016-08-26T11:58:18-07:00", 13 | "updated_at": "2016-08-26T11:58:18-07:00" 14 | } 15 | ] -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/comments.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "ID": 74, 4 | "Body": "what?", 5 | "Author": { 6 | "Login": "unknwon", 7 | "Name": "无闻", 8 | "Email": "u@gogs.io", 9 | "Avatar": "http://localhost:3000/avatars/1" 10 | }, 11 | "Created": "2016-08-26T11:58:18-07:00", 12 | "Updated": "2016-08-26T11:58:18-07:00" 13 | } 14 | ] -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/commit.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "committer": { 3 | "name": "Lunny Xiao", 4 | "login": "lunny", 5 | "email": "xiaolunwen@gmail.com", 6 | "avatar": "https://secure.gravatar.com/avatar/271fc56bcea89c6f69ab0024b59b3f81?d=identicon" 7 | }, 8 | "link": "https://try.gitea.io/api/v1/repos/gitea/gitea/git/commits/c43399cad8766ee521b873a32c1652407c5a4630", 9 | "sha": "c43399cad8766ee521b873a32c1652407c5a4630", 10 | "message": "Fixes repo branch endpoint summary (#4893)" 11 | } -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/commits.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "committer": { 4 | "name": "Lunny Xiao", 5 | "login": "lunny", 6 | "email": "xiaolunwen@gmail.com", 7 | "avatar": "https://secure.gravatar.com/avatar/271fc56bcea89c6f69ab0024b59b3f81?d=identicon" 8 | }, 9 | "link": "https://try.gitea.io/api/v1/repos/gitea/gitea/git/commits/c43399cad8766ee521b873a32c1652407c5a4630", 10 | "sha": "c43399cad8766ee521b873a32c1652407c5a4630", 11 | "message": "Fixes repo branch endpoint summary (#4893)" 12 | } 13 | ] -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/content_list.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "path": "docs/content/doc/advanced.en-us.md", 4 | "kind": "file", 5 | "blobid": "de2bfeed6f2d3ea1d2f91e457e9450efc582bb31" 6 | }, 7 | { 8 | "path": "docs/content/doc/advanced.fr-fr.md", 9 | "kind": "file", 10 | "blobid": "04734a8f81f5641de2b6d738bc9b777c2cc541c6" 11 | }, 12 | { 13 | "path": "docs/content/doc/advanced.zh-cn.md", 14 | "kind": "file", 15 | "blobid": "1f7ebf81e723a0ba82a89eec18a2706ac1b0dace" 16 | }, 17 | { 18 | "path": "docs/content/doc/advanced", 19 | "kind": "directory", 20 | "blobid": "8c43a4fb023735dfd026014bae92ad91414b88bd" 21 | } 22 | ] 23 | -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/hook.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": 20, 3 | "type": "gogs", 4 | "config": { 5 | "content_type": "json", 6 | "url": "http://gogs.io" 7 | }, 8 | "events": [ 9 | "create", 10 | "push" 11 | ], 12 | "active": true, 13 | "updated_at": "2015-08-29T11:31:22.453572732+08:00", 14 | "created_at": "2015-08-29T11:31:22.453569275+08:00" 15 | } 16 | -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/hook.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "ID": "20", 3 | "Name": "", 4 | "Target": "http://gogs.io", 5 | "Events": [ 6 | "create", 7 | "push" 8 | ], 9 | "Active": true, 10 | "SkipVerify": false 11 | } -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/hooks.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": 20, 4 | "type": "gogs", 5 | "config": { 6 | "content_type": "json", 7 | "url": "http://gogs.io" 8 | }, 9 | "events": [ 10 | "create", 11 | "push" 12 | ], 13 | "active": true, 14 | "updated_at": "2015-08-29T11:31:22.453572732+08:00", 15 | "created_at": "2015-08-29T11:31:22.453569275+08:00" 16 | } 17 | ] 18 | -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/hooks.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "ID": "20", 4 | "Name": "", 5 | "Target": "http://gogs.io", 6 | "Events": [ 7 | "create", 8 | "push" 9 | ], 10 | "Active": true, 11 | "SkipVerify": false 12 | } 13 | ] -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/issue.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "id": 1, 4 | "number": 1, 5 | "user": { 6 | "id": 1, 7 | "login": "janedoe", 8 | "full_name": "", 9 | "email": "janedoe@mail.com", 10 | "avatar_url": "https://secure.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87", 11 | "username": "janedoe" 12 | }, 13 | "title": "Bug found", 14 | "body": "I'm having a problem with this.", 15 | "labels": [ 16 | 17 | ], 18 | "milestone": null, 19 | "assignee": null, 20 | "state": "open", 21 | "comments": 0, 22 | "created_at": "2017-09-23T19:24:01Z", 23 | "updated_at": "2017-09-23T19:24:01Z", 24 | "pull_request": null 25 | } -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/issue.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Number": 1, 3 | "Title": "Bug found", 4 | "Body": "I'm having a problem with this.", 5 | "Link": "", 6 | "Labels": null, 7 | "Closed": false, 8 | "Locked": false, 9 | "Author": { 10 | "Login": "janedoe", 11 | "Name": "", 12 | "Email": "janedoe@mail.com", 13 | "Avatar": "https://secure.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87" 14 | }, 15 | "Created": "2017-09-23T19:24:01Z", 16 | "Updated": "2017-09-23T19:24:01Z" 17 | } -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/issues.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": 1, 4 | "number": 1, 5 | "user": { 6 | "id": 1, 7 | "login": "janedoe", 8 | "full_name": "", 9 | "email": "janedoe@mail.com", 10 | "avatar_url": "https://secure.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87", 11 | "username": "janedoe" 12 | }, 13 | "title": "Bug found", 14 | "body": "I'm having a problem with this.", 15 | "labels": [ 16 | 17 | ], 18 | "milestone": null, 19 | "assignee": null, 20 | "state": "open", 21 | "comments": 0, 22 | "created_at": "2017-09-23T19:24:01Z", 23 | "updated_at": "2017-09-23T19:24:01Z", 24 | "pull_request": null 25 | } 26 | ] 27 | -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/issues.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Number": 1, 4 | "Title": "Bug found", 5 | "Body": "I'm having a problem with this.", 6 | "Link": "", 7 | "Labels": null, 8 | "Closed": false, 9 | "Locked": false, 10 | "Author": { 11 | "Login": "janedoe", 12 | "Name": "", 13 | "Email": "janedoe@mail.com", 14 | "Avatar": "https://secure.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87" 15 | }, 16 | "Created": "2017-09-23T19:24:01Z", 17 | "Updated": "2017-09-23T19:24:01Z" 18 | } 19 | ] -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/membership.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Active": true, 3 | "Role": 2 4 | } -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/milestone.json: -------------------------------------------------------------------------------- 1 | { 2 | "closed_at": "2020-09-11T19:32:38.046Z", 3 | "closed_issues": 0, 4 | "created_at": "2020-09-11T19:32:38.046Z", 5 | "description": "string", 6 | "due_on": "2020-09-11T19:32:38.046Z", 7 | "id": 1, 8 | "open_issues": 0, 9 | "state": "open", 10 | "title": "string", 11 | "updated_at": "2020-09-11T19:32:38.046Z" 12 | } 13 | -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/milestone.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Description": "string", 3 | "DueDate": "2020-09-11T19:32:38.046Z", 4 | "ID": 1, 5 | "Number": 1, 6 | "State": "open", 7 | "Title": "string" 8 | } 9 | -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/milestone_create.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "v1.0", 3 | "description": "Tracking milestone for version 1.0", 4 | "state": "open", 5 | "due_on": "2012-10-09T23:39:01Z" 6 | } 7 | -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/milestones.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "closed_at": "2020-09-11T19:32:38.046Z", 4 | "closed_issues": 0, 5 | "created_at": "2020-09-11T19:32:38.046Z", 6 | "description": "string", 7 | "due_on": "2020-09-11T19:32:38.046Z", 8 | "id": 1, 9 | "open_issues": 0, 10 | "state": "open", 11 | "title": "string", 12 | "updated_at": "2020-09-11T19:32:38.046Z" 13 | } 14 | ] 15 | -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/milestones.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Description": "string", 4 | "DueDate": "2020-09-11T19:32:38.046Z", 5 | "ID": 1, 6 | "Number": 1, 7 | "State": "open", 8 | "Title": "string" 9 | } 10 | ] 11 | -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/organization.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": 1, 3 | "username": "gogits", 4 | "full_name": "gogits", 5 | "avatar_url": "http://gogits.io/avatars/1", 6 | "description": "", 7 | "website": "", 8 | "location": "" 9 | } 10 | -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/organization.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Name": "gogits", 3 | "Avatar": "http://gogits.io/avatars/1" 4 | } -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/organizations.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": 1, 4 | "username": "gogits", 5 | "full_name": "gogits", 6 | "avatar_url": "http://gogits.io/avatars/1", 7 | "description": "", 8 | "website": "", 9 | "location": "" 10 | } 11 | ] 12 | -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/organizations.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Name": "gogits", 4 | "Avatar": "http://gogits.io/avatars/1" 5 | } 6 | ] -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/permissions.json: -------------------------------------------------------------------------------- 1 | { 2 | "is_owner": true, 3 | "is_admin": true, 4 | "can_write": true, 5 | "can_read": true, 6 | "can_create_repository": true 7 | } 8 | -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/pr.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Number": 1, 3 | "Title": "Add License File", 4 | "Body": "Using a BSD License", 5 | "Sha": "4f5e7d8f15cf79387cfd8a0d30c58855ab61e138", 6 | "Ref": "refs/pull/1/head", 7 | "Source": "feature", 8 | "Target": "master", 9 | "Fork": "jcitizen/my-repo", 10 | "Link": "https://try.gitea.io/jcitizen/my-repo/pulls/1", 11 | "Diff": "https://try.gitea.io/jcitizen/my-repo/pulls/1.diff", 12 | "Closed": false, 13 | "Merged": false, 14 | "Author": { 15 | "Login": "jcitizen", 16 | "Name": "", 17 | "Email": "jcitizen@example.com", 18 | "Avatar": "https://secure.gravatar.com/avatar/66f07ff48e6a9cb393de7a34e03bb52a?d=identicon" 19 | }, 20 | "Created": "2018-07-06T00:37:47Z", 21 | "Updated": "2018-07-06T00:37:47Z" 22 | } -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/prs.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Number": 1, 4 | "Title": "Add License File", 5 | "Body": "Using a BSD License", 6 | "Sha": "4f5e7d8f15cf79387cfd8a0d30c58855ab61e138", 7 | "Ref": "refs/pull/1/head", 8 | "Source": "feature", 9 | "Target": "master", 10 | "Fork": "jcitizen/my-repo", 11 | "Link": "https://try.gitea.io/jcitizen/my-repo/pulls/1", 12 | "Diff": "https://try.gitea.io/jcitizen/my-repo/pulls/1.diff", 13 | "Closed": false, 14 | "Merged": false, 15 | "Author": { 16 | "Login": "jcitizen", 17 | "Name": "", 18 | "Email": "jcitizen@example.com", 19 | "Avatar": "https://secure.gravatar.com/avatar/66f07ff48e6a9cb393de7a34e03bb52a?d=identicon" 20 | }, 21 | "Created": "2018-07-06T00:37:47Z", 22 | "Updated": "2018-07-06T00:37:47Z" 23 | } 24 | ] -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/release.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": 1, 3 | "name": "v1.0.0", 4 | "body": "Description of the release", 5 | "url": "https://try.gitea.com/api/v1/repos/octocat/Hello-World/123", 6 | "tag_name": "v1.0.0", 7 | "target_commitish": "master", 8 | "draft": false, 9 | "prerelease": false 10 | } -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/release.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "ID": 1, 3 | "Title": "v1.0.0", 4 | "Description": "Description of the release", 5 | "Link": "https://try.gitea.com/octocat/Hello-World/releases/tag/v1.0.0", 6 | "Tag": "v1.0.0", 7 | "Commitish": "master", 8 | "Draft": false, 9 | "Prerelease": false 10 | } -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/release_create.json: -------------------------------------------------------------------------------- 1 | { 2 | "tag_name": "v1.0.0", 3 | "target_commitish": "master", 4 | "name": "v1.0.0", 5 | "body": "Description of the release", 6 | "draft": false, 7 | "prerelease": false 8 | } -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/release_update.json: -------------------------------------------------------------------------------- 1 | { 2 | "tag_name": "v1.0.0", 3 | "target_commitish": "master", 4 | "name": "v1.0.0", 5 | "body": "Description of the release", 6 | "draft": false, 7 | "prerelease": false 8 | } -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/releases.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": 1, 4 | "name": "v1.0.0", 5 | "body": "Description of the release", 6 | "url": "https://try.gitea.com/api/v1/repos/octocat/Hello-World/123", 7 | "tag_name": "v1.0.0", 8 | "target_commitish": "master", 9 | "draft": false, 10 | "prerelease": false 11 | } 12 | ] -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/releases.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "ID": 1, 4 | "Title": "v1.0.0", 5 | "Description": "Description of the release", 6 | "Link": "https://try.gitea.com/octocat/Hello-World/releases/tag/v1.0.0", 7 | "Tag": "v1.0.0", 8 | "Commitish": "master", 9 | "Draft": false, 10 | "Prerelease": false 11 | } 12 | ] -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/repo.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "ID": "1", 3 | "Namespace": "go-gitea", 4 | "Name": "gitea", 5 | "Perm": { 6 | "Pull": true, 7 | "Push": true, 8 | "Admin": true 9 | }, 10 | "Branch": "master", 11 | "Private": true, 12 | "Clone": "https://try.gitea.io/go-gitea/gitea.git", 13 | "CloneSSH": "git@try.gitea.io:go-gitea/gitea.git", 14 | "Link": "https://try.gitea.io/go-gitea/gitea", 15 | "Created": "0001-01-01T00:00:00Z", 16 | "Updated": "0001-01-01T00:00:00Z", 17 | "Archived": false 18 | } -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/repos.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "ID": "1", 4 | "Namespace": "go-gitea", 5 | "Name": "gitea", 6 | "Perm": { 7 | "Pull": true, 8 | "Push": true, 9 | "Admin": true 10 | }, 11 | "Branch": "master", 12 | "Private": true, 13 | "Clone": "https://try.gitea.io/go-gitea/gitea.git", 14 | "CloneSSH": "git@try.gitea.io:go-gitea/gitea.git", 15 | "Link": "https://try.gitea.io/go-gitea/gitea", 16 | "Created": "0001-01-01T00:00:00Z", 17 | "Updated": "0001-01-01T00:00:00Z", 18 | "Archived": false 19 | } 20 | ] -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/status.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": 1, 3 | "status": "success", 4 | "target_url": "https://example.com", 5 | "description": "", 6 | "url": "https://try.gitea.io/api/v1/jcitizen/my-repo/statuses/f026eb4eb1d83a7149e52058bf2134f4360d9bc4", 7 | "context": "continuous-integration/drone", 8 | "creator": { 9 | "id": 6641, 10 | "login": "jcitizen", 11 | "full_name": "", 12 | "email": "jane@example.com", 13 | "avatar_url": "https://secure.gravatar.com/avatar/66f07ff48e6a9cb393de7a34e03bb52a?d=identicon", 14 | "language": "en-US", 15 | "username": "jcitizen" 16 | }, 17 | "created_at": "2018-07-06T02:03:38Z", 18 | "updated_at": "2018-07-06T02:03:38Z" 19 | } -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/status.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "State": 3, 3 | "Label": "continuous-integration/drone", 4 | "Desc": "", 5 | "Target": "https://example.com" 6 | } -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/statuses.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": 1, 4 | "status": "success", 5 | "target_url": "https://example.com", 6 | "description": "", 7 | "url": "https://try.gitea.io/api/v1/jcitizen/my-repo/statuses/f026eb4eb1d83a7149e52058bf2134f4360d9bc4", 8 | "context": "continuous-integration/drone", 9 | "creator": { 10 | "id": 6641, 11 | "login": "jcitizen", 12 | "full_name": "", 13 | "email": "jane@example.com", 14 | "avatar_url": "https://secure.gravatar.com/avatar/66f07ff48e6a9cb393de7a34e03bb52a?d=identicon", 15 | "language": "en-US", 16 | "username": "jcitizen" 17 | }, 18 | "created_at": "2018-07-06T02:03:38Z", 19 | "updated_at": "2018-07-06T02:03:38Z" 20 | } 21 | ] -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/statuses.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "State": 3, 4 | "Label": "continuous-integration/drone", 5 | "Desc": "", 6 | "Target": "https://example.com" 7 | } 8 | ] -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/tag.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "ref": "refs/tags/v1.0.0", 4 | "url": "https://try.gitea.io/api/v1/repos/go-gitea/gitea/git/refs/tags/v1.0.0", 5 | "object": { 6 | "type": "commit", 7 | "sha": "4b736a01b6291e21c663ae9aab494850e7a50723", 8 | "url": "https://try.gitea.io/api/v1/repos/go-gitea/gitea/git/commits/4b736a01b6291e21c663ae9aab494850e7a50723" 9 | } 10 | } 11 | ] -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/tag.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Name": "v1.0.0", 3 | "Path": "refs/tags/v1.0.0", 4 | "Sha": "4b736a01b6291e21c663ae9aab494850e7a50723" 5 | } -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/tags.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "ref": "refs/tags/v1.0.0", 4 | "url": "https://try.gitea.io/api/v1/repos/go-gitea/gitea/git/refs/tags/v1.0.0", 5 | "object": { 6 | "type": "commit", 7 | "sha": "4b736a01b6291e21c663ae9aab494850e7a50723", 8 | "url": "https://try.gitea.io/api/v1/repos/go-gitea/gitea/git/commits/4b736a01b6291e21c663ae9aab494850e7a50723" 9 | } 10 | } 11 | ] -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/tags.json.golden: -------------------------------------------------------------------------------- 1 | [{ 2 | "Name": "v1.0.0", 3 | "Path": "refs/tags/v1.0.0", 4 | "Sha": "4b736a01b6291e21c663ae9aab494850e7a50723" 5 | }] -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/user.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": 1, 3 | "login": "jcitizen", 4 | "full_name": "Jane Citizen", 5 | "email": "jane@example.com", 6 | "avatar_url": "https://secure.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87", 7 | "language": "en-US", 8 | "username": "jcitizen" 9 | } 10 | -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/user.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Login": "jcitizen", 3 | "Name": "Jane Citizen", 4 | "Email": "jane@example.com", 5 | "Avatar": "https://secure.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87" 6 | } -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/webhooks/branch_create.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Ref": { 3 | "Name": "feature", 4 | "Sha": "" 5 | }, 6 | "Repo": { 7 | "ID": "61", 8 | "Namespace": "gogits", 9 | "Name": "hello-world", 10 | "Perm": {}, 11 | "Branch": "master", 12 | "Private": true, 13 | "Clone": "http://try.gitea.io/gogits/hello-world.git", 14 | "CloneSSH": "git@localhost:gogits/hello-world.git", 15 | "Link": "http://try.gitea.io/gogits/hello-world", 16 | "Created": "0001-01-01T00:00:00Z", 17 | "Updated": "0001-01-01T00:00:00Z" 18 | }, 19 | "Action": "created", 20 | "Sender": { 21 | "Login": "unknwon", 22 | "Name": "", 23 | "Email": "noreply@gogs.io", 24 | "Avatar": "https://secure.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87" 25 | } 26 | } -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/webhooks/branch_delete.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Ref": { 3 | "Name": "feature", 4 | "Sha": "" 5 | }, 6 | "Repo": { 7 | "ID": "61", 8 | "Namespace": "gogits", 9 | "Name": "hello-world", 10 | "Perm": {}, 11 | "Branch": "master", 12 | "Private": true, 13 | "Clone": "http://try.gitea.io/gogits/hello-world.git", 14 | "CloneSSH": "git@localhost:gogits/hello-world.git", 15 | "Link": "http://try.gitea.io/gogits/hello-world", 16 | "Created": "0001-01-01T00:00:00Z", 17 | "Updated": "0001-01-01T00:00:00Z" 18 | }, 19 | "Action": "deleted", 20 | "Sender": { 21 | "Login": "unknwon", 22 | "Name": "", 23 | "Email": "noreply@gogs.io", 24 | "Avatar": "https://secure.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87" 25 | } 26 | } -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/webhooks/tag_create.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Ref": { 3 | "Name": "v1.0.0", 4 | "Sha": "599d25c67b05717269f50ac082b34f176d085179" 5 | }, 6 | "Repo": { 7 | "ID": "61", 8 | "Namespace": "gogits", 9 | "Name": "hello-world", 10 | "Perm": {}, 11 | "Branch": "master", 12 | "Private": true, 13 | "Clone": "http://try.gitea.io/gogits/hello-world.git", 14 | "CloneSSH": "git@localhost:gogits/hello-world.git", 15 | "Link": "http://try.gitea.io/gogits/hello-world", 16 | "Created": "0001-01-01T00:00:00Z", 17 | "Updated": "0001-01-01T00:00:00Z" 18 | }, 19 | "Action": "created", 20 | "Sender": { 21 | "Login": "unknwon", 22 | "Name": "", 23 | "Email": "noreply@gogs.io", 24 | "Avatar": "https://secure.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87" 25 | } 26 | } -------------------------------------------------------------------------------- /scm/driver/gitea/testdata/webhooks/tag_delete.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Ref": { 3 | "Name": "v1.0.0", 4 | "Sha": "" 5 | }, 6 | "Repo": { 7 | "ID": "61", 8 | "Namespace": "gogits", 9 | "Name": "hello-world", 10 | "Perm": {}, 11 | "Branch": "master", 12 | "Private": true, 13 | "Clone": "http://try.gitea.io/gogits/hello-world.git", 14 | "CloneSSH": "git@localhost:gogits/hello-world.git", 15 | "Link": "http://try.gitea.io/gogits/hello-world", 16 | "Created": "0001-01-01T00:00:00Z", 17 | "Updated": "0001-01-01T00:00:00Z" 18 | }, 19 | "Action": "deleted", 20 | "Sender": { 21 | "Login": "unknwon", 22 | "Name": "", 23 | "Email": "noreply@gogs.io", 24 | "Avatar": "https://secure.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87" 25 | } 26 | } -------------------------------------------------------------------------------- /scm/driver/gitee/integration/integration.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 Drone.IO Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package integration 6 | -------------------------------------------------------------------------------- /scm/driver/gitee/testdata/branch.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Name": "master", 3 | "Path": "refs/heads/master", 4 | "Sha": "e3c0ff4d5cef439ea11b30866fb1ed79b420801d" 5 | } -------------------------------------------------------------------------------- /scm/driver/gitee/testdata/branches.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "master", 4 | "commit": { 5 | "sha": "e3c0ff4d5cef439ea11b30866fb1ed79b420801d", 6 | "url": "https://gitee.com/api/v5/repos/kit101/drone-yml-test/commits/e3c0ff4d5cef439ea11b30866fb1ed79b420801d" 7 | }, 8 | "protected": false, 9 | "protection_url": "https://gitee.com/api/v5/repos/kit101/drone-yml-test/branches/master/protection" 10 | } 11 | ] -------------------------------------------------------------------------------- /scm/driver/gitee/testdata/branches.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Name": "master", 4 | "Path": "refs/heads/master", 5 | "Sha": "e3c0ff4d5cef439ea11b30866fb1ed79b420801d" 6 | } 7 | ] -------------------------------------------------------------------------------- /scm/driver/gitee/testdata/changes.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Path": "rename.4.txt", 4 | "Added": false, 5 | "Renamed": true, 6 | "Deleted": false, 7 | "BlobID": "b748919728ba7080c9e41e2b888872b09d246d90" 8 | } 9 | ] -------------------------------------------------------------------------------- /scm/driver/gitee/testdata/commit.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Sha": "e3c0ff4d5cef439ea11b30866fb1ed79b420801d", 3 | "Message": "add/update/delete/rename\n", 4 | "Author": { 5 | "Name": "kit101", 6 | "Date": "2021-08-23T23:45:53+08:00", 7 | "Email": "qkssk1711@163.com", 8 | "Login": "kit101", 9 | "Avatar": "https://portrait.gitee.com/uploads/avatars/user/511/1535738_qkssk1711_1578953939.png" 10 | }, 11 | "Committer": { 12 | "Name": "kit101", 13 | "Date": "2021-08-23T23:45:53+08:00", 14 | "Email": "qkssk1711@163.com", 15 | "Login": "kit101", 16 | "Avatar": "https://portrait.gitee.com/uploads/avatars/user/511/1535738_qkssk1711_1578953939.png" 17 | }, 18 | "Link": "https://gitee.com/kit101/drone-yml-test/commit/e3c0ff4d5cef439ea11b30866fb1ed79b420801d" 19 | } -------------------------------------------------------------------------------- /scm/driver/gitee/testdata/compare.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Path": "feat-compare.txt", 4 | "Added": true, 5 | "Renamed": false, 6 | "Deleted": false, 7 | "BlobID": "b3a3b1dc93cb4323ef918aa742227356e91ddf1e" 8 | } 9 | ] 10 | -------------------------------------------------------------------------------- /scm/driver/gitee/testdata/content.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "file", 3 | "encoding": "base64", 4 | "size": 22, 5 | "name": "README.md", 6 | "path": "README.md", 7 | "content": "IyBkcm9uZS15bWwtdGVzdAoKdGVzdA==", 8 | "sha": "1563ebda9da15e6a7753431774920c62b168e5bb", 9 | "url": "https://gitee.com/api/v5/repos/kit101/drone-yml-test/contents/README.md", 10 | "html_url": "https://gitee.com/kit101/drone-yml-test/blob/d295a4c616d46fbcdfa3dfd1473c1337a1ec6f83/README.md", 11 | "download_url": "https://gitee.com/kit101/drone-yml-test/raw/d295a4c616d46fbcdfa3dfd1473c1337a1ec6f83/README.md", 12 | "_links": { 13 | "self": "https://gitee.com/api/v5/repos/kit101/drone-yml-test/contents/README.md", 14 | "html": "https://gitee.com/kit101/drone-yml-test/blob/d295a4c616d46fbcdfa3dfd1473c1337a1ec6f83/README.md" 15 | } 16 | } -------------------------------------------------------------------------------- /scm/driver/gitee/testdata/content.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Path": "README.md", 3 | "Data": "IyBkcm9uZS15bWwtdGVzdAoKdGVzdA==", 4 | "Sha": "1563ebda9da15e6a7753431774920c62b168e5bb" 5 | } -------------------------------------------------------------------------------- /scm/driver/gitee/testdata/content_delete.json: -------------------------------------------------------------------------------- 1 | { 2 | "content": null, 3 | "commit": { 4 | "sha": "bdce92fc3e96f54d7e918c7f2b6e61053366da5e", 5 | "author": { 6 | "name": "kit101", 7 | "date": "2021-08-17T15:49:36+00:00", 8 | "email": "kit101@gitee.com" 9 | }, 10 | "committer": { 11 | "name": "Gitee", 12 | "date": "2021-08-17T15:49:36+00:00", 13 | "email": "noreply@gitee.com" 14 | }, 15 | "message": "delete commit message", 16 | "tree": { 17 | "sha": "4de6efba7063724cb20ab9135be309db0477c186", 18 | "url": "https://gitee.com/api/v5/repos/kit101/drone-yml-test/git/trees/4de6efba7063724cb20ab9135be309db0477c186" 19 | }, 20 | "parents": [ 21 | { 22 | "sha": "56b7c68eea99df8469f819fca08ca71c2d942d8d", 23 | "url": "https://gitee.com/api/v5/repos/kit101/drone-yml-test/commits/56b7c68eea99df8469f819fca08ca71c2d942d8d" 24 | } 25 | ] 26 | } 27 | } -------------------------------------------------------------------------------- /scm/driver/gitee/testdata/content_list.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "kind": "file", 4 | "path": "apitest/CreateByDroneGiteeProvider.md" 5 | }, 6 | { 7 | "kind": "file", 8 | "path": "apitest/UpdateByDroneGiteeProvider.md" 9 | }, 10 | { 11 | "kind": "directory", 12 | "path": "apitest/newdir" 13 | } 14 | ] -------------------------------------------------------------------------------- /scm/driver/gitee/testdata/error.json: -------------------------------------------------------------------------------- 1 | { 2 | "message": "404 Project Not Found" 3 | } -------------------------------------------------------------------------------- /scm/driver/gitee/testdata/hook.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": 787341, 3 | "url": "http://test.kit101.com/webhook", 4 | "created_at": "2021-10-07T10:27:26+08:00", 5 | "password": "123asdas123", 6 | "project_id": 14836026, 7 | "result": "\u003Chtml\u003E \u003Chead\u003E\u003Ctitle\u003E403 Forbidden\u003C/title\u003E\u003C/head\u003E \u003Cbody\u003E \u003Ccenter\u003E\u003Ch1\u003E403 Forbidden\u003C/h1\u003E\u003C/center\u003E \u003C/body\u003E \u003C/html\u003E", 8 | "result_code": 403, 9 | "push_events": true, 10 | "tag_push_events": true, 11 | "issues_events": true, 12 | "note_events": true, 13 | "merge_requests_events": true 14 | } -------------------------------------------------------------------------------- /scm/driver/gitee/testdata/hook.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "ID": "787341", 3 | "Name": "", 4 | "Target": "http://test.kit101.com/webhook", 5 | "Events": [ 6 | "push", 7 | "tag_push", 8 | "issues", 9 | "note", 10 | "merge_requests" 11 | ], 12 | "Active": true, 13 | "SkipVerify": true 14 | } -------------------------------------------------------------------------------- /scm/driver/gitee/testdata/hooks.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": 787341, 4 | "url": "http://test.kit101.com/webhook", 5 | "created_at": "2021-10-07T10:27:26+08:00", 6 | "password": "123asdas123", 7 | "project_id": 14836026, 8 | "result": "\u003Chtml\u003E \u003Chead\u003E\u003Ctitle\u003E403 Forbidden\u003C/title\u003E\u003C/head\u003E \u003Cbody\u003E \u003Ccenter\u003E\u003Ch1\u003E403 Forbidden\u003C/h1\u003E\u003C/center\u003E \u003C/body\u003E \u003C/html\u003E", 9 | "result_code": 403, 10 | "push_events": true, 11 | "tag_push_events": true, 12 | "issues_events": true, 13 | "note_events": true, 14 | "merge_requests_events": true 15 | } 16 | ] -------------------------------------------------------------------------------- /scm/driver/gitee/testdata/hooks.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "ID": "787341", 4 | "Name": "", 5 | "Target": "http://test.kit101.com/webhook", 6 | "Events": [ 7 | "push", 8 | "tag_push", 9 | "issues", 10 | "note", 11 | "merge_requests" 12 | ], 13 | "Active": true, 14 | "SkipVerify": true 15 | } 16 | ] -------------------------------------------------------------------------------- /scm/driver/gitee/testdata/issue.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Number": 735267685380, 3 | "Title": "test issue 1", 4 | "Body": "test issue 1", 5 | "Link": "https://gitee.com/kit101/drone-yml-test/issues/I4CD5P", 6 | "Labels": [ 7 | "feature" 8 | ], 9 | "Closed": false, 10 | "Author": { 11 | "Login": "kit101", 12 | "Avatar": "https://portrait.gitee.com/uploads/avatars/user/511/1535738_qkssk1711_1578953939.png" 13 | }, 14 | "Created": "2021-09-29T09:21:28+08:00", 15 | "Updated": "2021-09-29T09:55:42+08:00" 16 | } -------------------------------------------------------------------------------- /scm/driver/gitee/testdata/issue_comment.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "ID": 6877445, 3 | "Body": "it's ok.", 4 | "Author": { 5 | "Login": "kit101", 6 | "Avatar": "https://portrait.gitee.com/uploads/avatars/user/511/1535738_qkssk1711_1578953939.png" 7 | }, 8 | "Created": "2021-09-29T11:00:50+08:00", 9 | "Updated": "2021-09-29T11:00:50+08:00" 10 | } -------------------------------------------------------------------------------- /scm/driver/gitee/testdata/issue_comments.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "ID": 6877445, 4 | "Body": "it's ok.", 5 | "Author": { 6 | "Login": "kit101", 7 | "Avatar": "https://portrait.gitee.com/uploads/avatars/user/511/1535738_qkssk1711_1578953939.png" 8 | }, 9 | "Created": "2021-09-29T11:00:50+08:00", 10 | "Updated": "2021-09-29T11:00:50+08:00" 11 | } 12 | ] -------------------------------------------------------------------------------- /scm/driver/gitee/testdata/membership.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Active": true, 3 | "Role": 2 4 | } -------------------------------------------------------------------------------- /scm/driver/gitee/testdata/org.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": 8538153, 3 | "login": "kit101-personal", 4 | "name": "kit101-personal", 5 | "url": "https://gitee.com/api/v5/orgs/kit101-personal", 6 | "avatar_url": "https://portrait.gitee.com/uploads/avatars/namespace/2846/8538153_kit101-personal_1632964073.png?is_link=true", 7 | "repos_url": "https://gitee.com/api/v5/orgs/kit101-personal/repos", 8 | "events_url": "https://gitee.com/api/v5/orgs/kit101-personal/events", 9 | "members_url": "https://gitee.com/api/v5/orgs/kit101-personal/members{/member}", 10 | "description": "", 11 | "follow_count": 1 12 | } -------------------------------------------------------------------------------- /scm/driver/gitee/testdata/org.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Name": "kit101-personal", 3 | "Avatar": "https://portrait.gitee.com/uploads/avatars/namespace/2846/8538153_kit101-personal_1632964073.png?is_link=true" 4 | } -------------------------------------------------------------------------------- /scm/driver/gitee/testdata/orgs.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": 8538153, 4 | "login": "kit101-personal", 5 | "name": "kit101-personal", 6 | "url": "https://gitee.com/api/v5/orgs/kit101-personal", 7 | "avatar_url": "https://portrait.gitee.com/uploads/avatars/namespace/2846/8538153_kit101-personal_1632964073.png?is_link=true", 8 | "repos_url": "https://gitee.com/api/v5/orgs/kit101-personal/repos", 9 | "events_url": "https://gitee.com/api/v5/orgs/kit101-personal/events", 10 | "members_url": "https://gitee.com/api/v5/orgs/kit101-personal/members{/member}", 11 | "description": "", 12 | "follow_count": 1 13 | } 14 | ] 15 | -------------------------------------------------------------------------------- /scm/driver/gitee/testdata/orgs.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Name": "kit101-personal", 4 | "Avatar": "https://portrait.gitee.com/uploads/avatars/namespace/2846/8538153_kit101-personal_1632964073.png?is_link=true" 5 | } 6 | ] -------------------------------------------------------------------------------- /scm/driver/gitee/testdata/pr_comment.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "ID": 6922557, 3 | "Body": "test comment 1", 4 | "Author": { 5 | "Login": "kit101", 6 | "Name": "kit101", 7 | "Avatar": "https://portrait.gitee.com/uploads/avatars/user/511/1535738_qkssk1711_1578953939.png" 8 | }, 9 | "Created": "2021-10-07T09:26:45+08:00", 10 | "Updated": "2021-10-07T09:26:45+08:00" 11 | } -------------------------------------------------------------------------------- /scm/driver/gitee/testdata/pr_comments.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "ID": 6922557, 4 | "Body": "test comment 1", 5 | "Author": { 6 | "Login": "kit101", 7 | "Name": "kit101", 8 | "Avatar": "https://portrait.gitee.com/uploads/avatars/user/511/1535738_qkssk1711_1578953939.png" 9 | }, 10 | "Created": "2021-10-07T09:26:45+08:00", 11 | "Updated": "2021-10-07T09:26:45+08:00" 12 | } 13 | ] -------------------------------------------------------------------------------- /scm/driver/gitee/testdata/pr_commits.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Message": "add3\n", 4 | "Sha": "00b76e8abd51ae6a96318b3450944b32995f9158", 5 | "Link": "https://gitee.com/kit101/drone-yml-test/commits/00b76e8abd51ae6a96318b3450944b32995f9158", 6 | "Author": { 7 | "Name": "kit101", 8 | "Email": "qkssk1711@163.com", 9 | "Date": "2021-09-30T18:09:57+08:00", 10 | "Login": "kit101", 11 | "Avatar": "https://portrait.gitee.com/uploads/avatars/user/511/1535738_qkssk1711_1578953939.png" 12 | }, 13 | "Committer": { 14 | "Name": "kit101", 15 | "Email": "qkssk1711@163.com", 16 | "Date": "2021-09-30T18:09:57+08:00", 17 | "Login": "kit101", 18 | "Avatar": "https://portrait.gitee.com/uploads/avatars/user/511/1535738_qkssk1711_1578953939.png" 19 | } 20 | } 21 | ] -------------------------------------------------------------------------------- /scm/driver/gitee/testdata/pr_files.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "BlobID": "2eac1cac02c325058cf959725c45b0612d3e8177", 4 | "Path": "change/add.txt", 5 | "Added": false, 6 | "Renamed": false, 7 | "Deleted": true 8 | }, 9 | { 10 | "BlobID": "411db0d9e9072851383751c260dc1601840906e4", 11 | "Path": "change/add2.txt", 12 | "Added": true, 13 | "Renamed": false, 14 | "Deleted": false 15 | }, 16 | { 17 | "BlobID": "411db0d9e9072851383751c260dc1601840906e4", 18 | "Path": "change/modified.txt", 19 | "Added": false, 20 | "Renamed": false, 21 | "Deleted": false 22 | }, 23 | { 24 | "BlobID": "411db0d9e9072851383751c260dc1601840906e4", 25 | "Path": "change/rename.2.txt", 26 | "Added": false, 27 | "Renamed": true, 28 | "Deleted": false 29 | } 30 | ] -------------------------------------------------------------------------------- /scm/driver/gitee/testdata/repo.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "ID": "14836026", 3 | "Namespace": "kit101", 4 | "Name": "drone-yml-test", 5 | "Perm": { 6 | "Pull": true, 7 | "Push": true, 8 | "Admin": true 9 | }, 10 | "Branch": "master", 11 | "Private": false, 12 | "Clone": "https://gitee.com/kit101/drone-yml-test.git", 13 | "CloneSSH": "git@gitee.com:kit101/drone-yml-test.git", 14 | "Link": "https://gitee.com/kit101/drone-yml-test.git", 15 | "Created": "2021-03-24T11:24:34+08:00", 16 | "Updated": "2021-09-30T18:10:27+08:00" 17 | } -------------------------------------------------------------------------------- /scm/driver/gitee/testdata/repos.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "ID": "14836026", 4 | "Namespace": "kit101", 5 | "Name": "drone-yml-test", 6 | "Perm": { 7 | "Pull": true, 8 | "Push": true, 9 | "Admin": true 10 | }, 11 | "Branch": "master", 12 | "Private": false, 13 | "Clone": "https://gitee.com/kit101/drone-yml-test.git", 14 | "CloneSSH": "git@gitee.com:kit101/drone-yml-test.git", 15 | "Link": "https://gitee.com/kit101/drone-yml-test.git", 16 | "Created": "2021-03-24T11:24:34+08:00", 17 | "Updated": "2021-09-30T18:10:27+08:00" 18 | } 19 | ] -------------------------------------------------------------------------------- /scm/driver/gitee/testdata/tag.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "1.0", 3 | "message": "1.0", 4 | "commit": { 5 | "sha": "5e7876efb3468ff679410b82a72f7c002382d41e", 6 | "date": "2021-03-24T11:29:35+08:00" 7 | } 8 | } -------------------------------------------------------------------------------- /scm/driver/gitee/testdata/tag.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "name": "1.0", 3 | "Path": "refs/tags/1.0", 4 | "Sha": "5e7876efb3468ff679410b82a72f7c002382d41e" 5 | } -------------------------------------------------------------------------------- /scm/driver/gitee/testdata/tags.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "release-test", 4 | "message": "", 5 | "commit": { 6 | "sha": "25b13a79d771314d0075302178eb18aef79e80db", 7 | "date": "2021-08-17T16:01:03+00:00" 8 | } 9 | }, 10 | { 11 | "name": "1.1", 12 | "message": "1.1", 13 | "commit": { 14 | "sha": "5e7876efb3468ff679410b82a72f7c002382d41e", 15 | "date": "2021-03-24T11:29:35+08:00" 16 | } 17 | }, 18 | { 19 | "name": "1.0", 20 | "message": "1.0", 21 | "commit": { 22 | "sha": "5e7876efb3468ff679410b82a72f7c002382d41e", 23 | "date": "2021-03-24T11:29:35+08:00" 24 | } 25 | }, 26 | { 27 | "name": "1.2", 28 | "message": "", 29 | "commit": { 30 | "sha": "5e7876efb3468ff679410b82a72f7c002382d41e", 31 | "date": "2021-03-24T11:29:35+08:00" 32 | } 33 | } 34 | ] -------------------------------------------------------------------------------- /scm/driver/gitee/testdata/tags.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Name": "release-test", 4 | "Path": "refs/tags/release-test", 5 | "Sha": "25b13a79d771314d0075302178eb18aef79e80db" 6 | }, 7 | { 8 | "name": "1.1", 9 | "Path": "refs/tags/1.1", 10 | "Sha": "5e7876efb3468ff679410b82a72f7c002382d41e" 11 | }, 12 | { 13 | "name": "1.0", 14 | "Path": "refs/tags/1.0", 15 | "Sha": "5e7876efb3468ff679410b82a72f7c002382d41e" 16 | }, 17 | { 18 | "name": "1.2", 19 | "Path": "refs/tags/1.2", 20 | "Sha": "5e7876efb3468ff679410b82a72f7c002382d41e" 21 | } 22 | ] -------------------------------------------------------------------------------- /scm/driver/gitee/testdata/user.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Login": "kit101", 3 | "Name": "kit101", 4 | "Email": "qkssk1711@163.com", 5 | "Avatar": "https://portrait.gitee.com/uploads/avatars/user/511/1535738_qkssk1711_1578953939.png", 6 | "Created": "2017-09-15T11:34:30+08:00", 7 | "Updated": "2021-08-06T16:34:48+08:00" 8 | } -------------------------------------------------------------------------------- /scm/driver/gitee/testdata/webhooks/tag_create.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Action": "created", 3 | "Ref": { 4 | "Name": "1.3", 5 | "Sha": "aa9d11518a64dcd0d591a2a4eb35dfb4d91d49d5" 6 | }, 7 | "Repo": { 8 | "ID": "14836026", 9 | "Namespace": "kit101", 10 | "Name": "drone-yml-test", 11 | "Branch": "master", 12 | "Private": false, 13 | "Clone": "https://gitee.com/kit101/drone-yml-test.git", 14 | "CloneSSH": "git@gitee.com:kit101/drone-yml-test.git", 15 | "Link": "https://gitee.com/kit101/drone-yml-test", 16 | "Created": "2021-03-24T11:24:34+08:00", 17 | "Updated": "2021-10-08T16:01:12+08:00" 18 | }, 19 | "Sender": { 20 | "Avatar": "https://portrait.gitee.com/uploads/avatars/user/511/1535738_qkssk1711_1578953939.png", 21 | "Email": "qkssk1711@163.com", 22 | "Login": "kit101", 23 | "Name": "kit101" 24 | } 25 | } -------------------------------------------------------------------------------- /scm/driver/gitee/testdata/webhooks/tag_delete.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Action": "deleted", 3 | "Ref": { 4 | "Name": "1.3", 5 | "Sha": "" 6 | }, 7 | "Repo": { 8 | "ID": "14836026", 9 | "Namespace": "kit101", 10 | "Name": "drone-yml-test", 11 | "Branch": "master", 12 | "Private": false, 13 | "Clone": "https://gitee.com/kit101/drone-yml-test.git", 14 | "CloneSSH": "git@gitee.com:kit101/drone-yml-test.git", 15 | "Link": "https://gitee.com/kit101/drone-yml-test", 16 | "Created": "2021-03-24T11:24:34+08:00", 17 | "Updated": "2021-10-08T16:16:28+08:00" 18 | }, 19 | "Sender": { 20 | "Avatar": "https://portrait.gitee.com/uploads/avatars/user/511/1535738_qkssk1711_1578953939.png", 21 | "Email": "qkssk1711@163.com", 22 | "Login": "kit101", 23 | "Name": "kit101" 24 | } 25 | } -------------------------------------------------------------------------------- /scm/driver/github/integration/integration.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 Drone.IO Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package integration 6 | -------------------------------------------------------------------------------- /scm/driver/github/testdata/branch.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Name": "master", 3 | "Path": "refs/heads/master", 4 | "Sha": "7fd1a60b01f91b314f59955a4e4d4e80d8edf11d" 5 | } -------------------------------------------------------------------------------- /scm/driver/github/testdata/branch_create.json: -------------------------------------------------------------------------------- 1 | { 2 | "ref": "refs/heads/Hello", 3 | "node_id": "MDM6UmVmMzQ0NDI5MDA5OnJlZnMvaGVhZHMvSGVsbG8=", 4 | "url": "https://api.github.com/repos/tphoney/scm-test/git/refs/heads/Hello", 5 | "object": { 6 | "sha": "312797ba52425353dec56871a255e2a36fc96344", 7 | "type": "commit", 8 | "url": "https://api.github.com/repos/tphoney/scm-test/git/commits/312797ba52425353dec56871a255e2a36fc96344" 9 | } 10 | } -------------------------------------------------------------------------------- /scm/driver/github/testdata/branches.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "master", 4 | "commit": { 5 | "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e", 6 | "url": "https://api.github.com/repos/octocat/Hello-World/commits/c5b97d5ae6c19d5c5df71a34c7fbeeda2479ccbc" 7 | }, 8 | "protected": true, 9 | "protection_url": "https://api.github.com/repos/octocat/Hello-World/branches/master/protection" 10 | } 11 | ] -------------------------------------------------------------------------------- /scm/driver/github/testdata/branches.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Name": "master", 4 | "Path": "refs/heads/master", 5 | "Sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e" 6 | } 7 | ] -------------------------------------------------------------------------------- /scm/driver/github/testdata/changes.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Path": "file1.txt", 4 | "Added": true, 5 | "Renamed": false, 6 | "Deleted": false, 7 | "BlobID": "bbcd538c8e72b8c175046e27cc8f907076331401" 8 | } 9 | ] -------------------------------------------------------------------------------- /scm/driver/github/testdata/commit.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Sha": "7fd1a60b01f91b314f59955a4e4d4e80d8edf11d", 3 | "Message": "Merge pull request #6 from Spaceghost/patch-1\n\nNew line at end of file.", 4 | "Author": { 5 | "Name": "The Octocat", 6 | "Email": "octocat@nowhere.com", 7 | "Date": "2012-03-06T23:06:50Z", 8 | "Login": "octocat", 9 | "Avatar": "https://avatars3.githubusercontent.com/u/583231?v=4" 10 | }, 11 | "Committer": { 12 | "Name": "The Octocat", 13 | "Email": "octocat@nowhere.com", 14 | "Date": "2012-03-06T23:06:50Z", 15 | "Login": "octocat", 16 | "Avatar": "https://avatars3.githubusercontent.com/u/583231?v=4" 17 | }, 18 | "Link": "https://github.com/octocat/Hello-World/commit/7fd1a60b01f91b314f59955a4e4d4e80d8edf11d" 19 | } -------------------------------------------------------------------------------- /scm/driver/github/testdata/commits.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Sha": "7fd1a60b01f91b314f59955a4e4d4e80d8edf11d", 4 | "Message": "Merge pull request #6 from Spaceghost/patch-1\n\nNew line at end of file.", 5 | "Author": { 6 | "Name": "The Octocat", 7 | "Email": "octocat@nowhere.com", 8 | "Date": "2012-03-06T23:06:50Z", 9 | "Login": "octocat", 10 | "Avatar": "https://avatars3.githubusercontent.com/u/583231?v=4" 11 | }, 12 | "Committer": { 13 | "Name": "The Octocat", 14 | "Email": "octocat@nowhere.com", 15 | "Date": "2012-03-06T23:06:50Z", 16 | "Login": "octocat", 17 | "Avatar": "https://avatars3.githubusercontent.com/u/583231?v=4" 18 | }, 19 | "Link": "https://github.com/octocat/Hello-World/commit/7fd1a60b01f91b314f59955a4e4d4e80d8edf11d" 20 | } 21 | ] -------------------------------------------------------------------------------- /scm/driver/github/testdata/compare.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Path": "README", 4 | "Added": false, 5 | "Renamed": false, 6 | "Deleted": false, 7 | "BlobID": "980a0d5f19a64b4b30a87d4206aade58726b60e3" 8 | } 9 | ] 10 | -------------------------------------------------------------------------------- /scm/driver/github/testdata/content.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Path": "README", 3 | "Data": "SGVsbG8gV29ybGQhCg==", 4 | "BlobID": "980a0d5f19a64b4b30a87d4206aade58726b60e3" 5 | } -------------------------------------------------------------------------------- /scm/driver/github/testdata/content_update.json.fail: -------------------------------------------------------------------------------- 1 | { 2 | "message": "newfile does not match", 3 | "documentation_url": "https://docs.github.com/rest/reference/repos#create-or-update-file-contents" 4 | } -------------------------------------------------------------------------------- /scm/driver/github/testdata/deployment.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Number": 1, 3 | "State": 3, 4 | "Environment": "production", 5 | "EnvironmentURL": "", 6 | "Desc": "Deployment finished successfully.", 7 | "Target": "https://example.com/deployment/42/output" 8 | } 9 | -------------------------------------------------------------------------------- /scm/driver/github/testdata/emails.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "email": "octocat@github.com", 4 | "verified": true, 5 | "primary": true, 6 | "visibility": "public" 7 | } 8 | ] -------------------------------------------------------------------------------- /scm/driver/github/testdata/emails.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Value": "octocat@github.com", 4 | "verified": true, 5 | "primary": true 6 | } 7 | ] -------------------------------------------------------------------------------- /scm/driver/github/testdata/error.json: -------------------------------------------------------------------------------- 1 | { 2 | "message": "Not Found", 3 | "documentation_url": "https://developer.github.com/v3" 4 | } -------------------------------------------------------------------------------- /scm/driver/github/testdata/hook.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": 1, 3 | "url": "https://api.github.com/repos/octocat/Hello-World/hooks/1", 4 | "test_url": "https://api.github.com/repos/octocat/Hello-World/hooks/1/test", 5 | "ping_url": "https://api.github.com/repos/octocat/Hello-World/hooks/1/pings", 6 | "name": "web", 7 | "events": [ 8 | "push", 9 | "pull_request" 10 | ], 11 | "active": true, 12 | "config": { 13 | "url": "http://example.com/webhook", 14 | "content_type": "json" 15 | }, 16 | "updated_at": "2011-09-06T20:39:23Z", 17 | "created_at": "2011-09-06T17:26:27Z" 18 | } -------------------------------------------------------------------------------- /scm/driver/github/testdata/hook.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "ID": "1", 3 | "Name": "", 4 | "Target": "http://example.com/webhook", 5 | "Events": [ 6 | "push", 7 | "pull_request" 8 | ], 9 | "Active": true, 10 | "SkipVerify": false 11 | } -------------------------------------------------------------------------------- /scm/driver/github/testdata/hooks.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": 1, 4 | "url": "https://api.github.com/repos/octocat/Hello-World/hooks/1", 5 | "test_url": "https://api.github.com/repos/octocat/Hello-World/hooks/1/test", 6 | "ping_url": "https://api.github.com/repos/octocat/Hello-World/hooks/1/pings", 7 | "name": "web", 8 | "events": [ 9 | "push", 10 | "pull_request" 11 | ], 12 | "active": true, 13 | "config": { 14 | "url": "http://example.com/webhook", 15 | "content_type": "json" 16 | }, 17 | "updated_at": "2011-09-06T20:39:23Z", 18 | "created_at": "2011-09-06T17:26:27Z" 19 | } 20 | ] -------------------------------------------------------------------------------- /scm/driver/github/testdata/hooks.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "ID": "1", 4 | "Name": "", 5 | "Target": "http://example.com/webhook", 6 | "Events": [ 7 | "push", 8 | "pull_request" 9 | ], 10 | "Active": true, 11 | "SkipVerify": false 12 | } 13 | ] -------------------------------------------------------------------------------- /scm/driver/github/testdata/issue.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Number": 1347, 3 | "Title": "Found a bug", 4 | "Body": "I'm having a problem with this.", 5 | "Link": "https://github.com/octocat/Hello-World/issues/1347", 6 | "Labels": [ 7 | "bug" 8 | ], 9 | "Closed": false, 10 | "Locked": false, 11 | "Author": { 12 | "Login": "octocat", 13 | "Name": "", 14 | "Email": "", 15 | "Avatar": "https://github.com/images/error/octocat_happy.gif" 16 | }, 17 | "Created": "2011-04-22T13:33:48Z", 18 | "Updated": "2011-04-22T13:33:48Z", 19 | "PullRequest": { 20 | "Link": "https://github.com/octocat/Hello-World/pull/1347", 21 | "Diff": "https://github.com/octocat/Hello-World/pull/1347.diff" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /scm/driver/github/testdata/issue_comment.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "ID": 1, 3 | "Body": "Me too", 4 | "Author": { 5 | "Login": "octocat", 6 | "Name": "", 7 | "Email": "", 8 | "Avatar": "https://github.com/images/error/octocat_happy.gif" 9 | }, 10 | "Created": "2011-04-14T16:00:49Z", 11 | "Updated": "2011-04-14T16:00:49Z" 12 | } -------------------------------------------------------------------------------- /scm/driver/github/testdata/issue_comments.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "ID": 1, 4 | "Body": "Me too", 5 | "Author": { 6 | "Login": "octocat", 7 | "Name": "", 8 | "Email": "", 9 | "Avatar": "https://github.com/images/error/octocat_happy.gif" 10 | }, 11 | "Created": "2011-04-14T16:00:49Z", 12 | "Updated": "2011-04-14T16:00:49Z" 13 | } 14 | ] -------------------------------------------------------------------------------- /scm/driver/github/testdata/issues.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Number": 1347, 4 | "Title": "Found a bug", 5 | "Body": "I'm having a problem with this.", 6 | "Link": "https://github.com/octocat/Hello-World/issues/1347", 7 | "Labels": [ 8 | "bug" 9 | ], 10 | "Closed": false, 11 | "Locked": false, 12 | "Author": { 13 | "Login": "octocat", 14 | "Name": "", 15 | "Email": "", 16 | "Avatar": "https://github.com/images/error/octocat_happy.gif" 17 | }, 18 | "Created": "2011-04-22T13:33:48Z", 19 | "Updated": "2011-04-22T13:33:48Z", 20 | "PullRequest": { 21 | "Link": "https://github.com/octocat/Hello-World/pull/1347", 22 | "Diff": "https://github.com/octocat/Hello-World/pull/1347.diff" 23 | } 24 | } 25 | ] -------------------------------------------------------------------------------- /scm/driver/github/testdata/membership.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Active": true, 3 | "Role": 2 4 | } -------------------------------------------------------------------------------- /scm/driver/github/testdata/milestone.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Link": "https://github.com/octocat/Hello-World/milestones/v1.0", 3 | "ID": 1002604, 4 | "Number": 1, 5 | "State": "open", 6 | "Title": "v1.0", 7 | "Description": "Tracking milestone for version 1.0", 8 | "DueDate": "2012-10-09T23:39:01Z" 9 | } 10 | -------------------------------------------------------------------------------- /scm/driver/github/testdata/milestone_create.json: -------------------------------------------------------------------------------- 1 | { 2 | "state": "open", 3 | "title": "v1.0", 4 | "description": "Tracking milestone for version 1.0", 5 | "due_on": "2012-10-09T23:39:01Z" 6 | } 7 | -------------------------------------------------------------------------------- /scm/driver/github/testdata/milestones.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Link": "https://github.com/octocat/Hello-World/milestones/v1.0", 4 | "ID": 1002604, 5 | "Number": 1, 6 | "State": "open", 7 | "Title": "v1.0", 8 | "Description": "Tracking milestone for version 1.0", 9 | "DueDate": "2012-10-09T23:39:01Z" 10 | } 11 | ] 12 | -------------------------------------------------------------------------------- /scm/driver/github/testdata/org.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Name": "github", 3 | "Avatar": "https://github.com/images/error/octocat_happy.gif" 4 | } -------------------------------------------------------------------------------- /scm/driver/github/testdata/orgs.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "login": "github", 4 | "id": 1, 5 | "url": "https://api.github.com/orgs/github", 6 | "repos_url": "https://api.github.com/orgs/github/repos", 7 | "events_url": "https://api.github.com/orgs/github/events", 8 | "hooks_url": "https://api.github.com/orgs/github/hooks", 9 | "issues_url": "https://api.github.com/orgs/github/issues", 10 | "members_url": "https://api.github.com/orgs/github/members{/member}", 11 | "public_members_url": "https://api.github.com/orgs/github/public_members{/member}", 12 | "avatar_url": "https://github.com/images/error/octocat_happy.gif", 13 | "description": "A great organization" 14 | } 15 | ] 16 | -------------------------------------------------------------------------------- /scm/driver/github/testdata/orgs.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Name": "github", 4 | "Avatar": "https://github.com/images/error/octocat_happy.gif" 5 | } 6 | ] -------------------------------------------------------------------------------- /scm/driver/github/testdata/pr_comment.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "ID": 10, 3 | "Body": "Great stuff", 4 | "Path": "file1.txt", 5 | "Sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e", 6 | "Line": 1, 7 | "Link": "", 8 | "Author": { 9 | "Login": "octocat", 10 | "Name": "", 11 | "Email": "", 12 | "Avatar": "https://github.com/images/error/octocat_happy.gif" 13 | }, 14 | "Created": "2011-04-14T16:00:49Z", 15 | "Updated": "2011-04-14T16:00:49Z" 16 | } -------------------------------------------------------------------------------- /scm/driver/github/testdata/pr_comments.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "ID": 10, 4 | "Body": "Great stuff", 5 | "Path": "file1.txt", 6 | "Sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e", 7 | "Line": 1, 8 | "Link": "", 9 | "Author": { 10 | "Login": "octocat", 11 | "Name": "", 12 | "Email": "", 13 | "Avatar": "https://github.com/images/error/octocat_happy.gif" 14 | }, 15 | "Created": "2011-04-14T16:00:49Z", 16 | "Updated": "2011-04-14T16:00:49Z" 17 | } 18 | ] -------------------------------------------------------------------------------- /scm/driver/github/testdata/release.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "ID": 1, 3 | "Title": "v1.0.0", 4 | "Description": "Description of the release", 5 | "Link": "https://github.com/octocat/Hello-World/releases/v1.0.0", 6 | "Tag": "v1.0.0", 7 | "Commitish": "master", 8 | "Draft": false, 9 | "Prerelease": false, 10 | "Created": "2013-02-27T19:35:32Z", 11 | "Published": "2013-02-27T19:35:32Z" 12 | } -------------------------------------------------------------------------------- /scm/driver/github/testdata/releases.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "ID": 1, 4 | "Title": "v1.0.0", 5 | "Description": "Description of the release", 6 | "Link": "https://github.com/octocat/Hello-World/releases/v1.0.0", 7 | "Tag": "v1.0.0", 8 | "Commitish": "master", 9 | "Draft": false, 10 | "Prerelease": false, 11 | "Created": "2013-02-27T19:35:32Z", 12 | "Published": "2013-02-27T19:35:32Z" 13 | } 14 | ] -------------------------------------------------------------------------------- /scm/driver/github/testdata/repo.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "ID": "1296269", 3 | "Namespace": "octocat", 4 | "Name": "Hello-World", 5 | "Perm": { 6 | "Pull": true, 7 | "Push": true, 8 | "Admin": true 9 | }, 10 | "Branch": "master", 11 | "Private": true, 12 | "Archived": true, 13 | "Visibility": 1, 14 | "Clone": "https://github.com/octocat/Hello-World.git", 15 | "CloneSSH": "git@github.com:octocat/Hello-World.git", 16 | "Link": "https://github.com/octocat/Hello-World", 17 | "Created": "2011-01-26T19:01:12Z", 18 | "Updated": "2011-01-26T19:14:43Z" 19 | } -------------------------------------------------------------------------------- /scm/driver/github/testdata/repos.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "ID": "1296269", 4 | "Namespace": "octocat", 5 | "Name": "Hello-World", 6 | "Perm": { 7 | "Pull": true, 8 | "Push": true, 9 | "Admin": true 10 | }, 11 | "Branch": "master", 12 | "Private": true, 13 | "Visibility": 1, 14 | "Clone": "https://github.com/octocat/Hello-World.git", 15 | "CloneSSH": "git@github.com:octocat/Hello-World.git", 16 | "Link": "https://github.com/octocat/Hello-World", 17 | "Created": "2011-01-26T19:01:12Z", 18 | "Updated": "2011-01-26T19:14:43Z" 19 | } 20 | ] -------------------------------------------------------------------------------- /scm/driver/github/testdata/repos_filter.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "ID": "508719340", 4 | "Namespace": "user123", 5 | "Name": "testRepo2", 6 | "Perm": { 7 | "Pull": false, 8 | "Push": false, 9 | "Admin": false 10 | }, 11 | "Branch": "main", 12 | "Private": false, 13 | "Visibility": 1, 14 | "Clone": "https://github.com/user123/testRepo2.git", 15 | "CloneSSH": "git@github.com:user123/testRepo2.git", 16 | "Link": "https://github.com/user123/testRepo2", 17 | "Created": "2022-06-29T14:11:36Z", 18 | "Updated": "2023-06-27T07:10:05Z" 19 | } 20 | ] -------------------------------------------------------------------------------- /scm/driver/github/testdata/status.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "State": 3, 3 | "Label": "continuous-integration/drone", 4 | "Desc": "Build has completed successfully", 5 | "Target": "https://ci.example.com/1000/output" 6 | } -------------------------------------------------------------------------------- /scm/driver/github/testdata/statuses.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "State": 3, 4 | "Label": "continuous-integration/drone", 5 | "Desc": "Build has completed successfully", 6 | "Target": "https://ci.example.com/1000/output" 7 | } 8 | ] -------------------------------------------------------------------------------- /scm/driver/github/testdata/tag.json: -------------------------------------------------------------------------------- 1 | { 2 | "ref": "refs/tags/v0.1", 3 | "node_id": "MDY6Q29tbWl0MTI5NjI2OTo3ZmQxYTYwYjAxZjkxYjMxNGY1OTk1NWE0ZTRkNGU4MGQ4ZWRmMTFk", 4 | "url": "https://api.github.com/repos/octocat/Hello-World/git/refs/tags/v0.1", 5 | "object": { 6 | "sha": "7fd1a60b01f91b314f59955a4e4d4e80d8edf11d", 7 | "type": "commit", 8 | "url": "https://api.github.com/repos/octocat/Hello-World/git/commits/7fd1a60b01f91b314f59955a4e4d4e80d8edf11d" 9 | } 10 | } -------------------------------------------------------------------------------- /scm/driver/github/testdata/tag.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Name": "v0.1", 3 | "Path": "refs/tags/v0.1", 4 | "Sha": "7fd1a60b01f91b314f59955a4e4d4e80d8edf11d" 5 | } -------------------------------------------------------------------------------- /scm/driver/github/testdata/tags.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "ref": "refs/tags/v1", 4 | "node_id": "REF_kwDOGvVo46xyZWZzL3RhZ3MvdjE", 5 | "url": "https://api.github.com/repos/vitsafronovici/myrepo/git/refs/tags/v1", 6 | "object": { 7 | "sha": "85fd27bdfd87b962d1ed4a742613cbfacd5c3743", 8 | "type": "tag", 9 | "url": "https://api.github.com/repos/vitsafronovici/myrepo/git/tags/85fd27bdfd87b962d1ed4a742613cbfacd5c3743" 10 | } 11 | } 12 | ] -------------------------------------------------------------------------------- /scm/driver/github/testdata/tags.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Name": "v1", 4 | "Path": "refs/tags/v1", 5 | "Sha": "85fd27bdfd87b962d1ed4a742613cbfacd5c3743" 6 | } 7 | ] -------------------------------------------------------------------------------- /scm/driver/github/testdata/user.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Login": "octocat", 3 | "Name": "monalisa octocat", 4 | "Email": "octocat@github.com", 5 | "Avatar": "https://github.com/images/error/octocat_happy.gif", 6 | "Created": "2008-01-14T04:33:35Z", 7 | "Updated": "2008-01-14T04:33:35Z" 8 | } -------------------------------------------------------------------------------- /scm/driver/github/testdata/webhooks/branch_create.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Ref": { 3 | "Name": "feature-branch", 4 | "Sha": "" 5 | }, 6 | "Repo": { 7 | "ID": "13933572", 8 | "Namespace": "bradrydzewski", 9 | "Name": "drone-test-go", 10 | "Perm": null, 11 | "Branch": "master", 12 | "Private": true, 13 | "Clone": "https://github.com/bradrydzewski/drone-test-go.git", 14 | "CloneSSH": "git@github.com:bradrydzewski/drone-test-go.git", 15 | "Link": "https://github.com/bradrydzewski/drone-test-go", 16 | "Created": "0001-01-01T00:00:00Z", 17 | "Updated": "0001-01-01T00:00:00Z" 18 | }, 19 | "Action": "created", 20 | "Sender": { 21 | "Login": "bradrydzewski", 22 | "Name": "", 23 | "Email": "", 24 | "Avatar": "https://avatars1.githubusercontent.com/u/817538?v=4" 25 | } 26 | } -------------------------------------------------------------------------------- /scm/driver/github/testdata/webhooks/branch_delete.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Ref": { 3 | "Name": "feature-branch", 4 | "Sha": "" 5 | }, 6 | "Repo": { 7 | "ID": "13933572", 8 | "Namespace": "bradrydzewski", 9 | "Name": "drone-test-go", 10 | "Perm": null, 11 | "Branch": "master", 12 | "Private": true, 13 | "Clone": "https://github.com/bradrydzewski/drone-test-go.git", 14 | "CloneSSH": "git@github.com:bradrydzewski/drone-test-go.git", 15 | "Link": "https://github.com/bradrydzewski/drone-test-go", 16 | "Created": "0001-01-01T00:00:00Z", 17 | "Updated": "0001-01-01T00:00:00Z" 18 | }, 19 | "Action": "deleted", 20 | "Sender": { 21 | "Login": "bradrydzewski", 22 | "Name": "", 23 | "Email": "", 24 | "Avatar": "https://avatars1.githubusercontent.com/u/817538?v=4" 25 | } 26 | } -------------------------------------------------------------------------------- /scm/driver/github/testdata/webhooks/tag_create.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Ref": { 3 | "Name": "v0.0.1", 4 | "Sha": "" 5 | }, 6 | "Repo": { 7 | "ID": "13933572", 8 | "Namespace": "bradrydzewski", 9 | "Name": "drone-test-go", 10 | "Perm": null, 11 | "Branch": "master", 12 | "Private": true, 13 | "Visibility": 3, 14 | "Clone": "https://github.com/bradrydzewski/drone-test-go.git", 15 | "CloneSSH": "git@github.com:bradrydzewski/drone-test-go.git", 16 | "Link": "https://github.com/bradrydzewski/drone-test-go", 17 | "Created": "0001-01-01T00:00:00Z", 18 | "Updated": "0001-01-01T00:00:00Z" 19 | }, 20 | "Action": "created", 21 | "Sender": { 22 | "Login": "bradrydzewski", 23 | "Name": "", 24 | "Email": "", 25 | "Avatar": "https://avatars1.githubusercontent.com/u/817538?v=4" 26 | } 27 | } -------------------------------------------------------------------------------- /scm/driver/github/testdata/webhooks/tag_delete.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Ref": { 3 | "Name": "v0.0.1", 4 | "Sha": "" 5 | }, 6 | "Repo": { 7 | "ID": "13933572", 8 | "Namespace": "bradrydzewski", 9 | "Name": "drone-test-go", 10 | "Perm": null, 11 | "Branch": "master", 12 | "Private": true, 13 | "Visibility": 2, 14 | "Clone": "https://github.com/bradrydzewski/drone-test-go.git", 15 | "CloneSSH": "git@github.com:bradrydzewski/drone-test-go.git", 16 | "Link": "https://github.com/bradrydzewski/drone-test-go", 17 | "Created": "0001-01-01T00:00:00Z", 18 | "Updated": "0001-01-01T00:00:00Z" 19 | }, 20 | "Action": "deleted", 21 | "Sender": { 22 | "Login": "bradrydzewski", 23 | "Name": "", 24 | "Email": "", 25 | "Avatar": "https://avatars1.githubusercontent.com/u/817538?v=4" 26 | } 27 | } -------------------------------------------------------------------------------- /scm/driver/gitlab/integration/integration.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 Drone.IO Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package integration 6 | -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/branch.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "master", 3 | "merged": false, 4 | "protected": true, 5 | "developers_can_push": false, 6 | "developers_can_merge": false, 7 | "commit": { 8 | "author_email": "john@example.com", 9 | "author_name": "John Smith", 10 | "authored_date": "2012-06-27T05:51:39-07:00", 11 | "committed_date": "2012-06-28T03:44:20-07:00", 12 | "committer_email": "john@example.com", 13 | "committer_name": "John Smith", 14 | "id": "7b5c3cc8be40ee161ae89a06bba6229da1032a0c", 15 | "short_id": "7b5c3cc", 16 | "title": "add projects API", 17 | "message": "add projects API", 18 | "parent_ids": [ 19 | "4ad91d3c1144c406e50c7b33bae684bd6837faf8" 20 | ] 21 | } 22 | } -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/branch.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Name": "master", 3 | "Path": "refs/heads/master", 4 | "Sha": "7b5c3cc8be40ee161ae89a06bba6229da1032a0c" 5 | } -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/branches.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "master", 4 | "merged": false, 5 | "protected": true, 6 | "developers_can_push": false, 7 | "developers_can_merge": false, 8 | "commit": { 9 | "author_email": "john@example.com", 10 | "author_name": "John Smith", 11 | "authored_date": "2012-06-27T05:51:39-07:00", 12 | "committed_date": "2012-06-28T03:44:20-07:00", 13 | "committer_email": "john@example.com", 14 | "committer_name": "John Smith", 15 | "id": "7b5c3cc8be40ee161ae89a06bba6229da1032a0c", 16 | "short_id": "7b5c3cc", 17 | "title": "add projects API", 18 | "message": "add projects API", 19 | "parent_ids": [ 20 | "4ad91d3c1144c406e50c7b33bae684bd6837faf8" 21 | ] 22 | } 23 | } 24 | ] -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/branches.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Name": "master", 4 | "Path": "refs/heads/master", 5 | "Sha": "7b5c3cc8be40ee161ae89a06bba6229da1032a0c" 6 | } 7 | ] -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/branches_filter.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Name": "master", 4 | "Path": "refs/heads/master", 5 | "Sha": "7b5c3cc8be40ee161ae89a06bba6229da1032a0c" 6 | }, 7 | { 8 | "Name": "master-patch", 9 | "Path": "refs/heads/master-patch", 10 | "Sha": "7b5c3cc8be40ee161ae89a06bba6229da1032a0d" 11 | } 12 | ] -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/commit.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "6104942438c14ec7bd21c6cd5bd995272b3faff6", 3 | "short_id": "6104942438c", 4 | "title": "Sanitize for network graph", 5 | "author_name": "randx", 6 | "author_email": "dmitriy.zaporozhets@gmail.com", 7 | "committer_name": "Dmitriy", 8 | "committer_email": "dmitriy.zaporozhets@gmail.com", 9 | "created_at": "2012-06-28T03:44:20-07:00", 10 | "message": "Sanitize for network graph", 11 | "committed_date": "2012-06-28T03:44:20-07:00", 12 | "authored_date": "2012-06-28T03:44:20-07:00", 13 | "parent_ids": [ 14 | "ae1d9fb46aa2b07ee9836d49862ec4e2c46fbbba" 15 | ], 16 | "last_pipeline": { 17 | "id": 8, 18 | "ref": "master", 19 | "sha": "2dc6aa325a317eda67812f05600bdf0fcdc70ab0", 20 | "status": "created" 21 | }, 22 | "stats": { 23 | "additions": 15, 24 | "deletions": 10, 25 | "total": 25 26 | }, 27 | "status": "running" 28 | } -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/commit.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Sha": "6104942438c14ec7bd21c6cd5bd995272b3faff6", 3 | "Message": "Sanitize for network graph", 4 | "Author": { 5 | "Name": "randx", 6 | "Email": "dmitriy.zaporozhets@gmail.com", 7 | "Date": "2012-06-28T03:44:20-07:00", 8 | "Login": "randx", 9 | "Avatar": "" 10 | }, 11 | "Committer": { 12 | "Name": "Dmitriy", 13 | "Email": "dmitriy.zaporozhets@gmail.com", 14 | "Date": "2012-06-28T03:44:20-07:00", 15 | "Login": "Dmitriy", 16 | "Avatar": "" 17 | }, 18 | "Link": "" 19 | } -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/commit_diff.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "diff": "--- a/doc/update/5.4-to-6.0.md\n+++ b/doc/update/5.4-to-6.0.md\n@@ -71,6 +71,8 @@\n sudo -u git -H bundle exec rake migrate_keys RAILS_ENV=production\n sudo -u git -H bundle exec rake migrate_inline_notes RAILS_ENV=production\n \n+sudo -u git -H bundle exec rake gitlab:assets:compile RAILS_ENV=production\n+\n ```\n \n ### 6. Update config files", 4 | "new_path": "doc/update/5.4-to-6.0.md", 5 | "old_path": "doc/update/5.4-to-6.0.md", 6 | "a_mode": null, 7 | "b_mode": "100644", 8 | "new_file": true, 9 | "renamed_file": false, 10 | "deleted_file": false 11 | } 12 | ] -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/commit_diff.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Path": "doc/update/5.4-to-6.0.md", 4 | "Added": true, 5 | "Renamed": false, 6 | "Deleted": false 7 | } 8 | ] -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/commits.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": "6104942438c14ec7bd21c6cd5bd995272b3faff6", 4 | "short_id": "6104942438c", 5 | "title": "Sanitize for network graph", 6 | "author_name": "randx", 7 | "author_email": "dmitriy.zaporozhets@gmail.com", 8 | "authored_date": "2012-06-28T03:44:20-07:00", 9 | "committer_name": "Dmitriy", 10 | "committer_email": "dmitriy.zaporozhets@gmail.com", 11 | "committed_date": "2012-06-28T03:44:20-07:00", 12 | "created_at": "2012-09-20T09:06:12+03:00", 13 | "message": "Sanitize for network graph", 14 | "parent_ids": [ 15 | "ae1d9fb46aa2b07ee9836d49862ec4e2c46fbbba" 16 | ] 17 | } 18 | ] -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/commits.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Sha": "6104942438c14ec7bd21c6cd5bd995272b3faff6", 4 | "Message": "Sanitize for network graph", 5 | "Author": { 6 | "Name": "randx", 7 | "Email": "dmitriy.zaporozhets@gmail.com", 8 | "Date": "2012-06-28T03:44:20-07:00", 9 | "Login": "randx", 10 | "Avatar": "" 11 | }, 12 | "Committer": { 13 | "Name": "Dmitriy", 14 | "Email": "dmitriy.zaporozhets@gmail.com", 15 | "Date": "2012-06-28T03:44:20-07:00", 16 | "Login": "Dmitriy", 17 | "Avatar": "" 18 | }, 19 | "Link": "" 20 | } 21 | ] -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/compare.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Path": "doc/update/5.4-to-6.0.md", 4 | "Added": true, 5 | "Renamed": false, 6 | "Deleted": false 7 | } 8 | ] -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/content_create.json: -------------------------------------------------------------------------------- 1 | { 2 | "file_path": "app/project.rb", 3 | "branch": "master" 4 | } -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/content_update.json: -------------------------------------------------------------------------------- 1 | { 2 | "file_path": "app/project.rb", 3 | "branch": "master" 4 | } -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/content_update.json.fail: -------------------------------------------------------------------------------- 1 | { 2 | "message": "You are attempting to update a file that has changed since you started editing it." 3 | } -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/emails.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": 1, 4 | "email": "john@company.com", 5 | "confirmed_at": "2021-03-26T19:07:56.248Z" 6 | }, 7 | { 8 | "id": 3, 9 | "email": "jane@company.com", 10 | "confirmed_at": null 11 | } 12 | ] -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/emails.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Value": "john@company.com", 4 | "verified": true, 5 | "primary": false 6 | }, 7 | { 8 | "Value": "jane@company.com", 9 | "verified": false, 10 | "primary": false 11 | } 12 | ] -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/group.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Name": "twitter", 3 | "Avatar": "http://localhost:3000/uploads/group/avatar/1/twitter.jpg" 4 | } -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/groups.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": 1, 4 | "name": "Twitter", 5 | "path": "twitter", 6 | "description": "An interesting group", 7 | "visibility": "public", 8 | "lfs_enabled": true, 9 | "avatar_url": "http://localhost:3000/uploads/group/avatar/1/twitter.jpg", 10 | "web_url": "http://localhost:3000/groups/twitter", 11 | "request_access_enabled": false, 12 | "full_name": "Twitter", 13 | "full_path": "twitter", 14 | "parent_id": null 15 | } 16 | ] -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/groups.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Name": "twitter", 4 | "Avatar": "http://localhost:3000/uploads/group/avatar/1/twitter.jpg" 5 | } 6 | ] -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/hook.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": 1, 3 | "url": "http://example.com/hook", 4 | "project_id": 3, 5 | "push_events": true, 6 | "issues_events": true, 7 | "merge_requests_events": true, 8 | "tag_push_events": true, 9 | "note_events": true, 10 | "job_events": true, 11 | "pipeline_events": true, 12 | "wiki_page_events": true, 13 | "enable_ssl_verification": true, 14 | "created_at": "2012-10-12T17:04:47Z" 15 | } -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/hook.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "ID": "1", 3 | "Name": "", 4 | "Target": "http://example.com/hook", 5 | "Events": [ 6 | "issues", 7 | "tag", 8 | "push", 9 | "comment", 10 | "merge" 11 | ], 12 | "Active": true, 13 | "SkipVerify": false 14 | } -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/hook_skip_verification.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": 1, 3 | "url": "http://example.com/hook", 4 | "project_id": 3, 5 | "push_events": true, 6 | "issues_events": true, 7 | "merge_requests_events": true, 8 | "tag_push_events": true, 9 | "note_events": true, 10 | "job_events": true, 11 | "pipeline_events": true, 12 | "wiki_page_events": true, 13 | "enable_ssl_verification": false, 14 | "created_at": "2012-10-12T17:04:47Z" 15 | } -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/hook_skip_verification.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "ID": "1", 3 | "Name": "", 4 | "Target": "http://example.com/hook", 5 | "Events": [ 6 | "issues", 7 | "tag", 8 | "push", 9 | "comment", 10 | "merge" 11 | ], 12 | "Active": true, 13 | "SkipVerify": true 14 | } -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/hooks.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": 1, 4 | "url": "http://example.com/hook", 5 | "project_id": 3, 6 | "push_events": true, 7 | "issues_events": true, 8 | "merge_requests_events": true, 9 | "tag_push_events": true, 10 | "note_events": true, 11 | "job_events": true, 12 | "pipeline_events": true, 13 | "wiki_page_events": true, 14 | "enable_ssl_verification": true, 15 | "created_at": "2012-10-12T17:04:47Z" 16 | } 17 | ] -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/hooks.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "ID": "1", 4 | "Name": "", 5 | "Target": "http://example.com/hook", 6 | "Events": [ 7 | "issues", 8 | "tag", 9 | "push", 10 | "comment", 11 | "merge" 12 | ], 13 | "Active": true, 14 | "SkipVerify": false 15 | } 16 | ] -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/issue.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Number": 1, 3 | "Title": "Ut commodi ullam eos dolores perferendis nihil sunt.", 4 | "Body": "Omnis vero earum sunt corporis dolor et placeat.", 5 | "Link": "http://example.com/example/example/issues/1", 6 | "Labels": [], 7 | "Closed": true, 8 | "Locked": false, 9 | "Author": { 10 | "Login": "root", 11 | "Name": "Administrator", 12 | "Email": "", 13 | "Avatar": "" 14 | }, 15 | "Created": "2016-01-04T15:31:46.176Z", 16 | "Updated": "2016-01-04T15:31:46.176Z" 17 | } -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/issue_note.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": 302, 3 | "body": "closed", 4 | "attachment": null, 5 | "author": { 6 | "id": 1, 7 | "username": "pipin", 8 | "email": "admin@example.com", 9 | "name": "Pip", 10 | "state": "active", 11 | "created_at": "2013-09-30T13:46:01Z" 12 | }, 13 | "created_at": "2013-10-02T09:22:45Z", 14 | "updated_at": "2013-10-02T10:22:45Z", 15 | "system": true, 16 | "noteable_id": 377, 17 | "noteable_type": "Issue", 18 | "noteable_iid": 377 19 | } -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/issue_note.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "ID": 302, 3 | "Body": "closed", 4 | "Author": { 5 | "Login": "pipin", 6 | "Name": "Pip", 7 | "Email": "", 8 | "Avatar": "" 9 | }, 10 | "Created": "2013-10-02T09:22:45Z", 11 | "Updated": "2013-10-02T10:22:45Z" 12 | } -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/issue_notes.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": 302, 4 | "body": "closed", 5 | "attachment": null, 6 | "author": { 7 | "id": 1, 8 | "username": "pipin", 9 | "email": "admin@example.com", 10 | "name": "Pip", 11 | "state": "active", 12 | "created_at": "2013-09-30T13:46:01Z" 13 | }, 14 | "created_at": "2013-10-02T09:22:45Z", 15 | "updated_at": "2013-10-02T10:22:45Z", 16 | "system": true, 17 | "noteable_id": 377, 18 | "noteable_type": "Issue", 19 | "noteable_iid": 377 20 | } 21 | ] -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/issue_notes.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "ID": 302, 4 | "Body": "closed", 5 | "Author": { 6 | "Login": "pipin", 7 | "Name": "Pip", 8 | "Email": "", 9 | "Avatar": "" 10 | }, 11 | "Created": "2013-10-02T09:22:45Z", 12 | "Updated": "2013-10-02T10:22:45Z" 13 | } 14 | ] -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/issues.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Number": 1, 4 | "Title": "Ut commodi ullam eos dolores perferendis nihil sunt.", 5 | "Body": "Omnis vero earum sunt corporis dolor et placeat.", 6 | "Link": "http://example.com/example/example/issues/1", 7 | "Labels": [], 8 | "Closed": true, 9 | "Locked": false, 10 | "Author": { 11 | "Login": "root", 12 | "Name": "Administrator", 13 | "Email": "", 14 | "Avatar": "" 15 | }, 16 | "Created": "2016-01-04T15:31:46.176Z", 17 | "Updated": "2016-01-04T15:31:46.176Z" 18 | } 19 | ] -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/merge.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Number": 1, 3 | "Title": "JS fix", 4 | "Body": "Signed-off-by: Dmitriy Zaporozhets \u003cdmitriy.zaporozhets@gmail.com\u003e", 5 | "Sha": "12d65c8dd2b2676fa3ac47d955accc085a37a9c1", 6 | "Ref": "refs/merge-requests/1/head", 7 | "Source": "fix", 8 | "Target": "master", 9 | "Link": "https://gitlab.com/gitlab-org/testme/merge_requests/1", 10 | "Draft": false, 11 | "Closed": true, 12 | "Merged": false, 13 | "Author": { 14 | "Login": "dblessing", 15 | "Name": "Drew Blessing", 16 | "Email": "", 17 | "Avatar": "https://secure.gravatar.com/avatar/b5bf44866b4eeafa2d8114bfe15da02f?s=80\u0026d=identicon" 18 | }, 19 | "Created": "2015-12-18T18:29:53.563Z", 20 | "Updated": "2015-12-18T18:30:22.522Z", 21 | "Labels": [ 22 | { 23 | "name": "bug" 24 | }, 25 | { 26 | "name": "documentation" 27 | } 28 | ] 29 | } -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/merge_diff.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Path": "VERSION", 4 | "Added": false, 5 | "Renamed": false, 6 | "Deleted": false 7 | } 8 | ] -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/merge_note.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": 301, 3 | "body": "Comment for MR", 4 | "attachment": null, 5 | "author": { 6 | "id": 1, 7 | "username": "pipin", 8 | "email": "admin@example.com", 9 | "name": "Pip", 10 | "state": "active", 11 | "created_at": "2013-09-30T13:46:01Z" 12 | }, 13 | "created_at": "2013-10-02T08:57:14Z", 14 | "updated_at": "2013-10-02T08:57:14Z", 15 | "system": false, 16 | "noteable_id": 2, 17 | "noteable_type": "MergeRequest", 18 | "noteable_iid": 2 19 | } -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/merge_note.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "ID": 301, 3 | "Body": "Comment for MR", 4 | "Author": { 5 | "Login": "pipin", 6 | "Name": "Pip", 7 | "Email": "", 8 | "Avatar": "" 9 | }, 10 | "Created": "2013-10-02T08:57:14Z", 11 | "Updated": "2013-10-02T08:57:14Z" 12 | } -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/merge_notes.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": 301, 4 | "body": "Comment for MR", 5 | "attachment": null, 6 | "author": { 7 | "id": 1, 8 | "username": "pipin", 9 | "email": "admin@example.com", 10 | "name": "Pip", 11 | "state": "active", 12 | "created_at": "2013-09-30T13:46:01Z" 13 | }, 14 | "created_at": "2013-10-02T08:57:14Z", 15 | "updated_at": "2013-10-02T08:57:14Z", 16 | "system": false, 17 | "noteable_id": 2, 18 | "noteable_type": "MergeRequest", 19 | "noteable_iid": 2 20 | } 21 | ] -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/merge_notes.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "ID": 301, 4 | "Body": "Comment for MR", 5 | "Author": { 6 | "Login": "pipin", 7 | "Name": "Pip", 8 | "Email": "", 9 | "Avatar": "" 10 | }, 11 | "Created": "2013-10-02T08:57:14Z", 12 | "Updated": "2013-10-02T08:57:14Z" 13 | } 14 | ] -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/milestone.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": 12, 3 | "iid": 3, 4 | "project_id": 16, 5 | "title": "10.0", 6 | "description": "Version", 7 | "due_date": "2013-11-29", 8 | "start_date": "2013-11-10", 9 | "state": "active", 10 | "updated_at": "2013-10-02T09:24:18Z", 11 | "created_at": "2013-10-02T09:24:18Z", 12 | "expired": false 13 | } 14 | -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/milestone.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "ID": 12, 3 | "Number": 12, 4 | "Title": "10.0", 5 | "Description": "Version", 6 | "DueDate": "2013-11-29T00:00:00Z", 7 | "State": "active" 8 | } 9 | -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/milestone_create.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "v1.0", 3 | "description": "Tracking milestone for version 1.0", 4 | "due_date": "2012-10-09" 5 | } 6 | -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/milestone_update.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "v1.0", 3 | "description": "Tracking milestone for version 1.0", 4 | "state_event": "close", 5 | "due_date": "2012-10-09" 6 | } 7 | -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/milestones.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": 12, 4 | "iid": 3, 5 | "project_id": 16, 6 | "title": "10.0", 7 | "description": "Version", 8 | "due_date": "2013-11-29", 9 | "start_date": "2013-11-10", 10 | "state": "active", 11 | "updated_at": "2013-10-02T09:24:18Z", 12 | "created_at": "2013-10-02T09:24:18Z", 13 | "expired": false 14 | } 15 | ] 16 | -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/milestones.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "ID": 12, 4 | "Number": 12, 5 | "Title": "10.0", 6 | "Description": "Version", 7 | "DueDate": "2013-11-29T00:00:00Z", 8 | "State": "active" 9 | } 10 | ] 11 | -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/release.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "ID": 0, 3 | "Title": "Awesome app v0.1 alpha", 4 | "Description": "## CHANGELOG\r\n\r\n- Remove limit of 100 when searching repository code. !8671\r\n- Show error message when attempting to reopen an MR and there is an open MR for the same branch. !16447 (Akos Gyimesi)\r\n- Fix a bug where internal email pattern wasn't respected. !22516", 5 | "Link": "", 6 | "Tag": "v0.1", 7 | "Commitish": "f8d3d94cbd347e924aa7b715845e439d00e80ca4", 8 | "Draft": false, 9 | "Prerelease": false 10 | } 11 | -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/releases.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Title": "Awesome app v0.2 beta", 4 | "Description": "## CHANGELOG\r\n\r\n- Escape label and milestone titles to prevent XSS in GFM autocomplete. !2740\r\n- Prevent private snippets from being embeddable.\r\n- Add subresources removal to member destroy service.", 5 | "Tag": "v0.2", 6 | "Commitish": "079e90101242458910cccd35eab0e211dfc359c0" 7 | }, 8 | { 9 | "Title": "Awesome app v0.1 alpha", 10 | "Description": "## CHANGELOG\r\n\r\n-Remove limit of 100 when searching repository code. !8671\r\n- Show error message when attempting to reopen an MR and there is an open MR for the same branch. !16447 (Akos Gyimesi)\r\n- Fix a bug where internal email pattern wasn't respected. !22516", 11 | "Tag": "v0.1", 12 | "Commitish": "f8d3d94cbd347e924aa7b715845e439d00e80ca4" 13 | } 14 | ] 15 | -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/repo.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "ID": "178504", 3 | "Namespace": "diaspora", 4 | "Name": "diaspora", 5 | "Perm": { 6 | "Pull": true, 7 | "Push": false, 8 | "Admin": false 9 | }, 10 | "Branch": "master", 11 | "Private": false, 12 | "Visibility": 1, 13 | "Clone": "https://gitlab.com/diaspora/diaspora.git", 14 | "CloneSSH": "git@gitlab.com:diaspora/diaspora.git", 15 | "Link": "https://gitlab.com/diaspora/diaspora", 16 | "Created": "0001-01-01T00:00:00Z", 17 | "Updated": "0001-01-01T00:00:00Z" 18 | } -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/repos.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "ID": "178504", 4 | "Namespace": "diaspora", 5 | "Name": "diaspora", 6 | "Perm": { 7 | "Pull": true, 8 | "Push": false, 9 | "Admin": false 10 | }, 11 | "Branch": "master", 12 | "Private": false, 13 | "Visibility": 1, 14 | "Clone": "https://gitlab.com/diaspora/diaspora.git", 15 | "CloneSSH": "git@gitlab.com:diaspora/diaspora.git", 16 | "Link": "https://gitlab.com/diaspora/diaspora", 17 | "Created": "0001-01-01T00:00:00Z", 18 | "Updated": "0001-01-01T00:00:00Z" 19 | } 20 | ] -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/repos_filter.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "ID": "178504", 4 | "Namespace": "diaspora", 5 | "Name": "diaspora", 6 | "Perm": { 7 | "Pull": true, 8 | "Push": false, 9 | "Admin": false 10 | }, 11 | "Branch": "master", 12 | "Private": false, 13 | "Visibility": 1, 14 | "Clone": "https://gitlab.com/diaspora/diaspora.git", 15 | "CloneSSH": "git@gitlab.com:diaspora/diaspora.git", 16 | "Link": "https://gitlab.com/diaspora/diaspora", 17 | "Created": "0001-01-01T00:00:00Z", 18 | "Updated": "0001-01-01T00:00:00Z" 19 | } 20 | ] -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/status.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": { 3 | "web_url": "https://gitlab.example.com/thedude", 4 | "name": "Jeff Lebowski", 5 | "avatar_url": "https://gitlab.example.com/uploads/user/avatar/28/The-Big-Lebowski-400-400.png", 6 | "username": "thedude", 7 | "state": "active", 8 | "id": 28 9 | }, 10 | "name": "default", 11 | "sha": "18f3e63d05582537db6d183d9d557be09e1f90c8", 12 | "status": "pending", 13 | "coverage": 100.0, 14 | "description": "the dude abides", 15 | "id": 93, 16 | "target_url": "https://gitlab.example.com/thedude/gitlab-ce/builds/91", 17 | "ref": null, 18 | "started_at": null, 19 | "created_at": "2016-01-19T09:05:50.355Z", 20 | "allow_failure": false, 21 | "finished_at": "2016-01-19T09:05:50.365Z" 22 | } -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/status.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "State": 1, 3 | "Label": "default", 4 | "Desc": "the dude abides", 5 | "Target": "https://gitlab.example.com/thedude/gitlab-ce/builds/91" 6 | } -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/statuses.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "status": "pending", 4 | "created_at": "2016-01-19T08:40:25.934Z", 5 | "started_at": null, 6 | "name": "default", 7 | "allow_failure": true, 8 | "author": { 9 | "username": "thedude", 10 | "state": "active", 11 | "web_url": "https://gitlab.example.com/thedude", 12 | "avatar_url": "https://gitlab.example.com/uploads/user/avatar/28/The-Big-Lebowski-400-400.png", 13 | "id": 28, 14 | "name": "Jeff Lebowski" 15 | }, 16 | "description": "the dude abides", 17 | "sha": "18f3e63d05582537db6d183d9d557be09e1f90c8", 18 | "target_url": "https://gitlab.example.com/thedude/gitlab-ce/builds/91", 19 | "finished_at": null, 20 | "id": 91, 21 | "ref": "master" 22 | } 23 | ] -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/statuses.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "State": 1, 4 | "Label": "default", 5 | "Desc": "the dude abides", 6 | "Target": "https://gitlab.example.com/thedude/gitlab-ce/builds/91" 7 | } 8 | ] -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/subgroup.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "ID": "14264161", 3 | "Namespace": "gitlab-org/gitter", 4 | "Name": "gitter-demo-app", 5 | "Perm": { 6 | "Pull": true, 7 | "Push": false, 8 | "Admin": false 9 | }, 10 | "Branch": "master", 11 | "Private": false, 12 | "Clone": "https://gitlab.com/gitlab-org/gitter/gitter-demo-app.git", 13 | "CloneSSH": "git@gitlab.com:gitlab-org/gitter/gitter-demo-app.git", 14 | "Link": "https://gitlab.com/gitlab-org/gitter/gitter-demo-app", 15 | "Created": "0001-01-01T00:00:00Z", 16 | "Updated": "0001-01-01T00:00:00Z" 17 | } -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/tag.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "v1.0.0", 3 | "message": null, 4 | "commit": { 5 | "id": "2695effb5807a22ff3d138d593fd856244e155e7", 6 | "short_id": "2695effb", 7 | "title": "Initial commit", 8 | "created_at": "2017-07-26T11:08:53.000+02:00", 9 | "parent_ids": [ 10 | "2a4b78934375d7f53875269ffd4f45fd83a84ebe" 11 | ], 12 | "message": "v1.0.0\n", 13 | "author_name": "Arthur Verschaeve", 14 | "author_email": "contact@arthurverschaeve.be", 15 | "authored_date": "2015-02-01T21:56:31.000+01:00", 16 | "committer_name": "Arthur Verschaeve", 17 | "committer_email": "contact@arthurverschaeve.be", 18 | "committed_date": "2015-02-01T21:56:31.000+01:00" 19 | }, 20 | "release": null 21 | } -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/tag.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Name": "v1.0.0", 3 | "Path": "refs/tags/v1.0.0", 4 | "Sha": "2695effb5807a22ff3d138d593fd856244e155e7" 5 | } -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/tags.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Name": "v1.0.0", 4 | "Path": "refs/tags/v1.0.0", 5 | "Sha": "2695effb5807a22ff3d138d593fd856244e155e7" 6 | } 7 | ] -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/user.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Login": "john_smith", 3 | "Name": "John Smith", 4 | "Email": "john@example.com", 5 | "Avatar": "http://localhost:3000/uploads/user/avatar/1/index.jpg" 6 | } -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/user_search.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Login": "john_smith", 3 | "Name": "John Smith", 4 | "Email": "john@example.com", 5 | "Avatar": "http://localhost:3000/uploads/user/avatar/1/index.jpg" 6 | } -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/webhooks/branch_delete.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Ref": { 3 | "Name": "feature", 4 | "Sha": "c4c79227ed610f1151f05bbc5be33b4f340d39c8" 5 | }, 6 | "Repo": { 7 | "ID": "4861503", 8 | "Namespace": "gitlab-org", 9 | "Name": "hello-world", 10 | "Perm": null, 11 | "Branch": "master", 12 | "Private": false, 13 | "Clone": "https://gitlab.com/gitlab-org/hello-world.git", 14 | "CloneSSH": "git@gitlab.com:gitlab-org/hello-world.git", 15 | "Link": "https://gitlab.com/gitlab-org/hello-world", 16 | "Created": "0001-01-01T00:00:00Z", 17 | "Updated": "0001-01-01T00:00:00Z" 18 | }, 19 | "Action": "deleted", 20 | "Sender": { 21 | "Login": "sytses", 22 | "Name": "Sid Sijbrandij", 23 | "Email": "noreply@gitlab.com", 24 | "Avatar": "https://secure.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87?s=80&d=identicon" 25 | } 26 | } -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/webhooks/issue_closed.json.golden: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drone/go-scm/a515870a3931d01562ab61723891462134a3277f/scm/driver/gitlab/testdata/webhooks/issue_closed.json.golden -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/webhooks/issue_comment_create.json.golden: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drone/go-scm/a515870a3931d01562ab61723891462134a3277f/scm/driver/gitlab/testdata/webhooks/issue_comment_create.json.golden -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/webhooks/issue_create.json.golden: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drone/go-scm/a515870a3931d01562ab61723891462134a3277f/scm/driver/gitlab/testdata/webhooks/issue_create.json.golden -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/webhooks/issue_edited.json.golden: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drone/go-scm/a515870a3931d01562ab61723891462134a3277f/scm/driver/gitlab/testdata/webhooks/issue_edited.json.golden -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/webhooks/issue_labeled.json.golden: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drone/go-scm/a515870a3931d01562ab61723891462134a3277f/scm/driver/gitlab/testdata/webhooks/issue_labeled.json.golden -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/webhooks/issue_reopen.json.golden: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drone/go-scm/a515870a3931d01562ab61723891462134a3277f/scm/driver/gitlab/testdata/webhooks/issue_reopen.json.golden -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/webhooks/push_merge.json.golden: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drone/go-scm/a515870a3931d01562ab61723891462134a3277f/scm/driver/gitlab/testdata/webhooks/push_merge.json.golden -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/webhooks/review_comment_create.json.golden: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drone/go-scm/a515870a3931d01562ab61723891462134a3277f/scm/driver/gitlab/testdata/webhooks/review_comment_create.json.golden -------------------------------------------------------------------------------- /scm/driver/gitlab/testdata/webhooks/tag_delete.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Ref": { 3 | "Name": "v1.0.0", 4 | "Sha": "2adc9465c4edfc33834e173fe89436a7cb899a1d" 5 | }, 6 | "Repo": { 7 | "ID": "4861503", 8 | "Namespace": "gitlab-org", 9 | "Name": "hello-world", 10 | "Perm": null, 11 | "Branch": "master", 12 | "Private": false, 13 | "Clone": "https://gitlab.com/gitlab-org/hello-world.git", 14 | "CloneSSH": "git@gitlab.com:gitlab-org/hello-world.git", 15 | "Link": "https://gitlab.com/gitlab-org/hello-world", 16 | "Created": "0001-01-01T00:00:00Z", 17 | "Updated": "0001-01-01T00:00:00Z" 18 | }, 19 | "Action": "deleted", 20 | "Sender": { 21 | "Login": "sytses", 22 | "Name": "Sid Sijbrandij", 23 | "Email": "noreply@gitlab.com", 24 | "Avatar": "https://secure.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87?s=80\u0026d=identicon" 25 | } 26 | } -------------------------------------------------------------------------------- /scm/driver/gogs/testdata/branch.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "master", 3 | "commit": { 4 | "id": "f05f642b892d59a0a9ef6a31f6c905a24b5db13a", 5 | "message": "update README\n", 6 | "author": { 7 | "name": "Jane Doe", 8 | "email": "jane.doe@mail.com", 9 | "username": "janedoe" 10 | }, 11 | "committer": { 12 | "name": "Jane Doe", 13 | "email": "jane.doe@mail.com", 14 | "username": "janedoe" 15 | }, 16 | "added": null, 17 | "removed": null, 18 | "modified": null, 19 | "timestamp": "2017-11-16T22:06:53Z" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /scm/driver/gogs/testdata/branch.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Name": "master", 3 | "Path": "refs/heads/master", 4 | "Sha": "f05f642b892d59a0a9ef6a31f6c905a24b5db13a" 5 | } -------------------------------------------------------------------------------- /scm/driver/gogs/testdata/branches.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "master", 4 | "commit": { 5 | "id": "f05f642b892d59a0a9ef6a31f6c905a24b5db13a", 6 | "message": "update README\n", 7 | "author": { 8 | "name": "Jane Doe", 9 | "email": "jane.doe@mail.com", 10 | "username": "janedoe" 11 | }, 12 | "committer": { 13 | "name": "Jane Doe", 14 | "email": "jane.doe@mail.com", 15 | "username": "janedoe" 16 | }, 17 | "added": null, 18 | "removed": null, 19 | "modified": null, 20 | "timestamp": "2017-11-16T22:06:53Z" 21 | } 22 | } 23 | ] -------------------------------------------------------------------------------- /scm/driver/gogs/testdata/branches.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Name": "master", 4 | "Path": "refs/heads/master", 5 | "Sha": "f05f642b892d59a0a9ef6a31f6c905a24b5db13a" 6 | } 7 | ] -------------------------------------------------------------------------------- /scm/driver/gogs/testdata/comment.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": 74, 3 | "user": { 4 | "id": 1, 5 | "username": "unknwon", 6 | "full_name": "无闻", 7 | "email": "u@gogs.io", 8 | "avatar_url": "http://localhost:3000/avatars/1" 9 | }, 10 | "body": "what?", 11 | "created_at": "2016-08-26T11:58:18-07:00", 12 | "updated_at": "2016-08-26T11:58:18-07:00" 13 | } -------------------------------------------------------------------------------- /scm/driver/gogs/testdata/comment.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "ID": 74, 3 | "Body": "what?", 4 | "Author": { 5 | "Login": "unknwon", 6 | "Name": "无闻", 7 | "Email": "u@gogs.io", 8 | "Avatar": "http://localhost:3000/avatars/1" 9 | }, 10 | "Created": "2016-08-26T11:58:18-07:00", 11 | "Updated": "2016-08-26T11:58:18-07:00" 12 | } -------------------------------------------------------------------------------- /scm/driver/gogs/testdata/comments.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": 74, 4 | "user": { 5 | "id": 1, 6 | "username": "unknwon", 7 | "full_name": "无闻", 8 | "email": "u@gogs.io", 9 | "avatar_url": "http://localhost:3000/avatars/1" 10 | }, 11 | "body": "what?", 12 | "created_at": "2016-08-26T11:58:18-07:00", 13 | "updated_at": "2016-08-26T11:58:18-07:00" 14 | } 15 | ] -------------------------------------------------------------------------------- /scm/driver/gogs/testdata/comments.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "ID": 74, 4 | "Body": "what?", 5 | "Author": { 6 | "Login": "unknwon", 7 | "Name": "无闻", 8 | "Email": "u@gogs.io", 9 | "Avatar": "http://localhost:3000/avatars/1" 10 | }, 11 | "Created": "2016-08-26T11:58:18-07:00", 12 | "Updated": "2016-08-26T11:58:18-07:00" 13 | } 14 | ] -------------------------------------------------------------------------------- /scm/driver/gogs/testdata/commits.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "author": { 3 | "name": "Stephen Lane-Walsh", 4 | "email": "sdl.slane@gmail.com" 5 | }, 6 | "committer": { 7 | "name": "Unknwon", 8 | "login": "unknwon", 9 | "email": "u@gogs.io", 10 | "avatar": "https://secure.gravatar.com/avatar/d8b2871cdac01b57bbda23716cc03b96?d=identicon" 11 | }, 12 | "message": "conf/gitignore: add Unreal Engine (#5623)", 13 | "link": "https://try.gogs.io/api/v1/repos/gogs/gogs/commits/2c3e2b701e012294d457937e6bfbffd63dd8ae4f", 14 | "sha": "2c3e2b701e012294d457937e6bfbffd63dd8ae4f" 15 | } 16 | -------------------------------------------------------------------------------- /scm/driver/gogs/testdata/hook.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": 20, 3 | "type": "gogs", 4 | "config": { 5 | "content_type": "json", 6 | "url": "http://gogs.io" 7 | }, 8 | "events": [ 9 | "create", 10 | "push" 11 | ], 12 | "active": true, 13 | "updated_at": "2015-08-29T11:31:22.453572732+08:00", 14 | "created_at": "2015-08-29T11:31:22.453569275+08:00" 15 | } 16 | -------------------------------------------------------------------------------- /scm/driver/gogs/testdata/hook.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "ID": "20", 3 | "Name": "", 4 | "Target": "http://gogs.io", 5 | "Events": [ 6 | "create", 7 | "push" 8 | ], 9 | "Active": true, 10 | "SkipVerify": false 11 | } -------------------------------------------------------------------------------- /scm/driver/gogs/testdata/hooks.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": 20, 4 | "type": "gogs", 5 | "config": { 6 | "content_type": "json", 7 | "url": "http://gogs.io" 8 | }, 9 | "events": [ 10 | "create", 11 | "push" 12 | ], 13 | "active": true, 14 | "updated_at": "2015-08-29T11:31:22.453572732+08:00", 15 | "created_at": "2015-08-29T11:31:22.453569275+08:00" 16 | } 17 | ] 18 | -------------------------------------------------------------------------------- /scm/driver/gogs/testdata/hooks.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "ID": "20", 4 | "Name": "", 5 | "Target": "http://gogs.io", 6 | "Events": [ 7 | "create", 8 | "push" 9 | ], 10 | "Active": true, 11 | "SkipVerify": false 12 | } 13 | ] -------------------------------------------------------------------------------- /scm/driver/gogs/testdata/issue.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "id": 1, 4 | "number": 1, 5 | "user": { 6 | "id": 1, 7 | "login": "janedoe", 8 | "full_name": "", 9 | "email": "janedoe@mail.com", 10 | "avatar_url": "https://secure.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87", 11 | "username": "janedoe" 12 | }, 13 | "title": "Bug found", 14 | "body": "I'm having a problem with this.", 15 | "labels": [ 16 | 17 | ], 18 | "milestone": null, 19 | "assignee": null, 20 | "state": "open", 21 | "comments": 0, 22 | "created_at": "2017-09-23T19:24:01Z", 23 | "updated_at": "2017-09-23T19:24:01Z", 24 | "pull_request": null 25 | } -------------------------------------------------------------------------------- /scm/driver/gogs/testdata/issue.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Number": 1, 3 | "Title": "Bug found", 4 | "Body": "I'm having a problem with this.", 5 | "Link": "", 6 | "Labels": null, 7 | "Closed": false, 8 | "Locked": false, 9 | "Author": { 10 | "Login": "janedoe", 11 | "Name": "", 12 | "Email": "janedoe@mail.com", 13 | "Avatar": "https://secure.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87" 14 | }, 15 | "Created": "2017-09-23T19:24:01Z", 16 | "Updated": "2017-09-23T19:24:01Z" 17 | } -------------------------------------------------------------------------------- /scm/driver/gogs/testdata/issues.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": 1, 4 | "number": 1, 5 | "user": { 6 | "id": 1, 7 | "login": "janedoe", 8 | "full_name": "", 9 | "email": "janedoe@mail.com", 10 | "avatar_url": "https://secure.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87", 11 | "username": "janedoe" 12 | }, 13 | "title": "Bug found", 14 | "body": "I'm having a problem with this.", 15 | "labels": [ 16 | 17 | ], 18 | "milestone": null, 19 | "assignee": null, 20 | "state": "open", 21 | "comments": 0, 22 | "created_at": "2017-09-23T19:24:01Z", 23 | "updated_at": "2017-09-23T19:24:01Z", 24 | "pull_request": null 25 | } 26 | ] 27 | -------------------------------------------------------------------------------- /scm/driver/gogs/testdata/issues.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Number": 1, 4 | "Title": "Bug found", 5 | "Body": "I'm having a problem with this.", 6 | "Link": "", 7 | "Labels": null, 8 | "Closed": false, 9 | "Locked": false, 10 | "Author": { 11 | "Login": "janedoe", 12 | "Name": "", 13 | "Email": "janedoe@mail.com", 14 | "Avatar": "https://secure.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87" 15 | }, 16 | "Created": "2017-09-23T19:24:01Z", 17 | "Updated": "2017-09-23T19:24:01Z" 18 | } 19 | ] -------------------------------------------------------------------------------- /scm/driver/gogs/testdata/organization.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": 1, 3 | "username": "gogits", 4 | "full_name": "gogits", 5 | "avatar_url": "http://gogits.io/avatars/1", 6 | "description": "", 7 | "website": "", 8 | "location": "" 9 | } 10 | -------------------------------------------------------------------------------- /scm/driver/gogs/testdata/organization.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Name": "gogits", 3 | "Avatar": "http://gogits.io/avatars/1" 4 | } -------------------------------------------------------------------------------- /scm/driver/gogs/testdata/organizations.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": 1, 4 | "username": "gogits", 5 | "full_name": "gogits", 6 | "avatar_url": "http://gogits.io/avatars/1", 7 | "description": "", 8 | "website": "", 9 | "location": "" 10 | } 11 | ] 12 | -------------------------------------------------------------------------------- /scm/driver/gogs/testdata/organizations.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Name": "gogits", 4 | "Avatar": "http://gogits.io/avatars/1" 5 | } 6 | ] -------------------------------------------------------------------------------- /scm/driver/gogs/testdata/repo.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": 1, 3 | "owner": { 4 | "id": 1, 5 | "login": "gogits", 6 | "full_name": "gogits", 7 | "email": "", 8 | "avatar_url": "http://gogs.io/avatars/1", 9 | "username": "gogits" 10 | }, 11 | "name": "gogs", 12 | "full_name": "gogits/gogs", 13 | "description": "", 14 | "private": true, 15 | "fork": false, 16 | "parent": null, 17 | "empty": false, 18 | "mirror": false, 19 | "size": 4485120, 20 | "html_url": "http://gogs.io/drone/cover", 21 | "ssh_url": "git@localhost:drone/cover.git", 22 | "clone_url": "http://gogs.io/drone/cover.git", 23 | "website": "", 24 | "stars_count": 0, 25 | "forks_count": 0, 26 | "watchers_count": 2, 27 | "open_issues_count": 0, 28 | "default_branch": "master", 29 | "created_at": "2017-10-22T18:25:33Z", 30 | "updated_at": "2017-11-16T22:07:01Z", 31 | "permissions": { 32 | "admin": true, 33 | "push": true, 34 | "pull": true 35 | } 36 | } -------------------------------------------------------------------------------- /scm/driver/gogs/testdata/repo.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "ID": "1", 3 | "Namespace": "gogits", 4 | "Name": "gogs", 5 | "Perm": { 6 | "Pull": true, 7 | "Push": true, 8 | "Admin": true 9 | }, 10 | "Branch": "master", 11 | "Private": true, 12 | "Clone": "http://gogs.io/drone/cover.git", 13 | "CloneSSH": "git@localhost:drone/cover.git", 14 | "Link": "http://gogs.io/drone/cover", 15 | "Created": "0001-01-01T00:00:00Z", 16 | "Updated": "0001-01-01T00:00:00Z" 17 | } -------------------------------------------------------------------------------- /scm/driver/gogs/testdata/repos.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "ID": "1", 4 | "Namespace": "gogits", 5 | "Name": "gogs", 6 | "Perm": { 7 | "Pull": true, 8 | "Push": true, 9 | "Admin": true 10 | }, 11 | "Branch": "master", 12 | "Private": true, 13 | "Clone": "http://gogs.io/drone/cover.git", 14 | "CloneSSH": "git@localhost:drone/cover.git", 15 | "Link": "http://gogs.io/drone/cover", 16 | "Created": "0001-01-01T00:00:00Z", 17 | "Updated": "0001-01-01T00:00:00Z" 18 | } 19 | ] -------------------------------------------------------------------------------- /scm/driver/gogs/testdata/user.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": 1, 3 | "login": "jcitizen", 4 | "full_name": "Jane Citizen", 5 | "email": "jane@example.com", 6 | "avatar_url": "https://secure.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87", 7 | "username": "jcitizen" 8 | } 9 | -------------------------------------------------------------------------------- /scm/driver/gogs/testdata/user.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Login": "jcitizen", 3 | "Name": "Jane Citizen", 4 | "Email": "jane@example.com", 5 | "Avatar": "https://secure.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87" 6 | } -------------------------------------------------------------------------------- /scm/driver/gogs/testdata/webhooks/branch_create.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Ref": { 3 | "Name": "feature", 4 | "Sha": "" 5 | }, 6 | "Repo": { 7 | "ID": "61", 8 | "Namespace": "gogits", 9 | "Name": "hello-world", 10 | "Perm": {}, 11 | "Branch": "master", 12 | "Private": true, 13 | "Clone": "http://try.gogs.io/gogits/hello-world.git", 14 | "CloneSSH": "git@localhost:gogits/hello-world.git", 15 | "Link": "http://try.gogs.io/gogits/hello-world", 16 | "Created": "0001-01-01T00:00:00Z", 17 | "Updated": "0001-01-01T00:00:00Z" 18 | }, 19 | "Action": "created", 20 | "Sender": { 21 | "Login": "unknwon", 22 | "Name": "", 23 | "Email": "noreply@gogs.io", 24 | "Avatar": "https://secure.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87" 25 | } 26 | } -------------------------------------------------------------------------------- /scm/driver/gogs/testdata/webhooks/branch_delete.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Ref": { 3 | "Name": "feature", 4 | "Sha": "" 5 | }, 6 | "Repo": { 7 | "ID": "61", 8 | "Namespace": "gogits", 9 | "Name": "hello-world", 10 | "Perm": {}, 11 | "Branch": "master", 12 | "Private": true, 13 | "Clone": "http://try.gogs.io/gogits/hello-world.git", 14 | "CloneSSH": "git@localhost:gogits/hello-world.git", 15 | "Link": "http://try.gogs.io/gogits/hello-world", 16 | "Created": "0001-01-01T00:00:00Z", 17 | "Updated": "0001-01-01T00:00:00Z" 18 | }, 19 | "Action": "deleted", 20 | "Sender": { 21 | "Login": "unknwon", 22 | "Name": "", 23 | "Email": "noreply@gogs.io", 24 | "Avatar": "https://secure.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87" 25 | } 26 | } -------------------------------------------------------------------------------- /scm/driver/gogs/testdata/webhooks/tag_create.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Ref": { 3 | "Name": "v1.0.0", 4 | "Sha": "599d25c67b05717269f50ac082b34f176d085179" 5 | }, 6 | "Repo": { 7 | "ID": "61", 8 | "Namespace": "gogits", 9 | "Name": "hello-world", 10 | "Perm": {}, 11 | "Branch": "master", 12 | "Private": true, 13 | "Clone": "http://try.gogs.io/gogits/hello-world.git", 14 | "CloneSSH": "git@localhost:gogits/hello-world.git", 15 | "Link": "http://try.gogs.io/gogits/hello-world", 16 | "Created": "0001-01-01T00:00:00Z", 17 | "Updated": "0001-01-01T00:00:00Z" 18 | }, 19 | "Action": "created", 20 | "Sender": { 21 | "Login": "unknwon", 22 | "Name": "", 23 | "Email": "noreply@gogs.io", 24 | "Avatar": "https://secure.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87" 25 | } 26 | } -------------------------------------------------------------------------------- /scm/driver/gogs/testdata/webhooks/tag_delete.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Ref": { 3 | "Name": "v1.0.0", 4 | "Sha": "" 5 | }, 6 | "Repo": { 7 | "ID": "61", 8 | "Namespace": "gogits", 9 | "Name": "hello-world", 10 | "Perm": {}, 11 | "Branch": "master", 12 | "Private": true, 13 | "Clone": "http://try.gogs.io/gogits/hello-world.git", 14 | "CloneSSH": "git@localhost:gogits/hello-world.git", 15 | "Link": "http://try.gogs.io/gogits/hello-world", 16 | "Created": "0001-01-01T00:00:00Z", 17 | "Updated": "0001-01-01T00:00:00Z" 18 | }, 19 | "Action": "deleted", 20 | "Sender": { 21 | "Login": "unknwon", 22 | "Name": "", 23 | "Email": "noreply@gogs.io", 24 | "Avatar": "https://secure.gravatar.com/avatar/8c58a0be77ee441bb8f8595b7f1b4e87" 25 | } 26 | } -------------------------------------------------------------------------------- /scm/driver/harness/issue_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 Drone.IO Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package harness 6 | -------------------------------------------------------------------------------- /scm/driver/harness/linker.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 Drone.IO Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package harness 6 | 7 | import ( 8 | "context" 9 | 10 | "github.com/drone/go-scm/scm" 11 | ) 12 | 13 | type linker struct { 14 | base string 15 | } 16 | 17 | // Resource returns a link to the resource. 18 | func (l *linker) Resource(ctx context.Context, repo string, ref scm.Reference) (string, error) { 19 | return "", scm.ErrNotSupported 20 | 21 | } 22 | 23 | // Diff returns a link to the diff. 24 | func (l *linker) Diff(ctx context.Context, repo string, source, target scm.Reference) (string, error) { 25 | return "", scm.ErrNotSupported 26 | 27 | } 28 | -------------------------------------------------------------------------------- /scm/driver/harness/linker_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 Drone.IO Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package harness 6 | -------------------------------------------------------------------------------- /scm/driver/harness/milestone_test.go: -------------------------------------------------------------------------------- 1 | package harness 2 | -------------------------------------------------------------------------------- /scm/driver/harness/org_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 Drone.IO Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package harness 6 | -------------------------------------------------------------------------------- /scm/driver/harness/release_test.go: -------------------------------------------------------------------------------- 1 | package harness 2 | -------------------------------------------------------------------------------- /scm/driver/harness/review_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 Drone.IO Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package harness 6 | -------------------------------------------------------------------------------- /scm/driver/harness/testdata/branch.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "main", 3 | "sha": "1d640265d8bdd818175fa736f0fcbad2c9b716c9", 4 | "commit": { 5 | "sha": "1d640265d8bdd818175fa736f0fcbad2c9b716c9", 6 | "title": "delete README.2", 7 | "message": "delete README.2\n\ndelete README.2", 8 | "author": { 9 | "identity": { 10 | "name": "thomas.honey", 11 | "email": "thomas.honey@harness.io" 12 | }, 13 | "when": "2023-02-08T16:17:50Z" 14 | }, 15 | "committer": { 16 | "identity": { 17 | "name": "Harness", 18 | "email": "noreply@harness.io" 19 | }, 20 | "when": "2023-02-08T16:17:50Z" 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /scm/driver/harness/testdata/branch.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Name": "main", 3 | "Path": "refs/heads/main", 4 | "Sha": "1d640265d8bdd818175fa736f0fcbad2c9b716c9" 5 | } -------------------------------------------------------------------------------- /scm/driver/harness/testdata/branches.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Name": "bla", 4 | "Path": "refs/heads/bla", 5 | "Sha": "0c221fd126b9457d0ad2037641416083549f59c5" 6 | }, 7 | { 8 | "Name": "branch3", 9 | "Path": "refs/heads/branch3", 10 | "Sha": "59e1cdf0e421fd14b106f4861fb02dfd56b4dc34" 11 | }, 12 | { 13 | "Name": "main", 14 | "Path": "refs/heads/main", 15 | "Sha": "1d640265d8bdd818175fa736f0fcbad2c9b716c9" 16 | } 17 | ] -------------------------------------------------------------------------------- /scm/driver/harness/testdata/comment.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": 123, 3 | "created": 1708354973112, 4 | "updated": 1708354973112, 5 | "edited": 1708354973112, 6 | "parent_id": null, 7 | "repo_id": 123, 8 | "pullreq_id": 123, 9 | "order": 1, 10 | "sub_order": 0, 11 | "type": "comment", 12 | "kind": "comment", 13 | "text": "Comment to be created in the PR", 14 | "payload": {}, 15 | "metadata": null, 16 | "author": { 17 | "id": 1, 18 | "uid": "identifier", 19 | "display_name": "displayName", 20 | "email": "email@emailprovider.com", 21 | "type": "service", 22 | "created": 1695706039266, 23 | "updated": 1695706039266 24 | } 25 | } -------------------------------------------------------------------------------- /scm/driver/harness/testdata/comment.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "ID": 123, 3 | "Body": "Comment to be created in the PR", 4 | "Author": { 5 | "ID": "1", 6 | "Login": "identifier", 7 | "Name": "displayName", 8 | "Email": "email@emailprovider.com", 9 | "Avatar": "", 10 | "Created": 1695706039266, 11 | "Updated": 1695706039266 12 | }, 13 | "Created": 1708354973112, 14 | "Updated": 1708354973112 15 | } -------------------------------------------------------------------------------- /scm/driver/harness/testdata/commit.json: -------------------------------------------------------------------------------- 1 | { 2 | "sha": "1d640265d8bdd818175fa736f0fcbad2c9b716c9", 3 | "title": "delete README.2", 4 | "message": "delete README.2\n\ndelete README.2", 5 | "author": { 6 | "identity": { 7 | "name": "thomas.honey", 8 | "email": "thomas.honey@harness.io" 9 | }, 10 | "when": "2023-02-08T16:17:50Z" 11 | }, 12 | "committer": { 13 | "identity": { 14 | "name": "Harness", 15 | "email": "noreply@harness.io" 16 | }, 17 | "when": "2023-02-08T16:17:50Z" 18 | } 19 | } -------------------------------------------------------------------------------- /scm/driver/harness/testdata/commit.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Sha": "1d640265d8bdd818175fa736f0fcbad2c9b716c9", 3 | "Message": "delete README.2\n\ndelete README.2", 4 | "Author": { 5 | "Name": "thomas.honey", 6 | "Email": "thomas.honey@harness.io", 7 | "Date": "2023-02-08T16:17:50Z", 8 | "Login": "", 9 | "Avatar": "" 10 | }, 11 | "Committer": { 12 | "Name": "Harness", 13 | "Email": "noreply@harness.io", 14 | "Date": "2023-02-08T16:17:50Z", 15 | "Login": "", 16 | "Avatar": "" 17 | }, 18 | "Link": "" 19 | } -------------------------------------------------------------------------------- /scm/driver/harness/testdata/commits.json: -------------------------------------------------------------------------------- 1 | { 2 | "commits": [ 3 | { 4 | "sha": "1d640265d8bdd818175fa736f0fcbad2c9b716c9", 5 | "title": "delete README.2", 6 | "message": "delete README.2\n\ndelete README.2", 7 | "author": { 8 | "identity": { 9 | "name": "thomas.honey", 10 | "email": "thomas.honey@harness.io" 11 | }, 12 | "when": "2023-02-08T16:17:50Z" 13 | }, 14 | "committer": { 15 | "identity": { 16 | "name": "Harness", 17 | "email": "noreply@harness.io" 18 | }, 19 | "when": "2023-02-08T16:17:50Z" 20 | } 21 | } 22 | ] 23 | } -------------------------------------------------------------------------------- /scm/driver/harness/testdata/commits.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Sha": "1d640265d8bdd818175fa736f0fcbad2c9b716c9", 4 | "Message": "delete README.2\n\ndelete README.2", 5 | "Author": { 6 | "Name": "thomas.honey", 7 | "Email": "thomas.honey@harness.io", 8 | "Date": "2023-02-08T16:17:50Z", 9 | "Login": "", 10 | "Avatar": "" 11 | }, 12 | "Committer": { 13 | "Name": "Harness", 14 | "Email": "noreply@harness.io", 15 | "Date": "2023-02-08T16:17:50Z", 16 | "Login": "", 17 | "Avatar": "" 18 | }, 19 | "Link": "" 20 | } 21 | ] -------------------------------------------------------------------------------- /scm/driver/harness/testdata/content.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "file", 3 | "sha": "7839122fc2ec4af9d5a6c14c779a82a05c5769b5", 4 | "name": "README.md", 5 | "path": "README.md", 6 | "latest_commit": { 7 | "sha": "98189d5cf2a751a6246c24a72945ba70839f1b20", 8 | "title": "initial commit", 9 | "message": "initial commit", 10 | "author": { 11 | "identity": { 12 | "name": "gitness", 13 | "email": "system@gitness" 14 | }, 15 | "when": "2023-02-02T14:12:13Z" 16 | }, 17 | "committer": { 18 | "identity": { 19 | "name": "gitness", 20 | "email": "system@gitness" 21 | }, 22 | "when": "2023-02-02T14:12:13Z" 23 | } 24 | }, 25 | "content": { 26 | "encoding": "base64", 27 | "data": "IyB0aG9tYXMKUGxheWdyb3VuZCBwcm9qZWN0IGZvciBUaG9tYXM=", 28 | "size": 38 29 | } 30 | } -------------------------------------------------------------------------------- /scm/driver/harness/testdata/content_list.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Path": ".gitignore", 4 | "Sha": "f8de11b6f3e4499889e16b989977c66c84ad02c9", 5 | "BlobID": "41fdf994e79e42bd4136c7e3004367f6d21d800d", 6 | "kind": "file" 7 | }, 8 | { 9 | "Path": "LICENSE", 10 | "Sha": "a2a1bb3664f096e69f4b15b80f4650cc9f8ae913", 11 | "BlobID": "261eeb9e9f8b2b4b0d119366dda99c6fd7d35c64", 12 | "kind": "file" 13 | } 14 | ] 15 | -------------------------------------------------------------------------------- /scm/driver/harness/testdata/gitdiff.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Path": "hello.go", 4 | "Added": true, 5 | "Renamed": false, 6 | "Deleted": false, 7 | "Sha": "", 8 | "BlobID": "", 9 | "PrevFilePath": "hello.go" 10 | }, 11 | { 12 | "Path": "null.go", 13 | "Added": false, 14 | "Renamed": false, 15 | "Deleted": true, 16 | "Sha": "", 17 | "BlobID": "", 18 | "PrevFilePath": "null.go" 19 | }, 20 | { 21 | "Path": "version4.go", 22 | "Added": false, 23 | "Renamed": false, 24 | "Deleted": false, 25 | "Sha": "", 26 | "BlobID": "", 27 | "PrevFilePath": "version4.go" 28 | }, 29 | { 30 | "Path": "version_1.go", 31 | "Added": false, 32 | "Renamed": true, 33 | "Deleted": false, 34 | "Sha": "", 35 | "BlobID": "", 36 | "PrevFilePath": "version1.go" 37 | } 38 | ] -------------------------------------------------------------------------------- /scm/driver/harness/testdata/hook.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 1, 3 | "parent_id": 11, 4 | "parent_type": "repo", 5 | "created_by": 14, 6 | "created": 1675867490853, 7 | "updated": 1675867531549, 8 | "identifier": "webhookname", 9 | "description": "webhookdescription", 10 | "url": "http://1.1.1.1", 11 | "enabled": true, 12 | "insecure": true, 13 | "triggers": [], 14 | "latest_execution_result": "success", 15 | "has_secret": true 16 | } -------------------------------------------------------------------------------- /scm/driver/harness/testdata/hook.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "ID": "webhookname", 3 | "Name": "webhookname", 4 | "Target": "http://1.1.1.1", 5 | "Events": [], 6 | "Active": true, 7 | "SkipVerify": true 8 | } -------------------------------------------------------------------------------- /scm/driver/harness/testdata/hook_create.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": 9, 3 | "version": 1, 4 | "parent_id": 11, 5 | "parent_type": "repo", 6 | "created_by": 14, 7 | "created": 1675872629243, 8 | "updated": 1675872777592, 9 | "identifier": "drone", 10 | "description": "", 11 | "url": "https://example.com", 12 | "enabled": true, 13 | "insecure": true, 14 | "triggers": [], 15 | "latest_execution_result": "success", 16 | "has_secret": true 17 | } -------------------------------------------------------------------------------- /scm/driver/harness/testdata/hook_create.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "ID": "9", 3 | "Name": "drone", 4 | "Target": "https://example.com", 5 | "Events": [], 6 | "Active": true, 7 | "SkipVerify": true 8 | } -------------------------------------------------------------------------------- /scm/driver/harness/testdata/hooks.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "version": 1, 4 | "parent_id": 11, 5 | "parent_type": "repo", 6 | "created_by": 14, 7 | "created": 1675867490853, 8 | "updated": 1675867531549, 9 | "identifier": "webhookname", 10 | "description": "webhookdescription", 11 | "url": "http://1.1.1.1", 12 | "enabled": true, 13 | "insecure": true, 14 | "triggers": [], 15 | "latest_execution_result": "success", 16 | "has_secret": true 17 | } 18 | ] -------------------------------------------------------------------------------- /scm/driver/harness/testdata/hooks.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "ID": "webhookname", 4 | "Name": "webhookname", 5 | "Target": "http://1.1.1.1", 6 | "Events": [], 7 | "Active": true, 8 | "SkipVerify": true 9 | } 10 | ] -------------------------------------------------------------------------------- /scm/driver/harness/testdata/pr_commits.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "author": { 4 | "identity": { 5 | "email": "thomas.honey@harness.io", 6 | "name": "thomas.honey" 7 | }, 8 | "when": "2023-02-09T17:12:10.976Z" 9 | }, 10 | "committer": { 11 | "identity": { 12 | "email": "noreply@harness.io", 13 | "name": "Harness" 14 | }, 15 | "when": "2023-02-09T17:12:10.976Z" 16 | }, 17 | "message": "Create bla_file", 18 | "sha": "0c221fd126b9457d0ad2037641416083549f59c5", 19 | "title": "string" 20 | } 21 | ] -------------------------------------------------------------------------------- /scm/driver/harness/testdata/pr_commits.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Sha": "0c221fd126b9457d0ad2037641416083549f59c5", 4 | "Message": "Create bla_file", 5 | "Author": { 6 | "Name": "thomas.honey", 7 | "Email": "thomas.honey@harness.io", 8 | "Login": "", 9 | "Avatar": "" 10 | }, 11 | "Committer": { 12 | "Name": "Harness", 13 | "Email": "noreply@harness.io", 14 | "Login": "", 15 | "Avatar": "" 16 | }, 17 | "Link": "" 18 | } 19 | ] -------------------------------------------------------------------------------- /scm/driver/harness/testdata/repo.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": 9, 3 | "parent_id": 16, 4 | "uid": "demo", 5 | "path": "px7xd_BFRCi-pfWPYXVjvw/default/codeciintegration/demo", 6 | "description": "", 7 | "is_public": false, 8 | "created_by": 10, 9 | "created": 1675210116158, 10 | "updated": 1675389801066, 11 | "default_branch": "main", 12 | "fork_id": 0, 13 | "num_forks": 0, 14 | "num_pulls": 4, 15 | "num_closed_pulls": 0, 16 | "num_open_pulls": 1, 17 | "num_merged_pulls": 3, 18 | "git_url": "https://qa.harness.io/code/git/px7xd_BFRCi-pfWPYXVjvw/default/codeciintegration/demo.git" 19 | } -------------------------------------------------------------------------------- /scm/driver/harness/testdata/repo.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "ID": "9", 3 | "Namespace": "px7xd_BFRCi-pfWPYXVjvw/default/codeciintegration/demo", 4 | "Name": "demo", 5 | "Branch": "main", 6 | "Private": true, 7 | "Clone": "https://qa.harness.io/code/git/px7xd_BFRCi-pfWPYXVjvw/default/codeciintegration/demo.git", 8 | "CloneSSH": "https://qa.harness.io/code/git/px7xd_BFRCi-pfWPYXVjvw/default/codeciintegration/demo.git", 9 | "Link": "https://qa.harness.io/code/git/px7xd_BFRCi-pfWPYXVjvw/default/codeciintegration/demo.git" 10 | } -------------------------------------------------------------------------------- /scm/driver/harness/testdata/user.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "ID": "0Nnoezs6RGa_fOWvG_Ta4w", 3 | "Login": "thomas.honey@harness.io", 4 | "Name": "thomas.honey", 5 | "Email": "thomas.honey@harness.io", 6 | "Avatar": "" 7 | } -------------------------------------------------------------------------------- /scm/driver/harness/testdata/webhooks/branch_delete.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Ref": { 3 | "Name": "refs/heads/das", 4 | "Sha": "0000000000000000000000000000000000000000" 5 | }, 6 | "Action": "deleted", 7 | "Repo": { 8 | "ID": "16", 9 | "Namespace": "", 10 | "Name": "harness-core", 11 | "Perm": null, 12 | "Branch": "develop", 13 | "Private": false, 14 | "Clone": "http://localhost:3000/git/kmpySmUISimoRrJL6NL73w/harness-core.git", 15 | "CloneSSH": "", 16 | "Link": "http://localhost:3000/git/kmpySmUISimoRrJL6NL73w/harness-core.git", 17 | "Created": "0001-01-01T00:00:00Z", 18 | "Updated": "0001-01-01T00:00:00Z" 19 | }, 20 | "Sender": { 21 | "ID": "lv0euRhKRCyiXWzS7pOg6g", 22 | "Login": "lv0euRhKRCyiXWzS7pOg6g", 23 | "Name": "Admin", 24 | "Email": "admin@harness.io", 25 | "Avatar": "", 26 | "Created": "2023-11-27T05:20:19.051-08:00", 27 | "Updated": "2023-11-27T05:20:19.051-08:00" 28 | } 29 | } -------------------------------------------------------------------------------- /scm/driver/harness/testdata/webhooks/tag_delete.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Ref": { 3 | "Name": "refs/tags/asd", 4 | "Sha": "0000000000000000000000000000000000000000" 5 | }, 6 | "Action": "deleted", 7 | "Repo": { 8 | "ID": "16", 9 | "Namespace": "", 10 | "Name": "harness-core", 11 | "Perm": null, 12 | "Branch": "develop", 13 | "Private": false, 14 | "Clone": "http://localhost:3000/git/kmpySmUISimoRrJL6NL73w/harness-core.git", 15 | "CloneSSH": "", 16 | "Link": "http://localhost:3000/git/kmpySmUISimoRrJL6NL73w/harness-core.git", 17 | "Created": "0001-01-01T00:00:00Z", 18 | "Updated": "0001-01-01T00:00:00Z" 19 | }, 20 | "Sender": { 21 | "ID": "lv0euRhKRCyiXWzS7pOg6g", 22 | "Login": "lv0euRhKRCyiXWzS7pOg6g", 23 | "Name": "Admin", 24 | "Email": "admin@harness.io", 25 | "Avatar": "", 26 | "Created": "2023-11-27T05:20:19.051-08:00", 27 | "Updated": "2023-11-27T05:20:19.051-08:00" 28 | } 29 | } -------------------------------------------------------------------------------- /scm/driver/stash/integration/integration.go: -------------------------------------------------------------------------------- 1 | package integration 2 | 3 | import ( 4 | "context" 5 | "os" 6 | 7 | "github.com/drone/go-scm/scm" 8 | ) 9 | 10 | var ( 11 | client *scm.Client 12 | token = os.Getenv("BITBUCKET_SERVER_TOKEN") 13 | 14 | endpoint = "https://bitbucket.dev.harness.io/" 15 | repoID = "har/scm-integration-test-repo" 16 | username = os.Getenv("BITBUCKET_USERNAME") 17 | ) 18 | 19 | func GetCurrentCommitOfBranch(client *scm.Client, branch string) (string, error) { 20 | commits, _, err := client.Git.ListCommits(context.Background(), repoID, scm.CommitListOptions{Ref: branch}) 21 | if err != nil { 22 | return "", err 23 | } 24 | return commits[0].Sha, nil 25 | } 26 | -------------------------------------------------------------------------------- /scm/driver/stash/integration/repo_test.go: -------------------------------------------------------------------------------- 1 | package integration 2 | 3 | import ( 4 | "context" 5 | "net/http" 6 | "testing" 7 | 8 | "github.com/drone/go-scm/scm" 9 | "github.com/drone/go-scm/scm/driver/stash" 10 | "github.com/drone/go-scm/scm/transport" 11 | ) 12 | 13 | func TestListRepos(t *testing.T) { 14 | if token == "" { 15 | t.Skip("Skipping, Acceptance test") 16 | } 17 | client, _ = stash.New(endpoint) 18 | client.Client = &http.Client{ 19 | Transport: &transport.BasicAuth{ 20 | Username: username, 21 | Password: token, 22 | }, 23 | } 24 | 25 | repos, response, listerr := client.Repositories.List(context.Background(), scm.ListOptions{}) 26 | if listerr != nil { 27 | t.Errorf("List Repos got an error %v", listerr) 28 | } 29 | if response.Status != http.StatusOK { 30 | t.Errorf("List Repos did not get a 200 back %v", response.Status) 31 | } 32 | 33 | if len(repos) == 0 { 34 | t.Errorf("Got Empty repo list") 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /scm/driver/stash/multipart.go: -------------------------------------------------------------------------------- 1 | package stash 2 | 3 | import "mime/multipart" 4 | 5 | type MultipartWriter struct { 6 | Writer *multipart.Writer 7 | Error error 8 | } 9 | 10 | func (mw *MultipartWriter) Write(f, v string) { 11 | if mw.Error != nil { 12 | return 13 | } 14 | if v == "" { 15 | return 16 | } 17 | mw.Error = mw.Writer.WriteField(f, v) 18 | } 19 | 20 | func (mw *MultipartWriter) Close() { 21 | mw.Writer.Close() 22 | } 23 | 24 | func (mw *MultipartWriter) FormDataContentType() string { 25 | return mw.Writer.FormDataContentType() 26 | } 27 | -------------------------------------------------------------------------------- /scm/driver/stash/org.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 Drone.IO Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package stash 6 | 7 | import ( 8 | "context" 9 | 10 | "github.com/drone/go-scm/scm" 11 | ) 12 | 13 | type organizationService struct { 14 | client *wrapper 15 | } 16 | 17 | func (s *organizationService) Find(ctx context.Context, name string) (*scm.Organization, *scm.Response, error) { 18 | return nil, nil, scm.ErrNotSupported 19 | } 20 | 21 | func (s *organizationService) FindMembership(ctx context.Context, name, username string) (*scm.Membership, *scm.Response, error) { 22 | return nil, nil, scm.ErrNotSupported 23 | } 24 | 25 | func (s *organizationService) List(ctx context.Context, opts scm.ListOptions) ([]*scm.Organization, *scm.Response, error) { 26 | return nil, nil, scm.ErrNotSupported 27 | } 28 | -------------------------------------------------------------------------------- /scm/driver/stash/testdata/branch.json: -------------------------------------------------------------------------------- 1 | { 2 | "size": 1, 3 | "limit": 25, 4 | "isLastPage": true, 5 | "values": [ 6 | { 7 | "id": "refs/heads/master", 8 | "displayId": "master", 9 | "type": "BRANCH", 10 | "latestCommit": "11ce869211917dd65610e70fcee454943b35ac6e", 11 | "latestChangeset": "11ce869211917dd65610e70fcee454943b35ac6e", 12 | "isDefault": true 13 | } 14 | ], 15 | "start": 0 16 | } -------------------------------------------------------------------------------- /scm/driver/stash/testdata/branch.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Name": "master", 3 | "Path": "refs/heads/master", 4 | "Sha": "11ce869211917dd65610e70fcee454943b35ac6e" 5 | } -------------------------------------------------------------------------------- /scm/driver/stash/testdata/branch_create.json: -------------------------------------------------------------------------------- 1 | { 2 | "ref": "refs/heads/Hello", 3 | "node_id": "MDM6UmVmMzQ0NDI5MDA5OnJlZnMvaGVhZHMvSGVsbG8=", 4 | "url": "https://api.github.com/repos/tphoney/scm-test/git/refs/heads/Hello", 5 | "object": { 6 | "sha": "312797ba52425353dec56871a255e2a36fc96344", 7 | "type": "commit", 8 | "url": "https://api.github.com/repos/tphoney/scm-test/git/commits/312797ba52425353dec56871a255e2a36fc96344" 9 | } 10 | } -------------------------------------------------------------------------------- /scm/driver/stash/testdata/branches.json: -------------------------------------------------------------------------------- 1 | { 2 | "size": 1, 3 | "limit": 25, 4 | "isLastPage": true, 5 | "values": [ 6 | { 7 | "id": "refs/heads/master", 8 | "displayId": "master", 9 | "type": "BRANCH", 10 | "latestCommit": "11ce869211917dd65610e70fcee454943b35ac6e", 11 | "latestChangeset": "11ce869211917dd65610e70fcee454943b35ac6e", 12 | "isDefault": true 13 | } 14 | ], 15 | "start": 0 16 | } -------------------------------------------------------------------------------- /scm/driver/stash/testdata/branches.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Name": "master", 4 | "Path": "refs/heads/master", 5 | "Sha": "11ce869211917dd65610e70fcee454943b35ac6e" 6 | } 7 | ] -------------------------------------------------------------------------------- /scm/driver/stash/testdata/branches_filter.json: -------------------------------------------------------------------------------- 1 | { 2 | "size": 1, 3 | "limit": 25, 4 | "isLastPage": true, 5 | "values": [ 6 | { 7 | "id": "refs/heads/master", 8 | "displayId": "master", 9 | "type": "BRANCH", 10 | "latestCommit": "11ce869211917dd65610e70fcee454943b35ac6e", 11 | "latestChangeset": "11ce869211917dd65610e70fcee454943b35ac6e", 12 | "isDefault": true 13 | }, 14 | { 15 | "id": "refs/heads/master-patch", 16 | "displayId": "master-patch", 17 | "type": "BRANCH", 18 | "latestCommit": "11ce869211917dd65610e70fcee454943b35ac6f", 19 | "latestChangeset": "11ce869211917dd65610e70fcee454943b35ac6f", 20 | "isDefault": true 21 | } 22 | ], 23 | "start": 0 24 | } -------------------------------------------------------------------------------- /scm/driver/stash/testdata/branches_filter.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Name": "master", 4 | "Path": "refs/heads/master", 5 | "Sha": "11ce869211917dd65610e70fcee454943b35ac6e" 6 | }, 7 | { 8 | "Name": "master-patch", 9 | "Path": "refs/heads/master-patch", 10 | "Sha": "11ce869211917dd65610e70fcee454943b35ac6f" 11 | } 12 | ] -------------------------------------------------------------------------------- /scm/driver/stash/testdata/changes.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Path": ".gitignore", 4 | "Added": false, 5 | "Renamed": false, 6 | "Deleted": true 7 | }, 8 | { 9 | "Path": "COPYING", 10 | "Added": false, 11 | "Renamed": false, 12 | "Deleted": false 13 | }, 14 | { 15 | "Path": "README.md", 16 | "Added": false, 17 | "Renamed": true, 18 | "Deleted": false 19 | }, 20 | { 21 | "Path": "main.go", 22 | "Added": true, 23 | "Renamed": false, 24 | "Deleted": false 25 | } 26 | ] -------------------------------------------------------------------------------- /scm/driver/stash/testdata/commit.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Sha": "131cb13f4aed12e725177bc4b7c28db67839bf9f", 3 | "Message": "update files", 4 | "Author": { 5 | "Name": "Jane Citizen", 6 | "Email": "jane@example.com", 7 | "Date": "2018-07-04T09:01:42-07:00", 8 | "Login": "jcitizen", 9 | "Avatar": "https://www.gravatar.com/avatar/9e26471d35a78862c17e467d87cddedf.jpg" 10 | }, 11 | "Committer": { 12 | "Name": "Jane Citizen", 13 | "Email": "jane@example.com", 14 | "Date": "2018-07-04T09:01:42-07:00", 15 | "Login": "jcitizen", 16 | "Avatar": "https://www.gravatar.com/avatar/9e26471d35a78862c17e467d87cddedf.jpg" 17 | }, 18 | "Link": "" 19 | } -------------------------------------------------------------------------------- /scm/driver/stash/testdata/commits.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Sha": "131cb13f4aed12e725177bc4b7c28db67839bf9f", 4 | "Message": "update files", 5 | "Author": { 6 | "Name": "Jane Citizen", 7 | "Email": "jane@example.com", 8 | "Date": "2018-07-04T09:01:42-07:00", 9 | "Login": "jcitizen", 10 | "Avatar": "https://www.gravatar.com/avatar/9e26471d35a78862c17e467d87cddedf.jpg" 11 | }, 12 | "Committer": { 13 | "Name": "Jane Citizen", 14 | "Email": "jane@example.com", 15 | "Date": "2018-07-04T09:01:42-07:00", 16 | "Login": "jcitizen", 17 | "Avatar": "https://www.gravatar.com/avatar/9e26471d35a78862c17e467d87cddedf.jpg" 18 | }, 19 | "Link": "" 20 | } 21 | ] -------------------------------------------------------------------------------- /scm/driver/stash/testdata/compare.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Path": ".gitignore", 4 | "Added": false, 5 | "Renamed": false, 6 | "Deleted": true 7 | }, 8 | { 9 | "Path": "COPYING", 10 | "Added": false, 11 | "Renamed": false, 12 | "Deleted": false 13 | }, 14 | { 15 | "Path": "README.md", 16 | "Added": false, 17 | "Renamed": true, 18 | "Deleted": false 19 | }, 20 | { 21 | "Path": "main.go", 22 | "Added": true, 23 | "Renamed": false, 24 | "Deleted": false 25 | } 26 | ] -------------------------------------------------------------------------------- /scm/driver/stash/testdata/content.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Path": "README", 3 | "Data": "SGVsbG8gV29ybGQK" 4 | } -------------------------------------------------------------------------------- /scm/driver/stash/testdata/content.txt: -------------------------------------------------------------------------------- 1 | Hello World 2 | -------------------------------------------------------------------------------- /scm/driver/stash/testdata/content_create.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "abcdef0123abcdef4567abcdef8987abcdef6543", 3 | "displayId": "abcdef0123a", 4 | "author": { 5 | "name": "charlie", 6 | "emailAddress": "charlie@example.com" 7 | }, 8 | "authorTimestamp": 1636089306104, 9 | "committer": { 10 | "name": "charlie", 11 | "emailAddress": "charlie@example.com" 12 | }, 13 | "committerTimestamp": 1636089306104, 14 | "message": "WIP on feature 1", 15 | "parents": [ 16 | { 17 | "id": "abcdef0123abcdef4567abcdef8987abcdef6543", 18 | "displayId": "abcdef0" 19 | } 20 | ] 21 | } -------------------------------------------------------------------------------- /scm/driver/stash/testdata/content_list.json: -------------------------------------------------------------------------------- 1 | { 2 | "size": 85, 3 | "limit": 25, 4 | "isLastPage": false, 5 | "values": [ 6 | "content.go", 7 | "content_test.go", 8 | "git.go", 9 | "git_test.go", 10 | "issue.go", 11 | "issue_test.go", 12 | "linker.go", 13 | "linker_test.go", 14 | "org.go", 15 | "org_test.go", 16 | "pr.go", 17 | "pr_test.go", 18 | "repo.go", 19 | "repo_test.go", 20 | "review.go", 21 | "review_test.go", 22 | "stash.go", 23 | "stash_test.go", 24 | "testdata/branch.json", 25 | "testdata/branch.json.golden", 26 | "testdata/branches.json", 27 | "testdata/branches.json.golden", 28 | "testdata/changes.json", 29 | "testdata/changes.json.golden", 30 | "testdata/commit.json", 31 | "testdata/default_branch.json" 32 | ], 33 | "start": 0, 34 | "nextPageStart": 25 35 | } 36 | -------------------------------------------------------------------------------- /scm/driver/stash/testdata/content_update.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "abcdef0123abcdef4567abcdef8987abcdef6543", 3 | "displayId": "abcdef0123a", 4 | "author": { 5 | "name": "charlie", 6 | "emailAddress": "charlie@example.com" 7 | }, 8 | "authorTimestamp": 1636089306104, 9 | "committer": { 10 | "name": "charlie", 11 | "emailAddress": "charlie@example.com" 12 | }, 13 | "committerTimestamp": 1636089306104, 14 | "message": "WIP on feature 1", 15 | "parents": [ 16 | { 17 | "id": "abcdef0123abcdef4567abcdef8987abcdef6543", 18 | "displayId": "abcdef0" 19 | } 20 | ] 21 | } -------------------------------------------------------------------------------- /scm/driver/stash/testdata/default_branch.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "refs/heads/feature_branch", 3 | "displayId": "feature_branch", 4 | "type": "BRANCH", 5 | "latestCommit": "c567b3f4a2980299e2a1148360f23ffb0f4c9764", 6 | "latestChangeset": "c567b3f4a2980299e2a1148360f23ffb0f4c9764", 7 | "isDefault": true 8 | } -------------------------------------------------------------------------------- /scm/driver/stash/testdata/error.json: -------------------------------------------------------------------------------- 1 | { 2 | "errors": [ 3 | { 4 | "context": null, 5 | "message": "Project dev does not exist.", 6 | "exceptionName": "com.atlassian.bitbucket.project.NoSuchProjectException" 7 | } 8 | ] 9 | } -------------------------------------------------------------------------------- /scm/driver/stash/testdata/pr_change.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Path": "COPYING", 4 | "Added": true, 5 | "Renamed": false, 6 | "Deleted": false 7 | }, 8 | { 9 | "Path": "README", 10 | "Added": false, 11 | "Renamed": false, 12 | "Deleted": true 13 | }, 14 | { 15 | "Path": "README.md", 16 | "Added": true, 17 | "Renamed": false, 18 | "Deleted": false 19 | }, 20 | { 21 | "Path": "main.go", 22 | "Added": true, 23 | "Renamed": false, 24 | "Deleted": false 25 | } 26 | ] -------------------------------------------------------------------------------- /scm/driver/stash/testdata/pr_comment.json: -------------------------------------------------------------------------------- 1 | { 2 | "properties": { 3 | "repositoryId": 1 4 | }, 5 | "id": 1, 6 | "version": 0, 7 | "text": "this is a comment", 8 | "author": { 9 | "name": "jcitizen", 10 | "emailAddress": "jane@example.com", 11 | "id": 1, 12 | "displayName": "Jane Citizen", 13 | "active": true, 14 | "slug": "jcitizen", 15 | "type": "NORMAL", 16 | "links": { 17 | "self": [ 18 | { 19 | "href": "http://example.com:7990/users/jcitizen" 20 | } 21 | ] 22 | } 23 | }, 24 | "createdDate": 1530770325043, 25 | "updatedDate": 1530770325043, 26 | "comments": [], 27 | "tasks": [], 28 | "permittedOperations": { 29 | "editable": true, 30 | "deletable": true 31 | } 32 | } -------------------------------------------------------------------------------- /scm/driver/stash/testdata/pr_comment.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "ID": 1, 3 | "Body": "this is a comment", 4 | "Author": { 5 | "Login": "jcitizen", 6 | "Name": "Jane Citizen", 7 | "Email": "jane@example.com", 8 | "Avatar": "https://www.gravatar.com/avatar/9e26471d35a78862c17e467d87cddedf.jpg" 9 | }, 10 | "Created": "2018-07-04T22:58:45-07:00", 11 | "Updated": "2018-07-04T22:58:45-07:00" 12 | } -------------------------------------------------------------------------------- /scm/driver/stash/testdata/pr_comments.json.golden: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drone/go-scm/a515870a3931d01562ab61723891462134a3277f/scm/driver/stash/testdata/pr_comments.json.golden -------------------------------------------------------------------------------- /scm/driver/stash/testdata/repo.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "ID": "1", 3 | "Namespace": "PRJ", 4 | "Name": "my-repo", 5 | "Perm": null, 6 | "Branch": "feature_branch", 7 | "Private": true, 8 | "Clone": "http://example.com:7990/scm/prj/my-repo.git", 9 | "CloneSSH": "ssh://git@example.com:7999/prj/my-repo.git", 10 | "Link": "http://example.com:7990/projects/PRJ/repos/my-repo/browse", 11 | "Created": "0001-01-01T00:00:00Z", 12 | "Updated": "0001-01-01T00:00:00Z" 13 | } -------------------------------------------------------------------------------- /scm/driver/stash/testdata/repos_filter.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "ID": "2", 4 | "Namespace": "PRJ", 5 | "Name": "quux", 6 | "Perm": null, 7 | "Branch": "master", 8 | "Private": true, 9 | "Clone": "http://example.com:7990/scm/prj/quux.git", 10 | "CloneSSH": "ssh://git@example.com:7999/prj/quux.git", 11 | "Link": "http://example.com:7990/projects/PRJ/repos/quux/browse", 12 | "Created": "0001-01-01T00:00:00Z", 13 | "Updated": "0001-01-01T00:00:00Z" 14 | } 15 | ] -------------------------------------------------------------------------------- /scm/driver/stash/testdata/tag.json: -------------------------------------------------------------------------------- 1 | { 2 | "size": 1, 3 | "limit": 25, 4 | "isLastPage": true, 5 | "values": [ 6 | { 7 | "id": "refs/tags/v1.0.0", 8 | "displayId": "v1.0.0", 9 | "type": "TAG", 10 | "latestCommit": "11ce869211917dd65610e70fcee454943b35ac6e", 11 | "latestChangeset": "11ce869211917dd65610e70fcee454943b35ac6e", 12 | "hash": null 13 | } 14 | ], 15 | "start": 0 16 | } -------------------------------------------------------------------------------- /scm/driver/stash/testdata/tag.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Name": "v1.0.0", 3 | "Path": "refs/tags/v1.0.0", 4 | "Sha": "11ce869211917dd65610e70fcee454943b35ac6e" 5 | } -------------------------------------------------------------------------------- /scm/driver/stash/testdata/tags.json: -------------------------------------------------------------------------------- 1 | { 2 | "size": 1, 3 | "limit": 25, 4 | "isLastPage": true, 5 | "values": [ 6 | { 7 | "id": "refs/tags/v1.0.0", 8 | "displayId": "v1.0.0", 9 | "type": "TAG", 10 | "latestCommit": "11ce869211917dd65610e70fcee454943b35ac6e", 11 | "latestChangeset": "11ce869211917dd65610e70fcee454943b35ac6e", 12 | "hash": null 13 | } 14 | ], 15 | "start": 0 16 | } -------------------------------------------------------------------------------- /scm/driver/stash/testdata/tags.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Name": "v1.0.0", 4 | "Path": "refs/tags/v1.0.0", 5 | "Sha": "11ce869211917dd65610e70fcee454943b35ac6e" 6 | } 7 | ] -------------------------------------------------------------------------------- /scm/driver/stash/testdata/user.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jcitizen", 3 | "emailAddress": "jane@example.com", 4 | "id": 1, 5 | "displayName": "Jane Citizen", 6 | "active": true, 7 | "slug": "jcitizen", 8 | "type": "NORMAL", 9 | "links": { 10 | "self": [ 11 | { 12 | "href": "http://example.com:7990/users/jcitizen" 13 | } 14 | ] 15 | } 16 | } -------------------------------------------------------------------------------- /scm/driver/stash/testdata/user.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Login": "jcitizen", 3 | "Name": "Jane Citizen", 4 | "Email": "jane@example.com", 5 | "Avatar": "https://www.gravatar.com/avatar/9e26471d35a78862c17e467d87cddedf.jpg" 6 | } -------------------------------------------------------------------------------- /scm/driver/stash/testdata/user_search.json: -------------------------------------------------------------------------------- 1 | { 2 | "size": 2, 3 | "limit": 25, 4 | "isLastPage": true, 5 | "values": [ 6 | { 7 | "name": "jane@example", 8 | "emailAddress": "jane@example.com", 9 | "id": 1, 10 | "displayName": "Jane Citizen", 11 | "active": true, 12 | "slug": "jane_example", 13 | "type": "NORMAL" 14 | } 15 | ], 16 | "start": 0 17 | } -------------------------------------------------------------------------------- /scm/driver/stash/testdata/user_search.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Login": "jane_example", 3 | "Name": "Jane Citizen", 4 | "Email": "jane@example.com", 5 | "Avatar": "https://www.gravatar.com/avatar/9e26471d35a78862c17e467d87cddedf.jpg" 6 | } -------------------------------------------------------------------------------- /scm/driver/stash/testdata/webhook.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": 1, 3 | "name": "example", 4 | "createdDate": 1530808431270, 5 | "updatedDate": 1530808431270, 6 | "events": [ 7 | "repo:refs_changed", 8 | "repo:comment:edited", 9 | "pr:declined", 10 | "pr:reviewer:approved", 11 | "pr:modified", 12 | "pr:deleted", 13 | "pr:opened", 14 | "pr:reviewer:unapproved", 15 | "repo:comment:deleted", 16 | "pr:comment:added", 17 | "pr:comment:deleted", 18 | "pr:merged", 19 | "pr:comment:edited", 20 | "repo:comment:added", 21 | "pr:reviewer:needs_work" 22 | ], 23 | "configuration": { 24 | "secret": "12345" 25 | }, 26 | "url": "http://example.com", 27 | "active": true 28 | } -------------------------------------------------------------------------------- /scm/driver/stash/testdata/webhook.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "ID": "1", 3 | "Name": "example", 4 | "Target": "http://example.com", 5 | "Events": [ 6 | "repo:refs_changed", 7 | "repo:comment:edited", 8 | "pr:declined", 9 | "pr:reviewer:approved", 10 | "pr:modified", 11 | "pr:deleted", 12 | "pr:opened", 13 | "pr:reviewer:unapproved", 14 | "repo:comment:deleted", 15 | "pr:comment:added", 16 | "pr:comment:deleted", 17 | "pr:merged", 18 | "pr:comment:edited", 19 | "repo:comment:added", 20 | "pr:reviewer:needs_work" 21 | ], 22 | "Active": true, 23 | "SkipVerify": false 24 | } -------------------------------------------------------------------------------- /scm/driver/stash/testdata/webhooks.json.golden: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "ID": "1", 4 | "Name": "example", 5 | "Target": "http://example.com", 6 | "Events": [ 7 | "repo:refs_changed", 8 | "repo:comment:edited", 9 | "pr:declined", 10 | "pr:reviewer:approved", 11 | "pr:modified", 12 | "pr:deleted", 13 | "pr:opened", 14 | "pr:reviewer:unapproved", 15 | "repo:comment:deleted", 16 | "pr:comment:added", 17 | "pr:comment:deleted", 18 | "pr:merged", 19 | "pr:comment:edited", 20 | "repo:comment:added", 21 | "pr:reviewer:needs_work" 22 | ], 23 | "Active": true, 24 | "SkipVerify": false 25 | } 26 | ] -------------------------------------------------------------------------------- /scm/driver/stash/testdata/webhooks/push_branch_create.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Ref": { 3 | "Name": "develop", 4 | "Sha": "208b0a5c05eddadad01f2aed8802fe0c3b3eaf5e" 5 | }, 6 | "Repo": { 7 | "ID": "1", 8 | "Namespace": "PRJ", 9 | "Name": "my-repo", 10 | "Perm": null, 11 | "Branch": "master", 12 | "Private": true, 13 | "Clone": "", 14 | "CloneSSH": "", 15 | "Link": "", 16 | "Created": "0001-01-01T00:00:00Z", 17 | "Updated": "0001-01-01T00:00:00Z" 18 | }, 19 | "Action": "created", 20 | "Sender": { 21 | "Login": "jcitizen", 22 | "Name": "Jane Citizen", 23 | "Email": "jane@example.com", 24 | "Avatar": "https://www.gravatar.com/avatar/9e26471d35a78862c17e467d87cddedf.jpg" 25 | } 26 | } -------------------------------------------------------------------------------- /scm/driver/stash/testdata/webhooks/push_branch_delete.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Ref": { 3 | "Name": "develop", 4 | "Sha": "208b0a5c05eddadad01f2aed8802fe0c3b3eaf5e" 5 | }, 6 | "Repo": { 7 | "ID": "1", 8 | "Namespace": "PRJ", 9 | "Name": "my-repo", 10 | "Perm": null, 11 | "Branch": "master", 12 | "Private": true, 13 | "Clone": "", 14 | "CloneSSH": "", 15 | "Link": "", 16 | "Created": "0001-01-01T00:00:00Z", 17 | "Updated": "0001-01-01T00:00:00Z" 18 | }, 19 | "Action": "deleted", 20 | "Sender": { 21 | "Login": "jcitizen", 22 | "Name": "Jane Citizen", 23 | "Email": "jane@example.com", 24 | "Avatar": "https://www.gravatar.com/avatar/9e26471d35a78862c17e467d87cddedf.jpg" 25 | } 26 | } -------------------------------------------------------------------------------- /scm/driver/stash/testdata/webhooks/push_tag_create.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Ref": { 3 | "Name": "v1.1.0", 4 | "Sha": "823b2230a56056231c9425d63758fa87078a66b4" 5 | }, 6 | "Repo": { 7 | "ID": "1", 8 | "Namespace": "PRJ", 9 | "Name": "my-repo", 10 | "Perm": null, 11 | "Branch": "master", 12 | "Private": true, 13 | "Clone": "", 14 | "CloneSSH": "", 15 | "Link": "", 16 | "Created": "0001-01-01T00:00:00Z", 17 | "Updated": "0001-01-01T00:00:00Z" 18 | }, 19 | "Action": "created", 20 | "Sender": { 21 | "Login": "jcitizen", 22 | "Name": "Jane Citizen", 23 | "Email": "jane@example.com", 24 | "Avatar": "https://www.gravatar.com/avatar/9e26471d35a78862c17e467d87cddedf.jpg" 25 | } 26 | } -------------------------------------------------------------------------------- /scm/driver/stash/testdata/webhooks/push_tag_delete.json.golden: -------------------------------------------------------------------------------- 1 | { 2 | "Ref": { 3 | "Name": "v1.1.0", 4 | "Sha": "823b2230a56056231c9425d63758fa87078a66b4" 5 | }, 6 | "Repo": { 7 | "ID": "1", 8 | "Namespace": "PRJ", 9 | "Name": "my-repo", 10 | "Perm": null, 11 | "Branch": "master", 12 | "Private": true, 13 | "Clone": "", 14 | "CloneSSH": "", 15 | "Link": "", 16 | "Created": "0001-01-01T00:00:00Z", 17 | "Updated": "0001-01-01T00:00:00Z" 18 | }, 19 | "Action": "deleted", 20 | "Sender": { 21 | "Login": "jcitizen", 22 | "Name": "Jane Citizen", 23 | "Email": "jane@example.com", 24 | "Avatar": "https://www.gravatar.com/avatar/9e26471d35a78862c17e467d87cddedf.jpg" 25 | } 26 | } -------------------------------------------------------------------------------- /scm/enrich/doc.go: -------------------------------------------------------------------------------- 1 | // Package normalize provides facilities for enriching 2 | // data structures with missing information. 3 | package enrich 4 | -------------------------------------------------------------------------------- /scm/enrich/webhook.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Drone.IO Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package enrich 6 | 7 | import ( 8 | "context" 9 | 10 | "github.com/drone/go-scm/scm" 11 | ) 12 | 13 | // Webhook enriches the webhook payload with missing 14 | // information not included in the webhook payload. 15 | func Webhook(ctx context.Context, client *scm.Client, webhook *scm.Webhook) error { 16 | return nil // TODO 17 | } 18 | -------------------------------------------------------------------------------- /scm/enrich/webhook_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Drone.IO Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package enrich 6 | -------------------------------------------------------------------------------- /scm/linker.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 Drone.IO Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package scm 6 | 7 | import "context" 8 | 9 | // Linker provides deep links to resources. 10 | type Linker interface { 11 | // Resource returns a link to the resource. 12 | Resource(ctx context.Context, repo string, ref Reference) (string, error) 13 | 14 | // Diff returns a link to the diff. 15 | Diff(ctx context.Context, repo string, source, target Reference) (string, error) 16 | } 17 | -------------------------------------------------------------------------------- /scm/token.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 Drone.IO Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package scm 6 | 7 | import ( 8 | "context" 9 | "time" 10 | ) 11 | 12 | type ( 13 | // Token represents the credentials used to authorize 14 | // the requests to access protected resources. 15 | Token struct { 16 | Token string 17 | Refresh string 18 | Expires time.Time 19 | } 20 | 21 | // TokenSource returns a token. 22 | TokenSource interface { 23 | Token(context.Context) (*Token, error) 24 | } 25 | 26 | // TokenKey is the key to use with the context.WithValue 27 | // function to associate an Token value with a context. 28 | TokenKey struct{} 29 | ) 30 | 31 | // WithContext returns a copy of parent in which the token value is set 32 | func WithContext(parent context.Context, token *Token) context.Context { 33 | return context.WithValue(parent, TokenKey{}, token) 34 | } 35 | -------------------------------------------------------------------------------- /scm/transport/custom_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 Drone.IO Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package transport 6 | 7 | import ( 8 | "net/http" 9 | "testing" 10 | 11 | "github.com/h2non/gock" 12 | ) 13 | 14 | func TestCustomTransport(t *testing.T) { 15 | defer gock.Off() 16 | 17 | gock.New("https://try.gogs.io"). 18 | Get("/api/user"). 19 | MatchHeader("Authorization", "token mF_9.B5f-4.1JqM"). 20 | Reply(200) 21 | 22 | client := &http.Client{ 23 | Transport: &Custom{ 24 | Before: func(r *http.Request) { 25 | r.Header.Set("Authorization", "token mF_9.B5f-4.1JqM") 26 | }, 27 | }, 28 | } 29 | 30 | res, err := client.Get("https://try.gogs.io/api/user") 31 | if err != nil { 32 | t.Error(err) 33 | return 34 | } 35 | defer res.Body.Close() 36 | } 37 | -------------------------------------------------------------------------------- /scm/transport/doc.go: -------------------------------------------------------------------------------- 1 | // Package transport provides facilities for setting up 2 | // authenticated http.RoundTripper given credentials and 3 | // base RoundTripper. 4 | package transport 5 | -------------------------------------------------------------------------------- /scm/transport/internal/clone.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 Drone.IO Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package internal 6 | 7 | import "net/http" 8 | 9 | // CloneRequest returns a clone of the provided 10 | // http.Request. The clone is a shallow copy of the struct 11 | // and its Header map. 12 | func CloneRequest(r *http.Request) *http.Request { 13 | // shallow copy of the struct 14 | r2 := new(http.Request) 15 | *r2 = *r 16 | // deep copy of the Header 17 | r2.Header = make(http.Header, len(r.Header)) 18 | for k, s := range r.Header { 19 | r2.Header[k] = append([]string(nil), s...) 20 | } 21 | return r2 22 | } 23 | -------------------------------------------------------------------------------- /scm/transport/internal/clone_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 Drone.IO Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package internal 6 | 7 | import ( 8 | "bytes" 9 | "net/http" 10 | "testing" 11 | 12 | "github.com/google/go-cmp/cmp" 13 | ) 14 | 15 | func TestCloneRequest(t *testing.T) { 16 | b := new(bytes.Buffer) 17 | r1, _ := http.NewRequest("GET", "http://example.com", b) 18 | r1.Header.Set("Accept", "application/json") 19 | r1.Header.Set("Etag", "1") 20 | r2 := CloneRequest(r1) 21 | if r1 == r2 { 22 | t.Errorf("Expect http.Request cloned") 23 | } 24 | if diff := cmp.Diff(r1.Header, r2.Header); diff != "" { 25 | t.Errorf("Expect http.Header cloned") 26 | t.Log(diff) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /scm/transport/oauth1/oauth1_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 Drone.IO Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package oauth1 6 | -------------------------------------------------------------------------------- /scm/transport/oauth1/sign_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 Drone.IO Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package oauth1 6 | -------------------------------------------------------------------------------- /scm/transport/oauth1/sort.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 Dalton Hubble. All rights reserved. 2 | // Copyrights licensed under the MIT License. 3 | 4 | package oauth1 5 | 6 | import ( 7 | "fmt" 8 | "sort" 9 | ) 10 | 11 | // sortParameters sorts parameters by key and returns a 12 | // slice of formatted key value pairs. 13 | func sortParameters(params map[string]string, format string) []string { 14 | // sort by key 15 | keys := make([]string, len(params)) 16 | i := 0 17 | for key := range params { 18 | keys[i] = key 19 | i++ 20 | } 21 | sort.Strings(keys) 22 | // parameter join 23 | pairs := make([]string, len(params)) 24 | for i, key := range keys { 25 | pairs[i] = fmt.Sprintf(format, key, params[key]) 26 | } 27 | return pairs 28 | } 29 | -------------------------------------------------------------------------------- /scm/transport/oauth1/sort_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 Drone.IO Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package oauth1 6 | 7 | import ( 8 | "testing" 9 | 10 | "github.com/google/go-cmp/cmp" 11 | ) 12 | 13 | func TestSortParameters(t *testing.T) { 14 | params := map[string]string{ 15 | "page": "1", 16 | "per_page": "25", 17 | "oauth_version": "1.0", 18 | "oauth_signature_method": "RSA-SHA1", 19 | "oauth_consumer_key": "12345", 20 | } 21 | want := []string{ 22 | "oauth_consumer_key=12345", 23 | "oauth_signature_method=RSA-SHA1", 24 | "oauth_version=1.0", 25 | "page=1", 26 | "per_page=25", 27 | } 28 | got := sortParameters(params, "%s=%s") 29 | if diff := cmp.Diff(got, want); diff != "" { 30 | t.Errorf("Unexpected Results") 31 | t.Log(diff) 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /scm/transport/oauth1/url.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 Dalton Hubble. All rights reserved. 2 | // Copyrights licensed under the MIT License. 3 | 4 | package oauth1 5 | 6 | import ( 7 | "fmt" 8 | "net/http" 9 | "strings" 10 | ) 11 | 12 | // baseURI returns the base string URI of a request 13 | // according to RFC 5849 3.4.1.2. 14 | func baseURI(r *http.Request) string { 15 | scheme := strings.ToLower(r.URL.Scheme) 16 | host := strings.ToLower(r.URL.Host) 17 | if hostPort := strings.Split(host, ":"); len(hostPort) == 2 && (hostPort[1] == "80" || hostPort[1] == "443") { 18 | host = hostPort[0] 19 | } 20 | path := r.URL.EscapedPath() 21 | return fmt.Sprintf("%v://%v%v", scheme, host, path) 22 | } 23 | -------------------------------------------------------------------------------- /scm/transport/util.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 Drone.IO Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package transport 6 | 7 | import "net/http" 8 | 9 | // cloneRequest returns a clone of the provided 10 | // http.Request. The clone is a shallow copy of the struct 11 | // and its Header map. 12 | func cloneRequest(r *http.Request) *http.Request { 13 | // shallow copy of the struct 14 | r2 := new(http.Request) 15 | *r2 = *r 16 | // deep copy of the Header 17 | r2.Header = make(http.Header, len(r.Header)) 18 | for k, s := range r.Header { 19 | r2.Header[k] = append([]string(nil), s...) 20 | } 21 | return r2 22 | } 23 | -------------------------------------------------------------------------------- /scm/transport/util_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 Drone.IO Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package transport 6 | 7 | import ( 8 | "bytes" 9 | "net/http" 10 | "testing" 11 | 12 | "github.com/google/go-cmp/cmp" 13 | ) 14 | 15 | func TestCopyRequest(t *testing.T) { 16 | b := new(bytes.Buffer) 17 | r1, _ := http.NewRequest("GET", "http://example.com", b) 18 | r1.Header.Set("Accept", "application/json") 19 | r1.Header.Set("Etag", "1") 20 | r2 := cloneRequest(r1) 21 | if r1 == r2 { 22 | t.Errorf("Expect http.Request cloned") 23 | } 24 | if diff := cmp.Diff(r1.Header, r2.Header); diff != "" { 25 | t.Errorf("Expect http.Header cloned") 26 | t.Log(diff) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /scm/traverse/doc.go: -------------------------------------------------------------------------------- 1 | // Package traverse provides facilities for traversing 2 | // and combining the paginated results. 3 | package traverse 4 | -------------------------------------------------------------------------------- /scm/traverse/repos.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Drone.IO Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package traverse 6 | 7 | import ( 8 | "context" 9 | 10 | "github.com/drone/go-scm/scm" 11 | ) 12 | 13 | // Repos returns the full repository list, traversing and 14 | // combining paginated responses if necessary. 15 | func Repos(ctx context.Context, client *scm.Client) ([]*scm.Repository, error) { 16 | list := []*scm.Repository{} 17 | opts := scm.ListOptions{Size: 100} 18 | for { 19 | result, meta, err := client.Repositories.List(ctx, opts) 20 | if err != nil { 21 | return nil, err 22 | } 23 | for _, src := range result { 24 | if src != nil { 25 | list = append(list, src) 26 | } 27 | } 28 | opts.Page = meta.Page.Next 29 | opts.URL = meta.Page.NextURL 30 | 31 | if opts.Page == 0 && opts.URL == "" { 32 | break 33 | } 34 | } 35 | return list, nil 36 | } 37 | -------------------------------------------------------------------------------- /scm/traverse/repos_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Drone.IO Inc. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package traverse 6 | --------------------------------------------------------------------------------