1- import * as core from ' @actions/core'
1+ import * as core from " @actions/core" ;
22import * as github from "@actions/github" ;
33import { PullRequest } from "@octokit/webhooks-types" ;
44
5-
65/**
76 * The main function for the action.
87 * @returns {Promise<void> } Resolves when the action is complete.
98 */
109export async function run ( ) : Promise < void > {
11- try {
12- if ( github . context . eventName === "pull_request" ) {
13- const pullPayload = github . context . payload . pull_request as PullRequest ;
14- const body : string | null = pullPayload . body ;
10+ try {
11+ if ( github . context . eventName === "pull_request" ) {
12+ const pullPayload = github . context . payload . pull_request as PullRequest ;
13+ const body : string | null = pullPayload . body ;
1514
16- if ( ! body ) {
17- core . setFailed ( "No PR body provided. Please ensure you include the PR template." ) ;
18- return ;
19- }
15+ if ( ! body ) {
16+ core . setFailed (
17+ "No PR body provided. Please ensure you include the PR template."
18+ ) ;
19+ return ;
20+ }
2021
21- const lower : string = body . toLowerCase ( ) ;
22- const content : string = core . getInput ( "content" ) . toLowerCase ( ) ;
22+ const lower : string = body . toLowerCase ( ) ;
23+ const content : string = core . getInput ( "content" ) . toLowerCase ( ) ;
2324
24- if ( ! lower . includes ( content ) ) {
25- core . setFailed ( `Content check for "${ content } " was not successful.` ) ;
26- return ;
27- }
25+ if ( ! lower . includes ( content ) ) {
26+ core . setFailed ( `Content check for "${ content } " was not successful.` ) ;
27+ return ;
28+ }
2829
29- core . setOutput ( "passed" , "All content checks were successful!" ) ;
30- }
31- } catch ( error ) {
32- // Fail the workflow run if an error occurs
33- if ( error instanceof Error ) core . setFailed ( error . message )
30+ core . setOutput ( "passed" , "All content checks were successful!" ) ;
3431 }
35- }
32+ } catch ( error ) {
33+ // Fail the workflow run if an error occurs
34+ if ( error instanceof Error ) core . setFailed ( error . message ) ;
35+ }
36+ }
0 commit comments