Skip to content

chore(deps): bump azure/setup-helm from 4 to 5 in /.github/actions/setup-helm #3

chore(deps): bump azure/setup-helm from 4 to 5 in /.github/actions/setup-helm

chore(deps): bump azure/setup-helm from 4 to 5 in /.github/actions/setup-helm #3

Workflow file for this run

#################################################################################
# Copyright (c) 2026 Cofinity-X GmbH
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License, Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# SPDX-License-Identifier: Apache-2.0
#################################################################################
---
name: Copy labels from closing issue to PR
on:
pull_request_target:
types: [opened, edited]
permissions:
issues: write
pull-requests: write
jobs:
copy-labels:
runs-on: ubuntu-latest
steps:
- name: Copy labels from linked issue to PR
uses: actions/github-script@v9
with:
script: |
const CLOSING_KEYWORDS = /\b(?:closes?|fixes?|resolves?)\s+#(\d+)\b/gi;
// Only these labels are meaningful to copy to a PR
const ALLOWED_LABELS = new Set([
"breaking change", "bug", "documentation", "enhancement",
"Feature", "infrastructure", "refactoring"
]);
const { owner, repo } = context.repo;
const prNumber = context.payload.pull_request.number;
const { data: pr } = await github.rest.pulls.get({
owner,
repo,
pull_number: prNumber,
});
const text = [pr.title || "", pr.body || ""].join("\n");
const issueNumbers = [...text.matchAll(CLOSING_KEYWORDS)].map(m => Number(m[1]));
if (!issueNumbers.length) {
core.info("No closing-keyword issue references found.");
return;
}
const prLabelsRes = await github.rest.issues.listLabelsOnIssue({
owner, repo, issue_number: prNumber
});
const existingPrLabels = new Set(prLabelsRes.data.map(l => l.name));
for (const issue_number of issueNumbers) {
let issue;
try {
issue = await github.rest.issues.get({ owner, repo, issue_number });
} catch (error) {
core.warning(`Issue #${issue_number} not found or inaccessible: ${error.message}`);
continue;
}
const labels = issue.data.labels
.map(label => typeof label === "string" ? label : label.name)
.filter(name => name && ALLOWED_LABELS.has(name) && !existingPrLabels.has(name));
if (!labels.length) {
core.info(`Issue #${issue_number} has no new applicable labels to copy.`);
continue;
}
core.info(`Copying labels from issue #${issue_number} to PR #${prNumber}: ${labels.join(", ")}`);
await github.rest.issues.addLabels({
owner,
repo,
issue_number: prNumber,
labels
});
}