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) String
Gets the ref from a branch name.(package private) void
Connects to GitHub API.(package private) org.kohsuke.github.GHRef
createGHRef
(@NonNull String newRef, @NonNull String sourceSHA, @NonNull Optional<org.kohsuke.github.GHRef> existingRef) Creates or updates theGHRef
if any.(package private) void
deleteGHRef
(@NonNull Optional<org.kohsuke.github.GHRef> refToDelete) Deletes theGHRef
if any.void
execute()
(package private) Optional<org.kohsuke.github.GHRef>
getAnyGHRef
(@NonNull String name) Gets theGHRef
branch or tag matching the given name.(package private) String
Gets the "from" input.(package private) String
Gets the "name" input.(package private) InputTagState
Gets the "state" input.(package private) Optional<org.kohsuke.github.GHRef>
getTagGHRef
(@NonNull String name) Gets theGHRef
tag matching the given name.(package private) String
Gets the ref from a tag name.
-
Constructor Details
-
ManageTagGitHubAction
public ManageTagGitHubAction()
-
-
Method Details
-
execute
public void execute()- Specified by:
execute
in 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 theGHRef
tag matching the given name.- Parameters:
name
- the tag name to look for.- Returns:
- the
GHRef
for the given tag if exists,false
otherwise. - Throws:
IOException
- if an error occurs.
-
getAnyGHRef
Gets theGHRef
branch or tag matching the given name.- Parameters:
name
- the branch or tag name to look for.- Returns:
- the
GHRef
for the given branch or tag if exists,false
otherwise. - 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 theGHRef
if any.- Parameters:
newRef
- the ref to create.sourceSHA
- the SHA from which to create the tag.existingRef
- theGHRef
for the existing tag, orOptional.empty()
if the tag does not exist.- Returns:
- the
GHRef
created. - Throws:
IOException
- if an error occurs.
-
deleteGHRef
void deleteGHRef(@NonNull @NonNull Optional<org.kohsuke.github.GHRef> refToDelete) throws IOException Deletes theGHRef
if any.- Parameters:
refToDelete
- theGHRef
to 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.
-