@@ -105,7 +105,7 @@ private void assertDependencyDiff(Status status, Set<Dependency> diff) {
105
105
106
106
private Status dependabotUpdateStatus (File clonedRepo , String orgRepository ) {
107
107
String githubServerTime = getGitHubServerTime ();
108
- triggerDependabotCheck (clonedRepo );
108
+ triggerDependabotCheck (orgRepository , clonedRepo );
109
109
waitForDependabotJobsToFinish (orgRepository , githubServerTime );
110
110
return waitForDependabotPrsToFinish (githubServerTime );
111
111
}
@@ -162,7 +162,7 @@ private String getGitHubServerTime() {
162
162
return serverTime ;
163
163
}
164
164
165
- private void triggerDependabotCheck (File clonedRepo ) {
165
+ private void triggerDependabotCheck (String orgRepository , File clonedRepo ) {
166
166
log .info ("Will trigger a Dependabot check..." );
167
167
try {
168
168
String filePath = ".github/dependabot.yml" ;
@@ -179,7 +179,10 @@ private void triggerDependabotCheck(File clonedRepo) {
179
179
log .info ("Added trigger comment to dependabot.yml" );
180
180
}
181
181
Files .writeString (path , fileContent );
182
+ String githubToken = ghToken ();
182
183
ProcessRunner branchProcessRunner = processRunnerForBranch (clonedRepo );
184
+ branchProcessRunner .run ("git" , "remote" , "set-url" , "origin" ,
185
+ "https://x-access-token:" + githubToken + "@github.com/" + orgRepository + ".git" );
183
186
branchProcessRunner .run ("git" , "config" , "user.name" , "GitHub Action" );
184
187
branchProcessRunner .
run (
"git" ,
"config" ,
"user.email" ,
"[email protected] " );
185
188
branchProcessRunner .run ("git" , "add" , filePath );
@@ -194,6 +197,10 @@ private void triggerDependabotCheck(File clonedRepo) {
194
197
log .info ("Triggered Dependabot check" );
195
198
}
196
199
200
+ String ghToken () {
201
+ return System .getenv ("GH_TOKEN" );
202
+ }
203
+
197
204
ProcessRunner processRunnerForBranch (File clonedRepo ) {
198
205
return new ProcessRunner (this .processRunner , clonedRepo );
199
206
}
0 commit comments