Skip to content

Allow user to decide what happens on a tie #6

@peterwoodworth

Description

@peterwoodworth

Description

There should be a non-required parameter (which defaults to how it currently works) which allows the user to decide what happens on a tie.

Currently on a tie, the action first reruns the area determining function, but sets the similarity to 0. Meaning, we are eliminating words detected in the first run that were not exact keyword matches. This may cause the tie to break, but it might still tie on the second run.
If it ties with a similarity of 0, the action only acts on one area: the area it chooses is the first area that was mentioned in the issue.

You should also be able to set it so that the action works on all issues that achieved the highest score. Additionally, the user might not want the action to rerun the area determining function with a similarity of 0 to attempt to break a tie.

Use Case

More configurability for the user

Proposed Solution

The code is currently here in Issue.determineArea()

let winningArea = '';
let winners: Map<string,number> = new Map();
for (let area of potentialAreas.entries()) {
if(winners.size === 0) {
winners.set(area[0], area[1]);
} else if (area[1] > winners.values().next().value) {
winners = new Map();
winners.set(area[0], area[1]);
} else if (area[1] === winners.values().next().value) {
winners.set(area[0], area[1]);
}
}
// tiebreaker goes to the area with more *exact* keyword matches
if(winners.size > 1 && this.similarity !== 0) {
this.similarity = 0;
winningArea = this.determineArea();
} else if (winners.size > 0) {
winningArea = winners.keys().next().value;
}
winningArea = winners.keys().next().value;
console.log("Winning area: " + winningArea);
return winningArea;

It might be best to create a separate member function of Issue for the tiebreaker code and have Issue.determineArea() call that function

It will need to be modified to support different options depending on a new parameter which should be added to action.yml, something like this:

tiebreaker:
  description: "blahblahblah"
  required: false
  default: false

Other Info

No response

Acknowledge

  • I may be able to implement this feature request
  • This feature might incur a breaking change

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions