mirror of
https://github.com/kestra-io/kestra.git
synced 2025-12-29 09:00:26 -05:00
this is a POC, I think it can already be useful. Next step will be to move kestra-devtools to a separate repo and publish it to npm
15 lines
613 B
TypeScript
15 lines
613 B
TypeScript
import core from '@actions/core';
|
|
import {context} from '@actions/github';
|
|
import {strict as assert} from 'assert';
|
|
|
|
export function getPRContext():{token: string, owner: string, repo: string, prNumber: number}{
|
|
const GITHUB_TOKEN = core.getInput('GITHUB_TOKEN') || process.env.GITHUB_TOKEN;
|
|
|
|
assert.ok(GITHUB_TOKEN, "GITHUB_TOKEN is mandatory");
|
|
assert.ok(context.issue);
|
|
assert.ok(context.issue.owner);
|
|
assert.ok(context.issue.repo);
|
|
assert.ok(context.issue.number);
|
|
|
|
return {token: GITHUB_TOKEN, owner: context.repo.owner, repo: context.repo.repo, prNumber: context.issue.number }
|
|
} |