Class ManageTagGitHubAction
java.lang.Object
me.julb.applications.github.actions.ManageTagGitHubAction
- All Implemented Interfaces:
me.julb.sdk.github.actions.spi.GitHubActionProvider
public class ManageTagGitHubAction
extends Object
implements me.julb.sdk.github.actions.spi.GitHubActionProvider
The action to manage tags.
- Author:
- Julb.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) StringGets the ref from a branch name.(package private) voidConnects to GitHub API.(package private) org.kohsuke.github.GHRefcreateGHRef(@NonNull String newRef, @NonNull String sourceSHA, @NonNull Optional<org.kohsuke.github.GHRef> existingRef) Creates or updates theGHRefif any.(package private) voiddeleteGHRef(@NonNull Optional<org.kohsuke.github.GHRef> refToDelete) Deletes theGHRefif any.voidexecute()(package private) Optional<org.kohsuke.github.GHRef>getAnyGHRef(@NonNull String name) Gets theGHRefbranch or tag matching the given name.(package private) StringGets the "from" input.(package private) StringGets the "name" input.(package private) InputTagStateGets the "state" input.(package private) Optional<org.kohsuke.github.GHRef>getTagGHRef(@NonNull String name) Gets theGHReftag matching the given name.(package private) StringGets the ref from a tag name.
-
Constructor Details
-
ManageTagGitHubAction
public ManageTagGitHubAction()
-
-
Method Details
-
execute
public void execute()- Specified by:
executein interfaceme.julb.sdk.github.actions.spi.GitHubActionProvider
-
getInputName
String getInputName()Gets the "name" input.- Returns:
- the "name" input.
-
getInputState
InputTagState getInputState()Gets the "state" input.- Returns:
- the "state" input.
-
getInputFrom
String getInputFrom()Gets the "from" input.- Returns:
- the "from" input.
-
connectApi
Connects to GitHub API.- Throws:
IOException- if an error occurs.
-
getTagGHRef
Gets theGHReftag matching the given name.- Parameters:
name- the tag name to look for.- Returns:
- the
GHReffor the given tag if exists,falseotherwise. - Throws:
IOException- if an error occurs.
-
getAnyGHRef
Gets theGHRefbranch or tag matching the given name.- Parameters:
name- the branch or tag name to look for.- Returns:
- the
GHReffor the given branch or tag if exists,falseotherwise. - Throws:
IOException- if an error occurs.
-
createGHRef
org.kohsuke.github.GHRef createGHRef(@NonNull @NonNull String newRef, @NonNull @NonNull String sourceSHA, @NonNull @NonNull Optional<org.kohsuke.github.GHRef> existingRef) throws IOException Creates or updates theGHRefif any.- Parameters:
newRef- the ref to create.sourceSHA- the SHA from which to create the tag.existingRef- theGHReffor the existing tag, orOptional.empty()if the tag does not exist.- Returns:
- the
GHRefcreated. - Throws:
IOException- if an error occurs.
-
deleteGHRef
void deleteGHRef(@NonNull @NonNull Optional<org.kohsuke.github.GHRef> refToDelete) throws IOException Deletes theGHRefif any.- Parameters:
refToDelete- theGHRefto delete, orOptional.empty().- Throws:
IOException- if an error occurs.
-
branchRef
Gets the ref from a branch name.- Parameters:
branchName- the branch name.- Returns:
- the ref for the given branch name.
-
tagRef
Gets the ref from a tag name.- Parameters:
name- the tag name.- Returns:
- the ref for the given tag name.
-