Files
tgstation-server/_git_hub_remote_features_8cs_source.html

229 lines
41 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>tgstation-server: src/Tgstation.Server.Host/Components/Repository/GitHubRemoteFeatures.cs Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">tgstation-server<span id="projectnumber">&#160;6.19.3</span>
</div>
<div id="projectbrief">The /tg/station 13 server suite</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.8 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function() { init_codefold(0); });
/* @license-end */
</script>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_34761767c1c3cd212f9d2f80ea0828a8.html">Tgstation.Server.Host</a></li><li class="navelem"><a class="el" href="dir_7a3fd032a1362a6005a1fc9227a8dd86.html">Components</a></li><li class="navelem"><a class="el" href="dir_5d46d0c3fd1cac5ce1ea23751ad25792.html">Repository</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle"><div class="title">GitHubRemoteFeatures.cs</div></div>
</div><!--header-->
<div class="contents">
<a href="_git_hub_remote_features_8cs.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span><span class="keyword">using </span>System;</div>
<div class="line"><a id="l00002" name="l00002"></a><span class="lineno"> 2</span><span class="keyword">using </span>System.Threading;</div>
<div class="line"><a id="l00003" name="l00003"></a><span class="lineno"> 3</span><span class="keyword">using </span>System.Threading.Tasks;</div>
<div class="line"><a id="l00004" name="l00004"></a><span class="lineno"> 4</span> </div>
<div class="line"><a id="l00005" name="l00005"></a><span class="lineno"> 5</span><span class="keyword">using </span>Microsoft.Extensions.Logging;</div>
<div class="line"><a id="l00006" name="l00006"></a><span class="lineno"> 6</span> </div>
<div class="line"><a id="l00007" name="l00007"></a><span class="lineno"> 7</span><span class="keyword">using </span>Octokit;</div>
<div class="line"><a id="l00008" name="l00008"></a><span class="lineno"> 8</span> </div>
<div class="line"><a id="l00009" name="l00009"></a><span class="lineno"> 9</span><span class="keyword">using </span><a class="code hl_namespace" href="namespace_tgstation_1_1_server_1_1_api_1_1_models.html">Tgstation.Server.Api.Models</a>;</div>
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno"> 10</span><span class="keyword">using </span><a class="code hl_namespace" href="namespace_tgstation_1_1_server_1_1_host_1_1_utils_1_1_git_hub.html">Tgstation.Server.Host.Utils.GitHub</a>;</div>
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno"> 11</span> </div>
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno"> 12</span><span class="keyword">namespace </span><a class="code hl_namespace" href="namespace_tgstation_1_1_server_1_1_host_1_1_components_1_1_repository.html">Tgstation.Server.Host.Components.Repository</a></div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span>{</div>
<div class="foldopen" id="foldopen00017" data-start="{" data-end="};">
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_components_1_1_repository_1_1_git_hub_remote_features.html"> 17</a></span> <span class="keyword">sealed</span> <span class="keyword">class </span><a class="code hl_class" href="class_tgstation_1_1_server_1_1_host_1_1_components_1_1_repository_1_1_git_hub_remote_features.html">GitHubRemoteFeatures</a> : <a class="code hl_class" href="class_tgstation_1_1_server_1_1_host_1_1_components_1_1_repository_1_1_git_remote_features_base.html">GitRemoteFeaturesBase</a></div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"> 18</span> {</div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_components_1_1_repository_1_1_git_hub_remote_features.html#ad7bea4abedb7d96cdbd69c0da261ea84"> 20</a></span> <span class="keyword">public</span> <span class="keyword">override</span> <span class="keywordtype">string</span> <a class="code hl_property" href="class_tgstation_1_1_server_1_1_host_1_1_components_1_1_repository_1_1_git_hub_remote_features.html#ad7bea4abedb7d96cdbd69c0da261ea84">TestMergeRefSpecFormatter</a> =&gt; <span class="stringliteral">&quot;pull/{0}/head:{1}&quot;</span>;</div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span> </div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_components_1_1_repository_1_1_git_hub_remote_features.html#a9782822445b7acb55adc9c43473d42a0"> 23</a></span> <span class="keyword">public</span> <span class="keyword">override</span> <span class="keywordtype">string</span> <a class="code hl_property" href="class_tgstation_1_1_server_1_1_host_1_1_components_1_1_repository_1_1_git_hub_remote_features.html#a9782822445b7acb55adc9c43473d42a0">TestMergeLocalBranchNameFormatter</a> =&gt; <span class="stringliteral">&quot;pull/{0}/headrefs/heads/{1}&quot;</span>;</div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span> </div>
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_components_1_1_repository_1_1_git_hub_remote_features.html#ab6884d65e226fa155b99ac07561744ac"> 26</a></span> <span class="keyword">public</span> <span class="keyword">override</span> <a class="code hl_enumeration" href="namespace_tgstation_1_1_server_1_1_api_1_1_models.html#aaff5188f30ee5c04c081684eb9672f17">RemoteGitProvider</a>? <a class="code hl_enumeration" href="namespace_tgstation_1_1_server_1_1_api_1_1_models.html#aaff5188f30ee5c04c081684eb9672f17">RemoteGitProvider</a> =&gt; Api.Models.RemoteGitProvider.GitHub;</div>
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span> </div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_components_1_1_repository_1_1_git_hub_remote_features.html#af3ffbba9538d9189ab1649d3269b413d"> 31</a></span> readonly <a class="code hl_interface" href="interface_tgstation_1_1_server_1_1_host_1_1_utils_1_1_git_hub_1_1_i_git_hub_service_factory.html">IGitHubServiceFactory</a> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_components_1_1_repository_1_1_git_hub_remote_features.html#af3ffbba9538d9189ab1649d3269b413d">gitHubServiceFactory</a>;</div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span> </div>
<div class="foldopen" id="foldopen00039" data-start="{" data-end="}">
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_components_1_1_repository_1_1_git_hub_remote_features.html#abf0e54ab03c05203b2d33c73829dcbd2"> 39</a></span> <span class="keyword">public</span> <a class="code hl_function" href="class_tgstation_1_1_server_1_1_host_1_1_components_1_1_repository_1_1_git_hub_remote_features.html#abf0e54ab03c05203b2d33c73829dcbd2">GitHubRemoteFeatures</a>(<a class="code hl_interface" href="interface_tgstation_1_1_server_1_1_host_1_1_utils_1_1_git_hub_1_1_i_git_hub_service_factory.html">IGitHubServiceFactory</a> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_components_1_1_repository_1_1_git_hub_remote_features.html#af3ffbba9538d9189ab1649d3269b413d">gitHubServiceFactory</a>, ILogger&lt;GitHubRemoteFeatures&gt; logger, Uri remoteUrl)</div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span> : base(logger, remoteUrl)</div>
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span> {</div>
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span> this.gitHubServiceFactory = <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_components_1_1_repository_1_1_git_hub_remote_features.html#af3ffbba9538d9189ab1649d3269b413d">gitHubServiceFactory</a> ?? <span class="keywordflow">throw</span> <span class="keyword">new</span> ArgumentNullException(nameof(<a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_components_1_1_repository_1_1_git_hub_remote_features.html#af3ffbba9538d9189ab1649d3269b413d">gitHubServiceFactory</a>));</div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span> }</div>
</div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span> </div>
<div class="foldopen" id="foldopen00046" data-start="{" data-end="}">
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_components_1_1_repository_1_1_git_hub_remote_features.html#aaa02d6474e84283e05886a67f445bd58"> 46</a></span> <span class="keyword">public</span> <span class="keyword">override</span> async ValueTask&lt;string?&gt; <a class="code hl_function" href="class_tgstation_1_1_server_1_1_host_1_1_components_1_1_repository_1_1_git_hub_remote_features.html#aaa02d6474e84283e05886a67f445bd58">TransformRepositoryPassword</a>(<span class="keywordtype">string</span>? rawPassword, CancellationToken cancellationToken)</div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span> {</div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> <span class="keywordflow">if</span> (rawPassword == <span class="keyword">null</span>)</div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> <span class="keywordflow">return</span> <span class="keyword">null</span>;</div>
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span> </div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> var gitHubService = await <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_components_1_1_repository_1_1_git_hub_remote_features.html#af3ffbba9538d9189ab1649d3269b413d">gitHubServiceFactory</a>.<a class="code hl_function" href="interface_tgstation_1_1_server_1_1_host_1_1_utils_1_1_git_hub_1_1_i_git_hub_service_factory.html#a93de0a6eeb420eec2ecaa935ebabc7b9">CreateService</a>(</div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span> rawPassword,</div>
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span> <span class="keyword">new</span> <a class="code hl_class" href="class_tgstation_1_1_server_1_1_host_1_1_utils_1_1_git_hub_1_1_repository_identifier.html">RepositoryIdentifier</a>(<span class="keyword">this</span>),</div>
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span> cancellationToken);</div>
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"> 55</span> <span class="keywordflow">return</span> gitHubService?.GetGitPassword() ?? rawPassword;</div>
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span> }</div>
</div>
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span> </div>
<div class="foldopen" id="foldopen00059" data-start="{" data-end="}">
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_components_1_1_repository_1_1_git_hub_remote_features.html#ae3d2886c42ac22e3a6e2d91d49143934"> 59</a></span> <span class="keyword">protected</span> <span class="keyword">override</span> async ValueTask&lt;Models.TestMerge&gt; <a class="code hl_function" href="class_tgstation_1_1_server_1_1_host_1_1_components_1_1_repository_1_1_git_hub_remote_features.html#ae3d2886c42ac22e3a6e2d91d49143934">GetTestMergeImpl</a>(</div>
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span> <a class="code hl_class" href="class_tgstation_1_1_server_1_1_api_1_1_models_1_1_test_merge_parameters.html">TestMergeParameters</a> parameters,</div>
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> <a class="code hl_class" href="class_tgstation_1_1_server_1_1_api_1_1_models_1_1_repository_settings.html">RepositorySettings</a> repositorySettings,</div>
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span> CancellationToken cancellationToken)</div>
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span> {</div>
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span> var gitHubService = repositorySettings.AccessToken != <span class="keyword">null</span></div>
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span> ? await <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_components_1_1_repository_1_1_git_hub_remote_features.html#af3ffbba9538d9189ab1649d3269b413d">gitHubServiceFactory</a>.<a class="code hl_function" href="interface_tgstation_1_1_server_1_1_host_1_1_utils_1_1_git_hub_1_1_i_git_hub_service_factory.html#a93de0a6eeb420eec2ecaa935ebabc7b9">CreateService</a>(</div>
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span> repositorySettings.<a class="code hl_property" href="class_tgstation_1_1_server_1_1_api_1_1_models_1_1_repository_settings.html#ab0bca804385494f141395c333ea81221">AccessToken</a>,</div>
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"> 67</span> <span class="keyword">new</span> <a class="code hl_class" href="class_tgstation_1_1_server_1_1_host_1_1_utils_1_1_git_hub_1_1_repository_identifier.html">RepositoryIdentifier</a>(<span class="keyword">this</span>),</div>
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span> cancellationToken)</div>
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"> 69</span> : await <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_components_1_1_repository_1_1_git_hub_remote_features.html#af3ffbba9538d9189ab1649d3269b413d">gitHubServiceFactory</a>.<a class="code hl_function" href="interface_tgstation_1_1_server_1_1_host_1_1_utils_1_1_git_hub_1_1_i_git_hub_service_factory.html#a93de0a6eeb420eec2ecaa935ebabc7b9">CreateService</a>(cancellationToken);</div>
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span> </div>
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span> PullRequest? pr = <span class="keyword">null</span>;</div>
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"> 72</span> ApiException? exception = <span class="keyword">null</span>;</div>
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span> <span class="keywordtype">string</span>? errorMessage = <span class="keyword">null</span>;</div>
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span> <span class="keywordflow">if</span> (gitHubService == <span class="keyword">null</span>)</div>
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno"> 75</span> errorMessage = <span class="stringliteral">&quot;GITHUB API ERROR: AUTH FAILURE&quot;</span>;</div>
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"> 76</span> <span class="keywordflow">else</span></div>
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span> <span class="keywordflow">try</span></div>
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> {</div>
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> pr = await gitHubService.GetPullRequest(<a class="code hl_property" href="class_tgstation_1_1_server_1_1_host_1_1_components_1_1_repository_1_1_git_remote_features_base.html#a528e240239082f9d33e024c5c5214ac0">RemoteRepositoryOwner</a>, <a class="code hl_property" href="class_tgstation_1_1_server_1_1_host_1_1_components_1_1_repository_1_1_git_remote_features_base.html#adeb8c85bfd85546c9cf858d95caf1a2c">RemoteRepositoryName</a>, parameters.<a class="code hl_property" href="class_tgstation_1_1_server_1_1_api_1_1_models_1_1_test_merge_parameters.html#a91cb81663a87f96476a47a2628ac1a86">Number</a>, cancellationToken);</div>
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span> }</div>
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"> 81</span> <span class="keywordflow">catch</span> (RateLimitExceededException ex)</div>
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno"> 82</span> {</div>
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno"> 83</span> <span class="comment">// you look at your anonymous access and sigh</span></div>
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno"> 84</span> errorMessage = <span class="stringliteral">&quot;GITHUB API ERROR: RATE LIMITED&quot;</span>;</div>
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno"> 85</span> exception = ex;</div>
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno"> 86</span> }</div>
<div class="line"><a id="l00087" name="l00087"></a><span class="lineno"> 87</span> <span class="keywordflow">catch</span> (AuthorizationException ex)</div>
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"> 88</span> {</div>
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span> errorMessage = <span class="stringliteral">&quot;GITHUB API ERROR: BAD CREDENTIALS&quot;</span>;</div>
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno"> 90</span> exception = ex;</div>
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno"> 91</span> }</div>
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno"> 92</span> <span class="keywordflow">catch</span> (NotFoundException ex)</div>
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno"> 93</span> {</div>
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno"> 94</span> <span class="comment">// you look at your shithub and sigh</span></div>
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno"> 95</span> errorMessage = <span class="stringliteral">&quot;GITHUB API ERROR: PULL REQUEST NOT FOUND&quot;</span>;</div>
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno"> 96</span> exception = ex;</div>
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno"> 97</span> }</div>
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno"> 98</span> </div>
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno"> 99</span> <span class="keywordflow">if</span> (exception != <span class="keyword">null</span>)</div>
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno"> 100</span> <a class="code hl_property" href="class_tgstation_1_1_server_1_1_host_1_1_components_1_1_repository_1_1_git_remote_features_base.html#aa93edf27d4c5255e22771d14350e6a32">Logger</a>.LogWarning(exception, <span class="stringliteral">&quot;Error retrieving pull request metadata!&quot;</span>);</div>
<div class="line"><a id="l00101" name="l00101"></a><span class="lineno"> 101</span> </div>
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno"> 102</span> var revisionToUse = parameters.TargetCommitSha == <span class="keyword">null</span></div>
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno"> 103</span> || pr?.Head.Sha.StartsWith(parameters.<a class="code hl_property" href="class_tgstation_1_1_server_1_1_api_1_1_models_1_1_test_merge_parameters.html#a1b7f38a2ee2f645796ffeb89fe51b2ce">TargetCommitSha</a>, StringComparison.OrdinalIgnoreCase) == <span class="keyword">true</span></div>
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno"> 104</span> ? pr?.Head.Sha</div>
<div class="line"><a id="l00105" name="l00105"></a><span class="lineno"> 105</span> : parameters.<a class="code hl_property" href="class_tgstation_1_1_server_1_1_api_1_1_models_1_1_test_merge_parameters.html#a1b7f38a2ee2f645796ffeb89fe51b2ce">TargetCommitSha</a>;</div>
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno"> 106</span> </div>
<div class="line"><a id="l00107" name="l00107"></a><span class="lineno"> 107</span> var testMerge = <span class="keyword">new</span> <a class="code hl_class" href="class_tgstation_1_1_server_1_1_host_1_1_models_1_1_test_merge.html">Models.TestMerge</a></div>
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno"> 108</span> {</div>
<div class="line"><a id="l00109" name="l00109"></a><span class="lineno"> 109</span> Author = pr?.User.Login ?? errorMessage,</div>
<div class="line"><a id="l00110" name="l00110"></a><span class="lineno"> 110</span> BodyAtMerge = pr?.Body ?? errorMessage ?? String.Empty,</div>
<div class="line"><a id="l00111" name="l00111"></a><span class="lineno"> 111</span> TitleAtMerge = pr?.Title ?? errorMessage ?? String.Empty,</div>
<div class="line"><a id="l00112" name="l00112"></a><span class="lineno"> 112</span> Comment = parameters.<a class="code hl_property" href="class_tgstation_1_1_server_1_1_api_1_1_models_1_1_test_merge_parameters.html#a556ffae15694a68aa1c78f851407eb5b">Comment</a>,</div>
<div class="line"><a id="l00113" name="l00113"></a><span class="lineno"> 113</span> Number = parameters.<a class="code hl_property" href="class_tgstation_1_1_server_1_1_api_1_1_models_1_1_test_merge_parameters.html#a91cb81663a87f96476a47a2628ac1a86">Number</a>,</div>
<div class="line"><a id="l00114" name="l00114"></a><span class="lineno"> 114</span> TargetCommitSha = revisionToUse,</div>
<div class="line"><a id="l00115" name="l00115"></a><span class="lineno"> 115</span> Url = pr?.HtmlUrl ?? $<span class="stringliteral">&quot;https://github.com/{RemoteRepositoryOwner}/{RemoteRepositoryName}/pull/{parameters.Number}&quot;</span>,</div>
<div class="line"><a id="l00116" name="l00116"></a><span class="lineno"> 116</span> };</div>
<div class="line"><a id="l00117" name="l00117"></a><span class="lineno"> 117</span> </div>
<div class="line"><a id="l00118" name="l00118"></a><span class="lineno"> 118</span> <span class="keywordflow">return</span> testMerge;</div>
<div class="line"><a id="l00119" name="l00119"></a><span class="lineno"> 119</span> }</div>
</div>
<div class="line"><a id="l00120" name="l00120"></a><span class="lineno"> 120</span> }</div>
</div>
<div class="line"><a id="l00121" name="l00121"></a><span class="lineno"> 121</span>}</div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_api_1_1_models_1_1_repository_settings_html"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_api_1_1_models_1_1_repository_settings.html">Tgstation.Server.Api.Models.RepositorySettings</a></div><div class="ttdoc">Represents configurable settings for a git repository.</div><div class="ttdef"><b>Definition</b> <a href="_tgstation_8_server_8_api_2_models_2_repository_settings_8cs_source.html#l00008">RepositorySettings.cs:9</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_api_1_1_models_1_1_repository_settings_html_ab0bca804385494f141395c333ea81221"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_api_1_1_models_1_1_repository_settings.html#ab0bca804385494f141395c333ea81221">Tgstation.Server.Api.Models.RepositorySettings.AccessToken</a></div><div class="ttdeci">string? AccessToken</div><div class="ttdoc">The token/password to access the git repository with. Can also be a TGS encoded app private key....</div><div class="ttdef"><b>Definition</b> <a href="_tgstation_8_server_8_api_2_models_2_repository_settings_8cs_source.html#l00042">RepositorySettings.cs:42</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_api_1_1_models_1_1_test_merge_parameters_html"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_api_1_1_models_1_1_test_merge_parameters.html">Tgstation.Server.Api.Models.TestMergeParameters</a></div><div class="ttdoc">Parameters for creating a TestMerge.</div><div class="ttdef"><b>Definition</b> <a href="_test_merge_parameters_8cs_source.html#l00008">TestMergeParameters.cs:9</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_api_1_1_models_1_1_test_merge_parameters_html_a1b7f38a2ee2f645796ffeb89fe51b2ce"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_api_1_1_models_1_1_test_merge_parameters.html#a1b7f38a2ee2f645796ffeb89fe51b2ce">Tgstation.Server.Api.Models.TestMergeParameters.TargetCommitSha</a></div><div class="ttdeci">virtual ? string TargetCommitSha</div><div class="ttdoc">The sha of the test merge revision to merge. If not specified, the latest commit from the source will...</div><div class="ttdef"><b>Definition</b> <a href="_test_merge_parameters_8cs_source.html#l00022">TestMergeParameters.cs:22</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_api_1_1_models_1_1_test_merge_parameters_html_a556ffae15694a68aa1c78f851407eb5b"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_api_1_1_models_1_1_test_merge_parameters.html#a556ffae15694a68aa1c78f851407eb5b">Tgstation.Server.Api.Models.TestMergeParameters.Comment</a></div><div class="ttdeci">string? Comment</div><div class="ttdoc">Optional comment about the test.</div><div class="ttdef"><b>Definition</b> <a href="_test_merge_parameters_8cs_source.html#l00030">TestMergeParameters.cs:30</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_api_1_1_models_1_1_test_merge_parameters_html_a91cb81663a87f96476a47a2628ac1a86"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_api_1_1_models_1_1_test_merge_parameters.html#a91cb81663a87f96476a47a2628ac1a86">Tgstation.Server.Api.Models.TestMergeParameters.Number</a></div><div class="ttdeci">int Number</div><div class="ttdoc">The number of the test merge source.</div><div class="ttdef"><b>Definition</b> <a href="_test_merge_parameters_8cs_source.html#l00014">TestMergeParameters.cs:14</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_components_1_1_repository_1_1_git_hub_remote_features_html"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_components_1_1_repository_1_1_git_hub_remote_features.html">Tgstation.Server.Host.Components.Repository.GitHubRemoteFeatures</a></div><div class="ttdoc">GitHub IGitRemoteFeatures.</div><div class="ttdef"><b>Definition</b> <a href="_git_hub_remote_features_8cs_source.html#l00017">GitHubRemoteFeatures.cs:18</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_components_1_1_repository_1_1_git_hub_remote_features_html_a9782822445b7acb55adc9c43473d42a0"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_components_1_1_repository_1_1_git_hub_remote_features.html#a9782822445b7acb55adc9c43473d42a0">Tgstation.Server.Host.Components.Repository.GitHubRemoteFeatures.TestMergeLocalBranchNameFormatter</a></div><div class="ttdeci">override string TestMergeLocalBranchNameFormatter</div><div class="ttdoc">Get.</div><div class="ttdef"><b>Definition</b> <a href="_git_hub_remote_features_8cs_source.html#l00023">GitHubRemoteFeatures.cs:23</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_components_1_1_repository_1_1_git_hub_remote_features_html_aaa02d6474e84283e05886a67f445bd58"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_components_1_1_repository_1_1_git_hub_remote_features.html#aaa02d6474e84283e05886a67f445bd58">Tgstation.Server.Host.Components.Repository.GitHubRemoteFeatures.TransformRepositoryPassword</a></div><div class="ttdeci">override async ValueTask&lt; string?&gt; TransformRepositoryPassword(string? rawPassword, CancellationToken cancellationToken)</div><div class="ttdoc">Transform a service's rawPassword into a password usable by git.A ValueTask&lt;TResult&gt; resulting in th...</div><div class="ttdef"><b>Definition</b> <a href="_git_hub_remote_features_8cs_source.html#l00046">GitHubRemoteFeatures.cs:46</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_components_1_1_repository_1_1_git_hub_remote_features_html_abf0e54ab03c05203b2d33c73829dcbd2"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_components_1_1_repository_1_1_git_hub_remote_features.html#abf0e54ab03c05203b2d33c73829dcbd2">Tgstation.Server.Host.Components.Repository.GitHubRemoteFeatures.GitHubRemoteFeatures</a></div><div class="ttdeci">GitHubRemoteFeatures(IGitHubServiceFactory gitHubServiceFactory, ILogger&lt; GitHubRemoteFeatures &gt; logger, Uri remoteUrl)</div><div class="ttdoc">Initializes a new instance of the GitHubRemoteFeatures class.</div><div class="ttdef"><b>Definition</b> <a href="_git_hub_remote_features_8cs_source.html#l00039">GitHubRemoteFeatures.cs:39</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_components_1_1_repository_1_1_git_hub_remote_features_html_ad7bea4abedb7d96cdbd69c0da261ea84"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_components_1_1_repository_1_1_git_hub_remote_features.html#ad7bea4abedb7d96cdbd69c0da261ea84">Tgstation.Server.Host.Components.Repository.GitHubRemoteFeatures.TestMergeRefSpecFormatter</a></div><div class="ttdeci">override string TestMergeRefSpecFormatter</div><div class="ttdoc">Gets a formatter string which creates the remote refspec for fetching the HEAD of passed in test merg...</div><div class="ttdef"><b>Definition</b> <a href="_git_hub_remote_features_8cs_source.html#l00020">GitHubRemoteFeatures.cs:20</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_components_1_1_repository_1_1_git_hub_remote_features_html_ae3d2886c42ac22e3a6e2d91d49143934"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_components_1_1_repository_1_1_git_hub_remote_features.html#ae3d2886c42ac22e3a6e2d91d49143934">Tgstation.Server.Host.Components.Repository.GitHubRemoteFeatures.GetTestMergeImpl</a></div><div class="ttdeci">override async ValueTask&lt; Models.TestMerge &gt; GetTestMergeImpl(TestMergeParameters parameters, RepositorySettings repositorySettings, CancellationToken cancellationToken)</div><div class="ttdef"><b>Definition</b> <a href="_git_hub_remote_features_8cs_source.html#l00059">GitHubRemoteFeatures.cs:59</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_components_1_1_repository_1_1_git_hub_remote_features_html_af3ffbba9538d9189ab1649d3269b413d"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_components_1_1_repository_1_1_git_hub_remote_features.html#af3ffbba9538d9189ab1649d3269b413d">Tgstation.Server.Host.Components.Repository.GitHubRemoteFeatures.gitHubServiceFactory</a></div><div class="ttdeci">readonly IGitHubServiceFactory gitHubServiceFactory</div><div class="ttdoc">The IGitHubServiceFactory for the GitHubRemoteFeatures.</div><div class="ttdef"><b>Definition</b> <a href="_git_hub_remote_features_8cs_source.html#l00031">GitHubRemoteFeatures.cs:31</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_components_1_1_repository_1_1_git_remote_features_base_html"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_components_1_1_repository_1_1_git_remote_features_base.html">Tgstation.Server.Host.Components.Repository.GitRemoteFeaturesBase</a></div><div class="ttdoc">Base class for implementing IGitRemoteFeatures.</div><div class="ttdef"><b>Definition</b> <a href="_git_remote_features_base_8cs_source.html#l00015">GitRemoteFeaturesBase.cs:16</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_components_1_1_repository_1_1_git_remote_features_base_html_a528e240239082f9d33e024c5c5214ac0"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_components_1_1_repository_1_1_git_remote_features_base.html#a528e240239082f9d33e024c5c5214ac0">Tgstation.Server.Host.Components.Repository.GitRemoteFeaturesBase.RemoteRepositoryOwner</a></div><div class="ttdeci">string RemoteRepositoryOwner</div><div class="ttdoc">If RemoteGitProvider is not RemoteGitProvider.Unknown this will be set with the owner of the reposito...</div><div class="ttdef"><b>Definition</b> <a href="_git_remote_features_base_8cs_source.html#l00027">GitRemoteFeaturesBase.cs:27</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_components_1_1_repository_1_1_git_remote_features_base_html_aa93edf27d4c5255e22771d14350e6a32"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_components_1_1_repository_1_1_git_remote_features_base.html#aa93edf27d4c5255e22771d14350e6a32">Tgstation.Server.Host.Components.Repository.GitRemoteFeaturesBase.Logger</a></div><div class="ttdeci">ILogger&lt; GitRemoteFeaturesBase &gt; Logger</div><div class="ttdoc">The ILogger for the GitRemoteFeaturesBase.</div><div class="ttdef"><b>Definition</b> <a href="_git_remote_features_base_8cs_source.html#l00035">GitRemoteFeaturesBase.cs:35</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_components_1_1_repository_1_1_git_remote_features_base_html_adeb8c85bfd85546c9cf858d95caf1a2c"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_components_1_1_repository_1_1_git_remote_features_base.html#adeb8c85bfd85546c9cf858d95caf1a2c">Tgstation.Server.Host.Components.Repository.GitRemoteFeaturesBase.RemoteRepositoryName</a></div><div class="ttdeci">string RemoteRepositoryName</div><div class="ttdoc">If RemoteGitProvider is not RemoteGitProvider.Unknown this will be set with the name of the repositor...</div><div class="ttdef"><b>Definition</b> <a href="_git_remote_features_base_8cs_source.html#l00030">GitRemoteFeaturesBase.cs:30</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_models_1_1_test_merge_html"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_models_1_1_test_merge.html">Tgstation.Server.Host.Models.TestMerge</a></div><div class="ttdef"><b>Definition</b> <a href="_tgstation_8_server_8_host_2_models_2_test_merge_8cs_source.html#l00008">TestMerge.cs:9</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_utils_1_1_git_hub_1_1_repository_identifier_html"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_utils_1_1_git_hub_1_1_repository_identifier.html">Tgstation.Server.Host.Utils.GitHub.RepositoryIdentifier</a></div><div class="ttdoc">Identifies a repository either by its RepositoryId or Owner and Name.</div><div class="ttdef"><b>Definition</b> <a href="_repository_identifier_8cs_source.html#l00012">RepositoryIdentifier.cs:13</a></div></div>
<div class="ttc" id="ainterface_tgstation_1_1_server_1_1_host_1_1_utils_1_1_git_hub_1_1_i_git_hub_service_factory_html"><div class="ttname"><a href="interface_tgstation_1_1_server_1_1_host_1_1_utils_1_1_git_hub_1_1_i_git_hub_service_factory.html">Tgstation.Server.Host.Utils.GitHub.IGitHubServiceFactory</a></div><div class="ttdoc">Factory for IGitHubServices.</div><div class="ttdef"><b>Definition</b> <a href="_i_git_hub_service_factory_8cs_source.html#l00009">IGitHubServiceFactory.cs:10</a></div></div>
<div class="ttc" id="ainterface_tgstation_1_1_server_1_1_host_1_1_utils_1_1_git_hub_1_1_i_git_hub_service_factory_html_a93de0a6eeb420eec2ecaa935ebabc7b9"><div class="ttname"><a href="interface_tgstation_1_1_server_1_1_host_1_1_utils_1_1_git_hub_1_1_i_git_hub_service_factory.html#a93de0a6eeb420eec2ecaa935ebabc7b9">Tgstation.Server.Host.Utils.GitHub.IGitHubServiceFactory.CreateService</a></div><div class="ttdeci">ValueTask&lt; IGitHubService &gt; CreateService(CancellationToken cancellationToken)</div><div class="ttdoc">Create a IGitHubService.</div></div>
<div class="ttc" id="anamespace_tgstation_1_1_server_1_1_api_1_1_models_html"><div class="ttname"><a href="namespace_tgstation_1_1_server_1_1_api_1_1_models.html">Tgstation.Server.Api.Models</a></div><div class="ttdef"><b>Definition</b> <a href="_tgstation_8_server_8_api_2_models_2_chat_channel_8cs_source.html#l00005">ChatChannel.cs:6</a></div></div>
<div class="ttc" id="anamespace_tgstation_1_1_server_1_1_api_1_1_models_html_aaff5188f30ee5c04c081684eb9672f17"><div class="ttname"><a href="namespace_tgstation_1_1_server_1_1_api_1_1_models.html#aaff5188f30ee5c04c081684eb9672f17">Tgstation.Server.Api.Models.RemoteGitProvider</a></div><div class="ttdeci">RemoteGitProvider</div><div class="ttdoc">Indicates the remote git host.</div><div class="ttdef"><b>Definition</b> <a href="_remote_git_provider_8cs_source.html#l00006">RemoteGitProvider.cs:7</a></div></div>
<div class="ttc" id="anamespace_tgstation_1_1_server_1_1_host_1_1_components_1_1_repository_html"><div class="ttname"><a href="namespace_tgstation_1_1_server_1_1_host_1_1_components_1_1_repository.html">Tgstation.Server.Host.Components.Repository</a></div><div class="ttdef"><b>Definition</b> <a href="_default_git_remote_features_8cs_source.html#l00007">DefaultGitRemoteFeatures.cs:8</a></div></div>
<div class="ttc" id="anamespace_tgstation_1_1_server_1_1_host_1_1_utils_1_1_git_hub_html"><div class="ttname"><a href="namespace_tgstation_1_1_server_1_1_host_1_1_utils_1_1_git_hub.html">Tgstation.Server.Host.Utils.GitHub</a></div><div class="ttdef"><b>Definition</b> <a href="_git_hub_client_factory_8cs_source.html#l00022">GitHubClientFactory.cs:23</a></div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.8
</small></address>
</body>
</html>