| 171 | } |
| 172 | |
| 173 | async checkCreate(opts = {}) { |
| 174 | const { |
| 175 | report, |
| 176 | headSha, |
| 177 | title = CHECK_TITLE, |
| 178 | started_at: startedAt = new Date(), |
| 179 | completed_at: completedAt = new Date(), |
| 180 | conclusion = 'success', |
| 181 | status = 'completed' |
| 182 | } = opts; |
| 183 | |
| 184 | const warning = |
| 185 | 'This command only works inside a Github runner or a Github app.'; |
| 186 | |
| 187 | if (!CI || TPI_TASK) logger.warn(warning); |
| 188 | if (GITHUB_TOKEN && GITHUB_TOKEN !== this.token) |
| 189 | logger.warn( |
| 190 | `Your token is different than the GITHUB_TOKEN, this command does not work with PAT. ${warning}` |
| 191 | ); |
| 192 | |
| 193 | const name = title; |
| 194 | return await octokit(this.token, this.repo).checks.create({ |
| 195 | ...ownerRepo({ uri: this.repo }), |
| 196 | head_sha: headSha, |
| 197 | started_at: startedAt, |
| 198 | completed_at: completedAt, |
| 199 | conclusion, |
| 200 | status, |
| 201 | name, |
| 202 | output: { title, summary: report } |
| 203 | }); |
| 204 | } |
| 205 | |
| 206 | async upload() { |
| 207 | throw new Error('Github does not support publish!'); |