Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle multiple types for advanced scenarios #143

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mauriziovitale
Copy link

No description provided.

Comment on lines +170 to +187
if (lastSuccessfulEvent.includes(",")) {
// find the greatest workflow id among the types and retrieve the sha
const events = lastSuccessfulEvent.split(",");
const workflowIdMap = new Map();
for (const event of events) {
Copy link

@sparr sparr May 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This if condition and the else code path below seems unnecessary. A string with no commas, e.g. "foo", will split(",") to ["foo"] and the iteration will work fine over that single element.

});
workflowIdMap.set(workflowRun.id, workflowRun.head_sha);
}
shas.push(workflowIdMap.get(Math.max(...workflowIdMap.keys())));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like it will push all the SHAs from one event, then all of them from another. So they won't be in order in the final array. Which means the call to findExistingCommit below, which returns the first commit in the list that exists, might not return the correct commit?

@mandarini mandarini force-pushed the feature/142-leverage-multiple-event-types branch from 6888a24 to ab3c552 Compare May 28, 2024 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants