@@ -4,9 +4,9 @@ export default async ({ github, core, process }) => {
44 const repo = "terraform-provider-rancher2" ;
55 const mergeCommitSha = process . env . MERGE_COMMIT_SHA ;
66 const assignees = JSON . parse ( process . env . TERRAFORM_MAINTAINERS ) ;
7+ let response ; // used to hold all github responses
78
89 // https://docs.github.com/en/rest/commits/commits?apiVersion=2022-11-28#list-pull-requests-associated-with-a-commit
9- let response ;
1010 try {
1111 response = await github . rest . repos . listPullRequestsAssociatedWithCommit ( {
1212 owner,
@@ -30,50 +30,50 @@ export default async ({ github, core, process }) => {
3030 core . info ( `Found associated PR: #${ pr . number } ` ) ;
3131
3232 // https://docs.github.com/en/rest/search/search?apiVersion=2022-11-28#search-issues-and-pull-requests
33- core . info ( `Searching for 'internal/main ' issue linked to PR #${ pr . number } ` ) ;
33+ core . info ( `Searching for 'internal/tracking ' issue linked to PR #${ pr . number } ` ) ;
3434 try {
3535 response = await github . request ( 'GET /search/issues' , {
36- q : `is:issue state:open label:"internal/main " repo:${ owner } /${ repo } in:body #${ pr . number } ` ,
36+ q : `is:issue state:open label:"internal/tracking " repo:${ owner } /${ repo } in:body #${ pr . number } ` ,
3737 advanced_search : true ,
3838 headers : {
3939 'X-GitHub-Api-Version' : '2022-11-28'
4040 }
4141 } ) ;
4242 } catch ( error ) {
43- core . setFailed ( `Failed to search for main issue for PR #${ pr . number } : ${ error . message } ` ) ;
43+ core . setFailed ( `Failed to search for internal/tracking issue for PR #${ pr . number } : ${ error . message } ` ) ;
4444 }
4545 const searchResults = response . data ;
4646 if ( searchResults . total_count === 0 ) {
47- core . info ( `No 'internal/main ' issue found for PR #${ pr . number } . Exiting.` ) ;
47+ core . info ( `No 'internal/tracking ' issue found for PR #${ pr . number } . Exiting.` ) ;
4848 return ;
4949 }
50- const mainIssue = searchResults . items [ 0 ] ;
51- core . info ( `Found main issue: #${ mainIssue . number } ` ) ;
50+ const trackingIssue = searchResults . items [ 0 ] ;
51+ core . info ( `Found tracking issue: #${ trackingIssue . number } ` ) ;
5252
5353 // https://docs.github.com/en/rest/issues/sub-issues?apiVersion=2022-11-28#add-sub-issue
54- core . info ( `Fetching sub-issues for main issue #${ mainIssue . number } ` ) ;
54+ core . info ( `Fetching sub-issues for tracking issue #${ trackingIssue . number } ` ) ;
5555 try {
5656 response = await github . request ( 'GET /repos/{owner}/{repo}/issues/{issue_number}/sub_issues' , {
5757 owner : owner ,
5858 repo : repo ,
59- issue_number : mainIssue . number ,
59+ issue_number : trackingIssue . number ,
6060 headers : {
6161 'X-GitHub-Api-Version' : '2022-11-28'
6262 }
6363 } ) ;
6464 } catch ( error ) {
65- core . setFailed ( `Failed to fetch sub-issues for main issue #${ mainIssue . number } : ${ error . message } ` ) ;
65+ core . setFailed ( `Failed to fetch sub-issues for tracking issue #${ trackingIssue . number } : ${ error . message } ` ) ;
6666 }
67- const subIssues = response . data . sub_issues ;
67+ const subIssues = response . data ;
6868 if ( subIssues . length === 0 ) {
69- core . info ( `No sub-issues found for issue #${ mainIssue . number } . Exiting.` ) ;
69+ core . info ( `No sub-issues found for issue #${ trackingIssue . number } . Exiting.` ) ;
7070 return ;
7171 }
7272 core . info ( `Found ${ subIssues . length } sub-issues.` ) ;
7373
7474 for ( const subIssue of subIssues ) {
75- core . info ( `Processing sub-issue #${ subIssue . number } ...` ) ;
7675 const subIssueNumber = subIssue . number ;
76+ core . info ( `Processing sub-issue #${ subIssueNumber } ...` ) ;
7777
7878 // Find the release label directly on the sub-issue object
7979 const releaseLabel = subIssue . labels . find ( label => label . name . startsWith ( 'release/v' ) ) ;
@@ -105,7 +105,7 @@ export default async ({ github, core, process }) => {
105105 base : targetBranch ,
106106 body : [
107107 `This pull request cherry-picks the changes from #${ pr . number } into ${ targetBranch } ` ,
108- `Addresses #${ subIssueNumber } for #${ mainIssue . number } ` ,
108+ `Addresses #${ subIssueNumber } for #${ trackingIssue . number } ` ,
109109 `**WARNING!**: to avoid having to resolve merge conflicts this PR is generated with 'git cherry-pick -X theirs'.` ,
110110 `Please make sure to carefully inspect this PR so that you don't accidentally revert anything!` ,
111111 `Please add the proper milestone to this PR` ,
0 commit comments