mirror of
https://github.com/garronej/ts-ci.git
synced 2025-12-01 05:43:06 +00:00
Follow up from https://github.com/garronej/github_actions_toolkit
This commit is contained in:
commit
5297ab00ab
54 changed files with 18162 additions and 0 deletions
22
src/tools/test/octokit-addons/getChangeLog.ts
Normal file
22
src/tools/test/octokit-addons/getChangeLog.ts
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
|
||||
import { getCommitAheadFactory } from "../../octokit-addons/getCommitAhead";
|
||||
import { Octokit } from "@octokit/rest";
|
||||
|
||||
(async ()=>{
|
||||
|
||||
const octokit = new Octokit();
|
||||
|
||||
const { getCommitAhead } = getCommitAheadFactory({ octokit });
|
||||
|
||||
const { commits } = await getCommitAhead({
|
||||
"owner": "garronej",
|
||||
"repo": "test-repo",
|
||||
"branchBehind": "garronej-patch-1",
|
||||
"branchAhead": "master"
|
||||
});
|
||||
|
||||
const messages = commits.map(({ commit })=> commit.message );
|
||||
|
||||
console.log(JSON.stringify(messages, null, 2));
|
||||
|
||||
})();
|
||||
28
src/tools/test/octokit-addons/getCommitAsyncIterable.ts
Normal file
28
src/tools/test/octokit-addons/getCommitAsyncIterable.ts
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
|
||||
import { getCommitAsyncIterableFactory } from "../../octokit-addons/getCommitAsyncIterable";
|
||||
import { createOctokit } from "../../createOctokit";
|
||||
|
||||
|
||||
(async function () {
|
||||
|
||||
const octokit = createOctokit({ "github_token": "" });
|
||||
|
||||
const { getCommitAsyncIterable } = getCommitAsyncIterableFactory({ octokit });
|
||||
|
||||
const commitAsyncIterable = getCommitAsyncIterable({
|
||||
"owner": "garronej",
|
||||
"repo": "test-repo",
|
||||
"branch": "master"
|
||||
});
|
||||
|
||||
for await (const commit of commitAsyncIterable) {
|
||||
console.log(commit.commit.message);
|
||||
}
|
||||
|
||||
console.log("done");
|
||||
|
||||
})();
|
||||
|
||||
|
||||
|
||||
|
||||
23
src/tools/test/octokit-addons/getCommonOrigin.ts
Normal file
23
src/tools/test/octokit-addons/getCommonOrigin.ts
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
|
||||
import { getCommonOriginFactory } from "../../octokit-addons/getCommonOrigin";
|
||||
import { Octokit } from "@octokit/rest";
|
||||
|
||||
|
||||
(async function () {
|
||||
|
||||
const octokit = new Octokit();
|
||||
|
||||
const { getCommonOrigin } = getCommonOriginFactory({ octokit });
|
||||
|
||||
const { sha } = await getCommonOrigin({
|
||||
"owner": "garronej",
|
||||
"repo": "test-repo",
|
||||
"branch1": "master",
|
||||
"branch2": "garronej-patch-1"
|
||||
});
|
||||
|
||||
console.log({ sha });
|
||||
|
||||
})();
|
||||
|
||||
|
||||
21
src/tools/test/octokit-addons/listCommit.ts
Normal file
21
src/tools/test/octokit-addons/listCommit.ts
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
|
||||
import { listCommitFactory } from "../../octokit-addons/listCommit";
|
||||
import { createOctokit } from "../../createOctokit";
|
||||
|
||||
(async ()=>{
|
||||
|
||||
const octokit = createOctokit({ "github_token": "" });
|
||||
|
||||
|
||||
const { listCommit } = listCommitFactory({ octokit });
|
||||
|
||||
const commits= await listCommit({
|
||||
"owner": "garronej",
|
||||
"repo": "supreme_tribble",
|
||||
"branch": "dev",
|
||||
"sha": "84792f5719d0812e6917051b5c6331891187ca20"
|
||||
});
|
||||
|
||||
console.log(JSON.stringify(commits, null, 2));
|
||||
|
||||
})();
|
||||
Loading…
Add table
Add a link
Reference in a new issue