mirror of
https://github.com/actions/github-script.git
synced 2026-02-07 19:47:26 +00:00
Added start and end
This commit is contained in:
parent
e4f7f1688c
commit
1bc237c625
3 changed files with 62 additions and 5 deletions
27
dist/index.js
vendored
27
dist/index.js
vendored
|
|
@ -13603,8 +13603,9 @@ var external_fs_ = __webpack_require__(747);
|
|||
|
||||
|
||||
class se_Helper {
|
||||
constructor(currentBuild) {
|
||||
constructor(currentBuild, github) {
|
||||
this.currentBuild = currentBuild;
|
||||
this.github = github;
|
||||
}
|
||||
createMetaJson(root) {
|
||||
const execSync = external_child_process_.execSync;
|
||||
|
|
@ -13683,6 +13684,28 @@ class se_Helper {
|
|||
}
|
||||
return ret;
|
||||
}
|
||||
async startCheck(name, status) {
|
||||
const result = await this.github.rest.checks.create({
|
||||
owner: this.currentBuild.repo.owner,
|
||||
repo: this.currentBuild.repo.repo,
|
||||
name: name,
|
||||
head_sha: this.currentBuild.sha,
|
||||
status: status
|
||||
});
|
||||
return result;
|
||||
}
|
||||
async completeCheck(name, check_run_id, conclusion) {
|
||||
const result = await this.github.rest.checks.create({
|
||||
owner: this.currentBuild.repo.owner,
|
||||
repo: this.currentBuild.repo.repo,
|
||||
name: name,
|
||||
check_run_id: check_run_id,
|
||||
head_sha: this.currentBuild.sha,
|
||||
status: 'completed',
|
||||
conclusion: conclusion
|
||||
});
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
// EXTERNAL MODULE: external "path"
|
||||
|
|
@ -13746,7 +13769,7 @@ async function main() {
|
|||
opts.request = requestOpts;
|
||||
const github = Object(lib_github.getOctokit)(token, opts, dist_node.retry);
|
||||
const script = Object(core.getInput)('script', { required: true });
|
||||
const se = new se_Helper(lib_github.context);
|
||||
const se = new se_Helper(lib_github.context, github);
|
||||
// Using property/value shorthand on `require` (e.g. `{require}`) causes compilation errors.
|
||||
const result = await callAsyncFunction({
|
||||
require: wrapRequire,
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ async function main(): Promise<void> {
|
|||
|
||||
const github = getOctokit(token, opts, retry)
|
||||
const script = core.getInput('script', {required: true})
|
||||
const se = new helper.Helper(context)
|
||||
const se = new helper.Helper(context, github)
|
||||
|
||||
// Using property/value shorthand on `require` (e.g. `{require}`) causes compilation errors.
|
||||
const result = await callAsyncFunction(
|
||||
|
|
|
|||
38
src/se.ts
38
src/se.ts
|
|
@ -1,12 +1,18 @@
|
|||
import {context} from '@actions/github'
|
||||
import {GitHub} from '@actions/github/lib/utils'
|
||||
import * as child from 'child_process'
|
||||
import * as fs from 'fs'
|
||||
|
||||
export class Helper {
|
||||
public currentBuild: typeof context
|
||||
currentBuild: typeof context
|
||||
github: InstanceType<typeof GitHub>
|
||||
|
||||
public constructor(currentBuild: typeof context) {
|
||||
public constructor(
|
||||
currentBuild: typeof context,
|
||||
github: InstanceType<typeof GitHub>
|
||||
) {
|
||||
this.currentBuild = currentBuild
|
||||
this.github = github
|
||||
}
|
||||
|
||||
public createMetaJson(root: string) {
|
||||
|
|
@ -98,4 +104,32 @@ export class Helper {
|
|||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
public async startCheck(name: string, status: string) {
|
||||
const result = await this.github.rest.checks.create({
|
||||
owner: this.currentBuild.repo.owner,
|
||||
repo: this.currentBuild.repo.repo,
|
||||
name: name,
|
||||
head_sha: this.currentBuild.sha,
|
||||
status: status
|
||||
})
|
||||
return result
|
||||
}
|
||||
|
||||
public async completeCheck(
|
||||
name: string,
|
||||
check_run_id: string,
|
||||
conclusion: string
|
||||
) {
|
||||
const result = await this.github.rest.checks.create({
|
||||
owner: this.currentBuild.repo.owner,
|
||||
repo: this.currentBuild.repo.repo,
|
||||
name: name,
|
||||
check_run_id: check_run_id,
|
||||
head_sha: this.currentBuild.sha,
|
||||
status: 'completed',
|
||||
conclusion: conclusion
|
||||
})
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue