Skip to content

Commit

Permalink
Merge pull request #14 from gsmet/output-version
Browse files Browse the repository at this point in the history
Add output for released version
  • Loading branch information
gsmet authored Nov 25, 2023
2 parents 78aab0b + 6d98071 commit e21377d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
2 changes: 2 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ outputs:
value: ${{ steps.action.outputs.workflow-run-id }}
interaction-comment:
value: ${{ steps.action.outputs.interaction-comment }}
version:
value: ${{ steps.action.outputs.version }}
runs:
using: "composite"
steps:
Expand Down
18 changes: 15 additions & 3 deletions src/main/java/io/quarkus/bot/release/ReleaseAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,14 @@ void startRelease(Context context, Commands commands, @Issue.Opened GHEventPaylo

react(commands, issue, ReactionContent.PLUS_ONE);

handleSteps(context, commands, issuePayload.getIssue(), updatedIssueBody, null, releaseInformation,
new ReleaseStatus(Status.STARTED, Step.PREREQUISITES, StepStatus.STARTED, context.getGitHubRunId()));
try {
handleSteps(context, commands, issuePayload.getIssue(), updatedIssueBody, null, releaseInformation,
new ReleaseStatus(Status.STARTED, Step.PREREQUISITES, StepStatus.STARTED, context.getGitHubRunId()));
} finally {
if (releaseInformation.getVersion() != null) {
commands.setOutput(Outputs.VERSION, releaseInformation.getVersion());
}
}
}

@Action
Expand Down Expand Up @@ -107,7 +113,13 @@ void onComment(Context context, Commands commands, @IssueComment.Created GHEvent
throw e;
}

handleSteps(context, commands, issue, updatedIssueBody, issueComment, releaseInformation, releaseStatus);
try {
handleSteps(context, commands, issue, updatedIssueBody, issueComment, releaseInformation, releaseStatus);
} finally {
if (releaseInformation.getVersion() != null) {
commands.setOutput(Outputs.VERSION, releaseInformation.getVersion());
}
}
}

private void handleSteps(Context context, Commands commands, GHIssue issue, UpdatedIssueBody updatedIssueBody,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public int run(Context context, Commands commands, ReleaseInformation releaseInf
comment.append("- This is a preview release (e.g. `Alpha`, `Beta`, `CR`).\n");
}
comment.append(
"\nPlease add a `" + Command.YES.getFullCommand() + "` comment if you want to pursue with the release.\n");
"\nPlease approve with a `" + Command.YES.getFullCommand() + "` comment if you want to pursue with the release.\n");
comment.append("\nIf not, simply close this issue.");
commands.setOutput(Outputs.INTERACTION_COMMENT, comment.toString());

Expand Down
1 change: 1 addition & 0 deletions src/main/java/io/quarkus/bot/release/util/Outputs.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ public final class Outputs {

public static final String WORKFLOW_RUN_ID = "workflow-run-id";
public static final String INTERACTION_COMMENT = "interaction-comment";
public static final String VERSION = "version";

private Outputs() {
}
Expand Down

0 comments on commit e21377d

Please sign in to comment.