Class ManageMilestoneGitHubAction
java.lang.Object
me.julb.applications.github.actions.ManageMilestoneGitHubAction
- All Implemented Interfaces:
me.julb.sdk.github.actions.spi.GitHubActionProvider
public class ManageMilestoneGitHubAction
extends Object
implements me.julb.sdk.github.actions.spi.GitHubActionProvider
The action to manage milestones.
- Author:
- Julb.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) void
Connects to GitHub API.(package private) org.kohsuke.github.GHMilestone
createGHMilestone
(@NonNull String title, @NonNull org.kohsuke.github.GHMilestoneState state, @NonNull Optional<String> description, @NonNull Optional<Date> dueOn, @NonNull Optional<org.kohsuke.github.GHMilestone> existingMilestone) Creates or updates theGHMilestone
if any.(package private) void
deleteGHMilestone
(@NonNull Optional<org.kohsuke.github.GHMilestone> milestoneToDelete) Deletes theGHMilestone
if any.void
execute()
(package private) Optional<org.kohsuke.github.GHMilestone>
getGHMilestone
(@NonNull String title) Gets theGHMilestone
milestone matching the given title.Gets the "description" input.Gets the "due_on" input.(package private) InputMilestoneState
Gets the "state" input.(package private) String
Gets the "title" input.
-
Constructor Details
-
ManageMilestoneGitHubAction
public ManageMilestoneGitHubAction()
-
-
Method Details
-
execute
public void execute()- Specified by:
execute
in interfaceme.julb.sdk.github.actions.spi.GitHubActionProvider
-
getInputTitle
String getInputTitle()Gets the "title" input.- Returns:
- the "title" input.
-
getInputState
InputMilestoneState getInputState()Gets the "state" input.- Returns:
- the "state" input.
-
getInputDescription
Gets the "description" input.- Returns:
- the "description" input.
-
getInputDueOn
Gets the "due_on" input.- Returns:
- the "due_on" input.
-
connectApi
Connects to GitHub API.- Throws:
IOException
- if an error occurs.
-
getGHMilestone
Optional<org.kohsuke.github.GHMilestone> getGHMilestone(@NonNull @NonNull String title) throws IOException Gets theGHMilestone
milestone matching the given title.- Parameters:
title
- the milestone title to look for.- Returns:
- the
GHMilestone
for the given title if exists,false
otherwise. - Throws:
IOException
- if an error occurs.
-
createGHMilestone
org.kohsuke.github.GHMilestone createGHMilestone(@NonNull @NonNull String title, @NonNull @NonNull org.kohsuke.github.GHMilestoneState state, @NonNull @NonNull Optional<String> description, @NonNull @NonNull Optional<Date> dueOn, @NonNull @NonNull Optional<org.kohsuke.github.GHMilestone> existingMilestone) throws IOException Creates or updates theGHMilestone
if any.- Parameters:
title
- the milestone title.state
- the milestone state.description
- the milestone description, orOptional.empty()
if the description is empty.dueOn
- the milestone due on date, orOptional.empty()
if there is no due date.existingMilestone
- the existing milestone, orOptional.empty()
if there is no existing milestone.- Returns:
- the
GHMilestone
created or updated. - Throws:
IOException
- if an error occurs.
-
deleteGHMilestone
void deleteGHMilestone(@NonNull @NonNull Optional<org.kohsuke.github.GHMilestone> milestoneToDelete) throws IOException Deletes theGHMilestone
if any.- Parameters:
milestoneToDelete
- theGHMilestone
to delete, orOptional.empty()
.- Throws:
IOException
- if an error occurs.
-