@@ -80,17 +80,24 @@ const postComment = async (outputMd: string) => {
80
80
const { context, getOctokit } = github
81
81
const octokit = getOctokit ( process . env . GITHUB_TOKEN ! )
82
82
const { owner, repo } = context . repo
83
- const pullRequest = context . payload . pull_request
84
- if ( ! pullRequest ) {
85
- console . log ( "Skipping since this is not a pull request" )
86
- process . exit ( 0 )
87
- }
88
- const isFork = pullRequest . head . repo . fork
89
- const prNumber = pullRequest . number
90
- if ( isFork ) {
91
- setFailed (
92
- "The action could not create a GitHub comment because it is initiated from a forked repo. View the action logs for a list of broken links."
93
- )
83
+ console . log ( "CONTEXT" , context . payload )
84
+ // const pullRequest = context.payload.pull_request
85
+ // if (!pullRequest) {
86
+ // console.log("Skipping since this is not a pull request")
87
+ // process.exit(0)
88
+ // }
89
+ // const isFork = pullRequest.head.repo.fork
90
+ // const prNumber = pullRequest.number
91
+ // if (isFork) {
92
+ // setFailed(
93
+ // "The action could not create a GitHub comment because it is initiated from a forked repo. View the action logs for a list of broken links."
94
+ // )
95
+ // return ""
96
+ // }
97
+ //
98
+ const prNumber = context . payload ?. issue ?. number
99
+ if ( ! prNumber ) {
100
+ setFailed ( "Count not find PR Number" )
94
101
return ""
95
102
}
96
103
@@ -157,9 +164,8 @@ const generateOutputMd = (output: Output): string => {
157
164
158
165
// @ts -expect-error
159
166
links . forEach ( ( link : TODO ) => {
160
- outputMd += `| [${ new URL ( link . url . resolved ) . pathname } ](${
161
- link . url . resolved
162
- } ) | "${ link . html ?. text ?. trim ( ) . replaceAll ( "\n" , "" ) } " |
167
+ outputMd += `| [${ new URL ( link . url . resolved ) . pathname } ](${ link . url . resolved
168
+ } ) | "${ link . html ?. text ?. trim ( ) . replaceAll ( "\n" , "" ) } " |
163
169
`
164
170
} )
165
171
} )
0 commit comments