Files
kestra/dev-tools/kestra-devtools/src/github-context.ts
Roman Acevedo 5be401d23c ci: add a kestra-devtools cli, and comment PR with failed tests
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
2025-09-12 18:48:12 +02:00

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 }
}