Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/validators/pull_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ def self.repository_check(project)
end

if result[:reason] == 'error'
return "The GitHub repository '#{project.github_owner_name_pair}' could not be confirmed. Error details: #{result[:error]}"
return "The GitHub repository '#{project.github_owner_name_pair}' could not be confirmed. " \
"Please verify the repository exists and that the `upforgrabs.link` value in `#{project.relative_path}` is correct."
end

nil
Expand All @@ -153,7 +154,8 @@ def self.label_check(project)
end

if result[:reason] == 'error'
return "An error occurred while querying for the project label. Details: #{result[:error]}"
return "An error occurred while querying for the project label for '#{project.github_owner_name_pair}'. " \
"Please verify the `upforgrabs.name` and `upforgrabs.link` values in `#{project.relative_path}`."
end

if result[:reason] == 'repository-missing'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<!-- PULL REQUEST ANALYZER GITHUB ACTION -->

:wave: I'm a robot checking the state of this pull request to save the human reviewers time. I noticed this PR added or modififed the data files under `_data/projects/` so I had a look at what's changed.

As you make changes to this pull request, I'll re-run these checks.

#### `_data/projects/project.yml` :x:
An error occurred while querying for the project label for 'owner/repo'. Please verify the `upforgrabs.name` and `upforgrabs.link` values in `_data/projects/project.yml`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
name: Some Project
desc: This is very much a project
site: https://github.com/owner/repo
tags:
- tag
- tag2
- tag3
- tag4
upforgrabs:
name: label
link: https://github.com/owner/repo/labels/label
20 changes: 20 additions & 0 deletions test/validators/pull_request_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,26 @@ def test_one_file_with_label_error
assert_markdown 'one-file-label-error', message
end

def test_one_file_with_label_query_error
dir = get_test_directory('one-file-label-query-error')
files = get_files_in_directory('one-file-label-query-error')

GitHubRepositoryActiveCheck
.expects(:run)
.returns({})

GitHubRepositoryLabelActiveCheck
.expects(:run)
.returns({
reason: 'error',
error: RuntimeError.new('some API error')
})

message = PullRequestValidator.generate_comment(dir, files)

assert_markdown 'one-file-label-query-error', message
end

def test_two_files_with_no_problems_lists_both_files
dir = get_test_directory('two-valid-files')
files = get_files_in_directory('two-valid-files')
Expand Down