11import * as core from '@actions/core'
2- import { wait } from './wait.js '
2+ import * as github from '@actions/github '
33
44/**
55 * The main function for the action.
@@ -8,20 +8,22 @@ import { wait } from './wait.js'
88 */
99export async function run ( ) : Promise < void > {
1010 try {
11- const ms : string = core . getInput ( 'milliseconds' )
12-
13- // Debug logs are only output if the `ACTIONS_STEP_DEBUG` secret is true
14- core . debug ( `Waiting ${ ms } milliseconds ...` )
15-
16- // Log the current timestamp, wait, then log the new timestamp
17- core . debug ( new Date ( ) . toTimeString ( ) )
18- await wait ( parseInt ( ms , 10 ) )
19- core . debug ( new Date ( ) . toTimeString ( ) )
20-
21- // Set outputs for other workflow steps to use
22- core . setOutput ( 'time' , new Date ( ) . toTimeString ( ) )
11+ // const repository: string = core.getInput('sourceRepo')
12+ const token = core . getInput ( 'github_token' , { required : true } )
13+ const octokit = github . getOctokit ( token )
14+ const sha = github . context . sha
15+ const { owner, repo } = github . context . repo
16+ const { data : commit } = await octokit . rest . repos . getCommit ( {
17+ owner,
18+ repo,
19+ ref : sha
20+ } )
21+ console . log ( `Commit Message: ${ commit . commit . message } ` )
22+ console . log ( `Author Name: ${ commit . commit . author ?. name } ` )
23+ console . log ( `Author Email: ${ commit . commit . author ?. email } ` )
24+ console . log ( `Committer Name: ${ commit . commit . committer ?. name } ` )
25+ console . log ( `Committer Email: ${ commit . commit . committer ?. email } ` )
2326 } catch ( error ) {
24- // Fail the workflow run if an error occurs
2527 if ( error instanceof Error ) core . setFailed ( error . message )
2628 }
2729}
0 commit comments