@@ -113,6 +113,9 @@ export default async (bot: DiscordBot): Promise<void> => {
113113 let webhook : Discord . Webhook ;
114114 const bridge = await bot . container . getService ( "GameBridge" ) ;
115115
116+ const github = await bot . container . getService ( "Github" ) ;
117+ const gitlab = await bot . container . getService ( "Gitlab" ) ;
118+
116119 bot . discord . on ( "clientReady" , async ( ) => {
117120 const channel = bot . getTextChannel ( bot . config . channels . publicCommits ) ;
118121 if ( channel ) {
@@ -205,17 +208,15 @@ export default async (bot: DiscordBot): Promise<void> => {
205208 url ?? ""
206209 ) || [ ] ;
207210 try {
208- const res = await (
209- await bot . container . getService ( "Github" )
210- ) . octokit . rest . repos . getCommit ( { owner, repo, ref } ) ;
211+ const res = await github . octokit . rest . repos . getCommit ( { owner, repo, ref } ) ;
211212 files = res . data . files ?. flatMap ( f => f . filename ) ;
212213 } catch ( err ) {
213214 await ctx . reply (
214215 "something went wrong fetching the files from github :( ... aborting\n" +
215216 `\`${ err . message } \``
216217 ) ;
217218 log . error (
218- { err : err , context : { url, owner, repo, ref } } ,
219+ { err, context : { url, owner, repo, ref } } ,
219220 "Failed to fetch files from GitHub"
220221 ) ;
221222 return ;
@@ -226,17 +227,23 @@ export default async (bot: DiscordBot): Promise<void> => {
226227 url ?? ""
227228 ) || [ ] ;
228229 try {
229- const res = await (
230- await bot . container . getService ( "Gitlab" )
231- ) . api . Commits . showDiff ( encodeURIComponent ( id ) , sha ) ;
230+ const res = await gitlab . api . Commits . showDiff ( encodeURIComponent ( id ) , sha ) ;
232231 files = res . filter ( f => ! f . deleted_file ) . flatMap ( f => f . new_path ) ;
233232 } catch ( err ) {
234233 await ctx . reply (
235234 "something went wrong fetching the files from gitlab :( ... aborting\n" +
236235 `\`${ err . message } \``
237236 ) ;
238237 log . error (
239- { err : err , context : { url, id, sha } } ,
238+ {
239+ err,
240+ context : {
241+ url,
242+ id : encodeURIComponent ( id ) ,
243+ sha,
244+ authHeaders : gitlab . api . authHeaders ,
245+ } ,
246+ } ,
240247 "Failed to fetch files from Gitlab"
241248 ) ;
242249 return ;
0 commit comments