Skip to content

Commit

Permalink
Merge #374
Browse files Browse the repository at this point in the history
374: Compare GH repos on fields rather than == r=fchorney a=mattBrzezinski



Co-authored-by: Matt Brzezinski <[email protected]>
  • Loading branch information
bors[bot] and mattBrzezinski committed Aug 12, 2021
2 parents e35b8e6 + 912dcf8 commit 1a1aae8
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "CompatHelper"
uuid = "aa819f21-2bde-4658-8897-bab36330d9b7"
authors = ["Dilum Aluthge", "Brown Center for Biomedical Informatics", "contributors"]
version = "3.0.2"
version = "3.0.3"

[deps]
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
Expand Down
2 changes: 1 addition & 1 deletion src/pull_requests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function get_pull_requests(
return @mock unique(paginated_prs)
end

not_pr_fork(repo::GitHub.Repo, pr::GitHub.PullRequest) = repo == pr.head.repo
not_pr_fork(repo::GitHub.Repo, pr::GitHub.PullRequest) = !pr.head.repo.fork
not_pr_fork(repo::GitLab.Project, pr::GitLab.MergeRequest) = repo.id == pr.project_id

my_prs(username::String, pr::GitHub.PullRequest) = lower(pr.user.login) == lower(username)
Expand Down
6 changes: 3 additions & 3 deletions test/patches.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ end
gh_gpr_patch = @patch function CompatHelper.get_pull_requests(
api::GitHub.GitHubAPI, repo::GitHub.Repo, state::String
)
origin_repo = GitHub.Repo(; id=1)
fork_repo = GitHub.Repo(; id=2)
origin_repo = GitHub.Repo(; id=1, fork=false)
fork_repo = GitHub.Repo(; id=2, fork=true)

pr_from_origin = GitHub.PullRequest(;
head=GitHub.Head(; repo=origin_repo),
Expand All @@ -95,7 +95,7 @@ end
gl_gpr_patch = @patch function CompatHelper.get_pull_requests(
api::GitLab.GitLabAPI, repo::GitLab.Project, state::String
)
origin_repo = GitLab.Project(; id=1)
origin_repo = GitLab.Project(; id=1, fork=false)

pr_from_origin = GitLab.MergeRequest(;
project_id=1, author=GitLab.User(; username="foobar"), title="title"
Expand Down
14 changes: 7 additions & 7 deletions test/pull_requests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ end

@testset "no forks" begin
@testset "GitHub" begin
origin_repo = GitHub.Repo(; id=1)
fork_repo = GitHub.Repo(; id=2)
origin_repo = GitHub.Repo(; id=1, fork=false)
fork_repo = GitHub.Repo(; id=2, fork=true)

pr_from_origin = GitHub.PullRequest(;
head=GitHub.Head(; repo=origin_repo),
Expand All @@ -61,8 +61,8 @@ end
end

@testset "GitLab" begin
origin_repo = GitLab.Project(; id=1)
fork_repo = GitLab.Project(; id=2)
origin_repo = GitLab.Project(; id=1, fork=false)
fork_repo = GitLab.Project(; id=2, fork=true)

pr_from_origin = GitLab.MergeRequest(;
id=1, project_id=1, author=GitLab.User(; username=username), title="PR A"
Expand All @@ -85,7 +85,7 @@ end

@testset "only my prs" begin
@testset "GitHub" begin
origin_repo = GitHub.Repo(; id=1)
origin_repo = GitHub.Repo(; id=1, fork=false)

pr_from_me = GitHub.PullRequest(;
head=GitHub.Head(; repo=origin_repo),
Expand All @@ -110,7 +110,7 @@ end
end

@testset "GitLab" begin
origin_repo = GitLab.Project(; id=1)
origin_repo = GitLab.Project(; id=1, fork=false)

pr_from_me = GitLab.MergeRequest(;
id=1, project_id=1, author=GitLab.User(; username=username), title="PR A"
Expand All @@ -134,7 +134,7 @@ end
@testset "no forks and only my prs" begin
@testset "GitHub" begin
api = GitForge.GitHub.GitHubAPI()
repo = GitHub.Repo(; id=1)
repo = GitHub.Repo(; id=1, fork=false)

apply(gh_gpr_patch) do
prs = CompatHelper.get_pr_titles(api, repo, "foobar")
Expand Down

2 comments on commit 1a1aae8

@DilumAluthge
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/42766

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v3.0.3 -m "<description of version>" 1a1aae8eba95260b369fa40ed3247fc4dd815134
git push origin v3.0.3

Please sign in to comment.