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
8 changes: 4 additions & 4 deletions pkg/workflow/js/add_labels.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ async function main() {

// Get configuration from config.json
const config = getSafeOutputConfig("add_labels");

// Parse allowed labels (from env or config)
const allowedLabels = parseAllowedItems(process.env.GH_AW_LABELS_ALLOWED) || config.allowed;
if (allowedLabels) {
Expand Down Expand Up @@ -84,7 +84,7 @@ async function main() {
const contextType = targetResult.contextType;
const requestedLabels = labelsItem.labels || [];
core.info(`Requested labels: ${JSON.stringify(requestedLabels)}`);

// Use validation helper to sanitize and validate labels
const labelsResult = validateLabels(requestedLabels, allowedLabels, maxCount);
if (!labelsResult.valid) {
Expand All @@ -107,9 +107,9 @@ No labels were added (no valid labels found in agent output).
core.setFailed(labelsResult.error || "Invalid labels");
return;
}

const uniqueLabels = labelsResult.value || [];

if (uniqueLabels.length === 0) {
core.info("No labels to add");
core.setOutput("labels_added", "");
Expand Down
4 changes: 2 additions & 2 deletions pkg/workflow/js/safe_output_validator.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ describe("safe_output_validator.cjs", () => {

beforeEach(async () => {
vi.clearAllMocks();

// Reset mock implementations to default
mockExistsSync.mockReturnValue(false);
mockReadFileSync.mockReturnValue("");

// Dynamically import the module
validator = await import("./safe_output_validator.cjs");
});
Expand Down