File tree Expand file tree Collapse file tree 1 file changed +52
-0
lines changed Expand file tree Collapse file tree 1 file changed +52
-0
lines changed Original file line number Diff line number Diff line change 1+ /**
2+ * close renovate dashboard issues
3+ *
4+ * @param {import('@octoherd/octokit').Octokit } octokit
5+ * @param {import('@octokit/openapi-types').components["schemas"]["repository"] } repository
6+ */
7+ export async function script ( octokit , repository ) {
8+ const owner = repository . owner . login ;
9+ const repo = repository . name ;
10+
11+ if ( repository . archived ) {
12+ octokit . log . info (
13+ { updated : false , reason : "archived" } ,
14+ `${ repository . html_url } is archived`
15+ ) ;
16+ return ;
17+ }
18+
19+ const iterator = await octokit . paginate . iterator (
20+ "GET /repos/{owner}/{repo}/issues" ,
21+ {
22+ owner,
23+ repo,
24+ state : "open" ,
25+ creator : "renovate[bot]" ,
26+ }
27+ ) ;
28+
29+ for await ( const { data : issues } of iterator ) {
30+ for ( const issue of issues ) {
31+ if ( issue . title !== "Dependency Dashboard" ) continue ;
32+
33+ await octokit . request (
34+ "PATCH /repos/{owner}/{repo}/issues/{issue_number}" ,
35+ {
36+ owner,
37+ repo,
38+ issue_number : issue . number ,
39+ state : "closed" ,
40+ }
41+ ) ;
42+
43+ octokit . log . info ( { updated : true } , `${ issue . html_url } closed` ) ;
44+ return ;
45+ }
46+ }
47+
48+ octokit . log . info (
49+ { updated : false , reason : "not found" } ,
50+ `No dashboard issue found in ${ repository . html_url } `
51+ ) ;
52+ }
You can’t perform that action at this time.
0 commit comments