diff --git a/lib/DB.rakumod b/lib/DB.rakumod index ce3c665..71edff4 100644 --- a/lib/DB.rakumod +++ b/lib/DB.rakumod @@ -183,7 +183,6 @@ model GitHubPR is rw is table { has UInt $.number is column; has DB::Project $.project is column; has Str $.base-url is column; - has Str $.head-url is column; has Str $.head-branch is column; has Str $.user-url is column; has DB::PRStatus $.status is column; diff --git a/lib/GitHubCITestRequester.rakumod b/lib/GitHubCITestRequester.rakumod index 303df06..56aab14 100644 --- a/lib/GitHubCITestRequester.rakumod +++ b/lib/GitHubCITestRequester.rakumod @@ -45,7 +45,6 @@ class PRTask { has $.title is required; has PRState $.state is required; has $.base-url is required; - has $.head-url is required; has $.head-branch is required; has $.user-url is required; has PRCommentTask @.comments; @@ -88,7 +87,6 @@ method !process-pr-task(PRTask $pr) { project => self!repo-to-db-project($pr.repo), number => $pr.number, base-url => $pr.base-url, - head-url => $pr.head-url, head-branch => $pr.head-branch, user-url => $pr.user-url, status => DB::OPEN, @@ -118,7 +116,7 @@ method !process-pr-commit-task(PRCommitTask $commit) { DB::CITestSet.^create: event-type => DB::PR, :$project, - git-url => $pr.head-url, + git-url => $pr.base-url, commit-sha => $commit.commit-sha, user-url => $commit.user-url, :$pr, @@ -276,6 +274,8 @@ method process-worklist() is serial-dedup { # NOT the head (the repo where the new commits are). # Using the head repo will not work, as that's usually a different repo where the RCB is # not installed on and thus has no permissons to add check_runs. + # In addition it's possible there is no head repo. That is the case when the branch or repo a + # PR is based on has been deleted. # One would think using the base repo can't work, because the commits are not part of that # repository. But there is some almost completely undocumented behavior in GitHub that copies # PR commits to the base repo and even creates merge commits (without the PR being merged!). @@ -333,7 +333,7 @@ method !determine-source-spec(:$project!, :$git-url!, :$commit-sha!, :$pr --> So $rakudo-commit-sha, $nqp-commit-sha, $moar-commit-sha); my $did-things = False; with $pr { - my %head-data = self!github-url-to-project-repo($pr.head-url); + my %head-data = self!github-url-to-project-repo($pr.base-url); if $project == DB::RAKUDO && %head-data eq config.projects.rakudo.repo || $project == DB::NQP && %head-data eq config.projects.nqp.repo || $project == DB::MOAR && %head-data eq config.projects.moar.repo { diff --git a/lib/GitHubInterface.rakumod b/lib/GitHubInterface.rakumod index 4934c5a..9770d97 100644 --- a/lib/GitHubInterface.rakumod +++ b/lib/GitHubInterface.rakumod @@ -65,7 +65,6 @@ method parse-hook-request($event, %json) { if %json eq 'synchronize'|'opened' { $!processor.add-task: GitHubCITestRequester::PRTask.new( repo => %json, - head-url => %json, base-url => %json, head-branch => %json, number => %json, @@ -284,7 +283,6 @@ method retrieve-pulls($project, $repo, :$last-cursor is copy) { GitHubCITestRequester::PRTask.new: :$repo, base-url => %pull-data ~ '.git', - head-url => %pull-data ~ '.git', head-branch => %pull-data, number => %pull-data, title => %pull-data,