'No commit found for the ref master'
https://sentry.io/organizations/red-hat-0p/issues/1563633370

Caused by https://github.com/packit-service-testing-organisation/source-git-initscripts/pull/1 (upstream has no `master` branch)

```
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/celery/app/trace.py", line 385, in trace_task
    R = retval = fun(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/celery/app/trace.py", line 650, in __protected_call__
    return self.run(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/sentry_sdk/integrations/celery.py", line 169, in _inner
    reraise(*exc_info)
  File "/usr/local/lib/python3.7/site-packages/sentry_sdk/_compat.py", line 57, in reraise
    raise value
  File "/usr/local/lib/python3.7/site-packages/sentry_sdk/integrations/celery.py", line 164, in _inner
    return f(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/packit_service/worker/tasks.py", line 55, in process_message
    return SteveJobs().process_message(event=event, topic=topic)
  File "/usr/local/lib/python3.7/site-packages/packit_service/worker/jobs.py", line 323, in process_message
    jobs_results = self.process_jobs(event_object)
  File "/usr/local/lib/python3.7/site-packages/packit_service/worker/jobs.py", line 148, in process_jobs
    package_config = event.get_package_config()
  File "/usr/local/lib/python3.7/site-packages/packit_service/service/events.py", line 281, in get_package_config
    fail_when_missing=False,
  File "/usr/local/lib/python3.7/site-packages/packit_service/config.py", line 146, in get_package_config_from_repo
    project, reference
  File "/usr/local/lib/python3.7/site-packages/packit/config/package_config.py", line 318, in get_package_config_from_repo
    spec_file_path=get_specfile_path_from_repo(sourcegit_project),
  File "/usr/local/lib/python3.7/site-packages/packit/config/package_config.py", line 366, in get_specfile_path_from_repo
    spec_files = project.get_files(filter_regex=r".+\\.spec$")
  File "/usr/lib/python3.7/site-packages/ogr/services/github/project.py", line 411, in get_files
    contents = self.github_repo.get_contents(path="", ref=ref)
  File "/usr/lib/python3.7/site-packages/github/Repository.py", line 1514, in get_contents
    parameters=url_parameters
  File "/usr/lib/python3.7/site-packages/github/Requester.py", line 276, in requestJsonAndCheck
    return self.__check(*self.requestJson(verb, url, parameters, headers, input, self.__customConnection(url)))
  File "/usr/lib/python3.7/site-packages/github/Requester.py", line 287, in __check
    raise self.__createException(status, responseHeaders, output)
github.GithubException.GithubException: 404 {'message': 'No commit found for the ref master', 'documentation_url': 'https://developer.github.com/v3/repos/contents/' }
```
diff --git a/packit/config/package_config.py b/packit/config/package_config.py
index d15ea636..7ee748ce 100644
--- a/packit/config/package_config.py
+++ b/packit/config/package_config.py
@@ -315,7 +315,7 @@ def get_package_config_from_repo(
         loaded_config=loaded_config,
         config_file_path=config_file_name,
         repo_name=sourcegit_project.repo,
-        spec_file_path=get_specfile_path_from_repo(sourcegit_project),
+        spec_file_path=get_specfile_path_from_repo(sourcegit_project, ref),
     )
 
 
@@ -357,13 +357,16 @@ def get_local_specfile_path(directories: Union[List[str], List[Path]]) -> Option
     return None
 
 
-def get_specfile_path_from_repo(project: GitProject) -> Optional[str]:
+def get_specfile_path_from_repo(
+    project: GitProject, ref: str = "master"
+) -> Optional[str]:
     """
     Get the path of the spec file in the given repo if present.
     :param project: GitProject
+    :param ref: git ref
     :return: str path of the spec file or None
     """
-    spec_files = project.get_files(filter_regex=r".+\\.spec$")
+    spec_files = project.get_files(ref=ref, filter_regex=r".+\\.spec$")
     if not spec_files:
         logger.debug(f"No spec file found in {project.full_repo_name}")
         return None
['packit/config/package_config.py']