Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/backport-prs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
const { data: associatedPrs } = await github.rest.repos.listPullRequestsAssociatedWithCommit({
owner,
repo,
commit_sha: mergeCommitSha,
commit_sha: mergeCommitSha
});
const pr = associatedPrs.find(p => p.base.ref === 'main' && p.merged_at);
if (!pr) {
Expand All @@ -46,10 +46,12 @@ jobs:
core.info(`Searching for 'internal/main' issue linked to PR #${pr.number}`);
const { data: searchResults } = await github.request('GET /search/issues', {
q: `is:issue label:"internal/main" repo:${owner}/${repo} in:body #${pr.number}`,
advanced_search: true,
headers: {
'X-GitHub-Api-Version': '2022-11-28'
}
});
core.info(`Search results: ${searchResults}`)
if (searchResults.data.total_count === 0) {
core.info(`No 'internal/main' issue found for PR #${pr.number}. Exiting.`);
return;
Expand Down
13 changes: 10 additions & 3 deletions .github/workflows/backport.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,21 @@ jobs:
const repo = context.repo.repo;
const owner = context.repo.owner;

// Get terraform-maintainers team
const { data: teamMembers } = await github.rest.teams.listMembersInOrg({
org: "rancher",
team_slug: "terraform-maintainers"
});
const newAssignees = teamMembers.map(member => member.login);

// Create the sub-issue
const newIssue = await github.rest.issues.create({
owner: owner,
repo: repo,
title: "Backport #" + parentIssueNumber + " to release/v0",
body: "Backport #" + parentIssueNumber + " to release/v0"
labels: ['release/v0']
assignees: ['terraform-maintainers']
body: "Backport #" + parentIssueNumber + " to release/v0",
labels: ['release/v0'],
assignees: newAssignees // assign terraform-maintainers to sub-issue
});

const subIssueId = newIssue.data.id;
Expand Down
15 changes: 12 additions & 3 deletions .github/workflows/main-issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,22 @@ jobs:
const repo = context.repo.repo;
const owner = context.repo.owner;
const pr = context.payload.pull_request;
const newLabels = ['internal/main']
const newLabels = ['internal/main'];
const releaseLabel = pr.labels.find(label => label.name.startsWith('release/v'));
if (releaseLabel) {
const versionLabel = releaseLabel.name.replace('release/', 'version/');
newLabels.push(versionLabel)
newLabels.push(versionLabel);
}
// Get terraform-maintainers team
const { data: teamMembers } = await github.rest.teams.listMembersInOrg({
org: "rancher",
team_slug: "terraform-maintainers"
});
const newAssignees = teamMembers.map(member => member.login);

// Create the main issue
// https://docs.github.com/en/rest/issues/issues?apiVersion=2022-11-28#create-an-issue
// Note: issues can't have teams assigned to them
const newIssue = await github.rest.issues.create({
owner: owner,
repo: repo,
Expand All @@ -34,5 +43,5 @@ jobs:
"Please add comments for user issues which this issue addresses. \n\n" +
"Description copied from PR: \n" + pr.body,
labels: newLabels,
assignees: ['terraform-maintainers']
assignees: newAssignees // assign terraform-maintainers to issue
});
Loading