Skip to content

Commit

Permalink
chores: testing
Browse files Browse the repository at this point in the history
  • Loading branch information
UcheSylvester committed Nov 6, 2023
1 parent 05a5b36 commit 817a4b9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/get-changed-files.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { exec } from 'child_process';

export const getChangedFiles = async (base: string, head: string) => {
const command = `git diff --name-only ${base} ${head}`;
const command = `git diff --name-only ${base.trim()} ${head.trim()}`;
console.log({ command, base, head });
return new Promise<string>((resolve, reject) => {
exec(command.trim(), (error, stdout) => {
Expand Down
37 changes: 18 additions & 19 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { context } from '@actions/github';
// import { getChangedFiles } from './get-changed-files';
// import { getReviewersUsernames } from './changed-files-reviewers';
// import { getInput } from '@actions/core';
import { exec } from 'child_process';
import { context, getOctokit } from '@actions/github';
import { getChangedFiles } from './get-changed-files';
import { getReviewersUsernames } from './changed-files-reviewers';
import { getInput } from '@actions/core';

/**
* STEPS
Expand All @@ -23,24 +22,24 @@ import { exec } from 'child_process';
const run = async () => {
try {
console.log({ pr: context.payload.pull_request });
// const baseSha =
// context.payload.pull_request?.base.sha ||
// '2d2f73c099310be56ace9e4aa3a922eb23ff0650';
// const headSha =
// context.payload.pull_request?.head.sha ||
// '71c867b0d68417a9de4774aedb92182169028538';
const baseSha =
context.payload.pull_request?.base.sha ||
'2d2f73c099310be56ace9e4aa3a922eb23ff0650';
const headSha =
context.payload.pull_request?.head.sha ||
'71c867b0d68417a9de4774aedb92182169028538';

// const token = getInput('github-token');
// const Octokit = getOctokit(token);
const token = getInput('github-token');
const Octokit = getOctokit(token);

// const changedFiles = await getChangedFiles(baseSha, headSha);
// const usernames = await getReviewersUsernames(Octokit, changedFiles);
const changedFiles = await getChangedFiles(baseSha, headSha);
const usernames = await getReviewersUsernames(Octokit, changedFiles);

// console.log({ usernames, changedFiles });
console.log({ usernames, changedFiles });

exec('ls', (error, stdout) => {
console.log({ error, stdout });
});
// exec('ls', (error, stdout) => {
// console.log({ error, stdout });
// });
} catch (error) {
console.log({ error });
}
Expand Down

0 comments on commit 817a4b9

Please sign in to comment.