Skip to content

Commit

Permalink
Don't pass comment as status description (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
antonagestam authored Nov 2, 2021
1 parent d1c3d21 commit 0fce038
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
12 changes: 7 additions & 5 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11393,6 +11393,10 @@ function getReviewFailEvent() {
const REVIEW_APPROVE = "APPROVE";
const REVIEW_COMMENT = "COMMENT";
const REVIEW_REQUEST_CHANGES = "REQUEST_CHANGES";
const STATUS_FAILURE = "failure";
const STATUS_SUCCESS = "success";
const DESCRIPTION_SUCCESS = "Valid release.";
const DESCRIPTION_FAILURE = "Invalid release.";

async function review(pullRequest, event, comment) {
core.info(`Reviewing ${pullRequest.number}..`);
Expand All @@ -11403,16 +11407,14 @@ async function review(pullRequest, event, comment) {
...github.context.repo
});
// Set status on commit
const state = event === REVIEW_APPROVE;
await setStatus(
pullRequest,
event === REVIEW_APPROVE ? STATUS_SUCCESS : STATUS_FAILURE,
comment
state ? STATUS_SUCCESS : STATUS_FAILURE,
state ? DESCRIPTION_SUCCESS : DESCRIPTION_FAILURE
);
}

const STATUS_FAILURE = "failure";
const STATUS_SUCCESS = "success";

async function setStatus(pullRequest, state, description) {
core.info(`Setting status ${state}..`);
const createStatus = JSON.parse(
Expand Down
12 changes: 7 additions & 5 deletions src/action.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,10 @@ function getReviewFailEvent() {
const REVIEW_APPROVE = "APPROVE";
const REVIEW_COMMENT = "COMMENT";
const REVIEW_REQUEST_CHANGES = "REQUEST_CHANGES";
const STATUS_FAILURE = "failure";
const STATUS_SUCCESS = "success";
const DESCRIPTION_SUCCESS = "Valid release.";
const DESCRIPTION_FAILURE = "Invalid release.";

async function review(pullRequest, event, comment) {
core.info(`Reviewing ${pullRequest.number}..`);
Expand All @@ -224,16 +228,14 @@ async function review(pullRequest, event, comment) {
...github.context.repo
});
// Set status on commit
const state = event === REVIEW_APPROVE;
await setStatus(
pullRequest,
event === REVIEW_APPROVE ? STATUS_SUCCESS : STATUS_FAILURE,
comment
state ? STATUS_SUCCESS : STATUS_FAILURE,
state ? DESCRIPTION_SUCCESS : DESCRIPTION_FAILURE
);
}

const STATUS_FAILURE = "failure";
const STATUS_SUCCESS = "success";

async function setStatus(pullRequest, state, description) {
core.info(`Setting status ${state}..`);
const createStatus = JSON.parse(
Expand Down

0 comments on commit 0fce038

Please sign in to comment.