-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from gsmet/rework-getting-information
Rework getting information from description
- Loading branch information
Showing
8 changed files
with
109 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
src/main/java/io/quarkus/bot/release/GetReleaseInformationAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package io.quarkus.bot.release; | ||
|
||
import jakarta.inject.Inject; | ||
|
||
import org.kohsuke.github.GHEventPayload; | ||
|
||
import io.quarkiverse.githubaction.Action; | ||
import io.quarkiverse.githubaction.Commands; | ||
import io.quarkiverse.githubapp.event.IssueComment; | ||
import io.quarkus.bot.release.util.Issues; | ||
import io.quarkus.bot.release.util.Outputs; | ||
import io.quarkus.bot.release.util.UpdatedIssueBody; | ||
|
||
public class GetReleaseInformationAction { | ||
|
||
@Inject | ||
Issues issues; | ||
|
||
@Action("get-release-information") | ||
void getReleaseInformation(Commands commands, @IssueComment.Created GHEventPayload.IssueComment issueCommentPayload) { | ||
ReleaseInformation releaseInformation; | ||
|
||
try { | ||
UpdatedIssueBody updatedIssueBody = new UpdatedIssueBody(issueCommentPayload.getIssue().getBody()); | ||
releaseInformation = issues.extractReleaseInformation(updatedIssueBody); | ||
} catch (Exception e) { | ||
releaseInformation = issues.extractReleaseInformationFromForm(issueCommentPayload.getIssue().getBody()); | ||
} | ||
|
||
commands.setOutput(Outputs.BRANCH, releaseInformation.getBranch()); | ||
if (releaseInformation.getQualifier() != null) { | ||
commands.setOutput(Outputs.QUALIFIER, releaseInformation.getQualifier()); | ||
} | ||
commands.setOutput(Outputs.MAJOR, Boolean.toString(releaseInformation.isMajor())); | ||
if (releaseInformation.getVersion() != null) { | ||
commands.setOutput(Outputs.VERSION, releaseInformation.getVersion()); | ||
} | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
src/main/java/io/quarkus/bot/release/GetReleaseStatusAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package io.quarkus.bot.release; | ||
|
||
import jakarta.inject.Inject; | ||
|
||
import org.kohsuke.github.GHEventPayload; | ||
|
||
import io.quarkiverse.githubaction.Action; | ||
import io.quarkiverse.githubaction.Commands; | ||
import io.quarkiverse.githubapp.event.IssueComment; | ||
import io.quarkus.bot.release.util.Issues; | ||
import io.quarkus.bot.release.util.Outputs; | ||
import io.quarkus.bot.release.util.UpdatedIssueBody; | ||
|
||
public class GetReleaseStatusAction { | ||
|
||
@Inject | ||
Issues issues; | ||
|
||
@Action("get-release-status") | ||
void getReleaseStatus(Commands commands, @IssueComment.Created GHEventPayload.IssueComment issueCommentPayload) { | ||
UpdatedIssueBody updatedIssueBody = new UpdatedIssueBody(issueCommentPayload.getIssue().getBody()); | ||
|
||
ReleaseStatus releaseStatus = issues.extractReleaseStatus(updatedIssueBody); | ||
|
||
commands.setOutput(Outputs.STATUS, releaseStatus.getStatus().name()); | ||
commands.setOutput(Outputs.CURRENT_STEP, releaseStatus.getCurrentStep().name()); | ||
commands.setOutput(Outputs.CURRENT_STEP_STATUS, releaseStatus.getCurrentStepStatus().name()); | ||
commands.setOutput(Outputs.WORKFLOW_RUN_ID, releaseStatus.getWorkflowRunId().toString()); | ||
commands.setOutput(Outputs.DATE, releaseStatus.getDate().toString()); | ||
} | ||
} |
26 changes: 0 additions & 26 deletions
26
src/main/java/io/quarkus/bot/release/GetWorkflowRunIdAction.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters