fix: create a new array to save labels (#36)

Signed-off-by: matttrach <matt.trachier@suse.com>
This commit is contained in:
Matt Trachier 2025-08-19 23:44:26 -05:00 committed by GitHub
parent 147a1e4509
commit a9b314efd4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 5 deletions

View File

@ -18,13 +18,12 @@ jobs:
const repo = context.repo.repo; const repo = context.repo.repo;
const owner = context.repo.owner; const owner = context.repo.owner;
const pr = context.payload.pull_request; const pr = context.payload.pull_request;
const newLabels = ['internal/main']
const releaseLabel = pr.head.labels.find(label => label.name.startsWith('release/v')); const releaseLabel = pr.head.labels.find(label => label.name.startsWith('release/v'));
if releaseLabel { if (releaseLabel) {
const versionLabel = releaseLabel.name.replace('release/', 'version/'); const versionLabel = releaseLabel.name.replace('release/', 'version/');
} else { newLabels.push(versionLabel)
const versionLabel = ''
} }
// Create the main issue // Create the main issue
const newIssue = await github.rest.issues.create({ const newIssue = await github.rest.issues.create({
owner: owner, owner: owner,
@ -34,6 +33,6 @@ jobs:
"Please add labels indicating the release versions eg. 'version/v0' \n\n" + "Please add labels indicating the release versions eg. 'version/v0' \n\n" +
"Please add comments for user issues which this issue addresses. \n\n" + "Please add comments for user issues which this issue addresses. \n\n" +
"Description copied from PR: \n" + pr.body, "Description copied from PR: \n" + pr.body,
labels: ['internal/main', versionLabel], labels: newLabels,
assignees: ['terraform-maintainers'] assignees: ['terraform-maintainers']
}); });