Skip to content

Commit fe4dc00

Browse files
committed
fix: handle warnings and errors using the javascript toolkit for GHA.
1 parent 6ff2221 commit fe4dc00

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

action.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,16 @@ runs:
3131
isReleaseEvent = true;
3232
break;
3333
case ('workflow_run'):
34-
console.log("warning::This action is designed to run on 'release', not 'workflow_run'. Even when corresponding to a workflow triggered by 'release', 'workflow_run' may not work due to its event context schema.");
34+
core.warning("This action is designed to run on 'release', not 'workflow_run'. Even when corresponding to a workflow triggered by 'release', 'workflow_run' may not work due to its event context schema.");
35+
break;
36+
case ('pull_request') && !core.getInput("release_id"):
37+
core.error("This action is meant to only run on 'release'. 'pull_request' is reserved for testing, and 'release_id' was not supplied.");
3538
break;
3639
case ('pull_request'):
37-
console.log("warning::This action is meant to only run on 'release'. 'pull_request' is reserved for testing.");
40+
core.warning("This action is meant to only run on 'release'. 'pull_request' is reserved for testing.");
3841
break;
3942
default:
40-
throw new Error(`Unsupported event: ${context.eventName}`);
43+
core.error(`The ${context.eventName} event is not supported by this action.`);
4144
}
4245
4346
if (context.eventName === 'pull_request' && length("${{ inputs.release_id }}") === 0) {
@@ -75,10 +78,8 @@ runs:
7578
});
7679
}
7780
78-
// Retrieving the ID of the current release
79-
if (length("${{ inputs.release_id }}") > 0) {
80-
release_id = "${{ inputs.release_id }}";
81-
} else {
81+
releaseId = core.getInput("release_id")
82+
if (!releaseId) {
8283
release_id = context.payload.release.id;
8384
}
8485

0 commit comments

Comments
 (0)