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
5 changes: 2 additions & 3 deletions actions/setup/js/add_reaction.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ async function main() {
core.info(`Adding reaction: ${reaction}`);

// Validate reaction type
const validReactions = Object.keys(REACTION_MAP);
if (!validReactions.includes(reaction)) {
core.setFailed(`${ERR_VALIDATION}: Invalid reaction type: ${reaction}. Valid reactions are: ${validReactions.join(", ")}`);
if (!Object.prototype.hasOwnProperty.call(REACTION_MAP, reaction)) {
Comment thread
pelikhan marked this conversation as resolved.
core.setFailed(`${ERR_VALIDATION}: Invalid reaction type: ${reaction}. Valid reactions are: ${Object.keys(REACTION_MAP).join(", ")}`);
return;
}

Expand Down
4 changes: 2 additions & 2 deletions actions/setup/js/add_reaction_and_edit_comment.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const { ERR_API, ERR_NOT_FOUND, ERR_VALIDATION } = require("./error_codes.cjs");
const { buildWorkflowRunUrl } = require("./workflow_metadata_helpers.cjs");
const { createDiscussionComment, resolveTopLevelDiscussionCommentId } = require("./github_api_helpers.cjs");
const { resolveInvocationContext } = require("./invocation_context_helpers.cjs");
const { addReaction, addDiscussionReaction, getDiscussionNodeId } = require("./add_reaction.cjs");
const { addReaction, addDiscussionReaction, getDiscussionNodeId, REACTION_MAP } = require("./add_reaction.cjs");

/**
* Event type descriptions for comment messages
Expand All @@ -25,7 +25,7 @@ const EVENT_TYPE_DESCRIPTIONS = {
};

/** Valid GitHub reaction types */
const VALID_REACTIONS = Object.freeze(["+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", "eyes"]);
const VALID_REACTIONS = Object.freeze(Object.keys(REACTION_MAP));
Comment thread
pelikhan marked this conversation as resolved.

/**
* Resolve the reaction and comment API endpoints for a given event.
Expand Down
Loading