Skip to content

Commit

Permalink
enhance commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
ibakshay committed Feb 9, 2023
1 parent 8b079a8 commit 7ae6ca3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 26 deletions.
19 changes: 6 additions & 13 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1904,8 +1904,8 @@ function updateFile(sha, claFileContent, reactedCommitters) {
return __awaiter(this, void 0, void 0, function* () {
const octokitInstance = isRemoteRepoOrOrgConfigured() ? (0, octokit_1.getPATOctokit)() : (0, octokit_1.getDefaultOctokitClient)();
const pullRequestNo = github_1.context.issue.number;
console.log(input.getSignedCommitMessage());
console.log(JSON.stringify(github_1.context.issue, null, 3));
const owner = github_1.context.issue.owner;
const repo = github_1.context.issue.repo;
claFileContent === null || claFileContent === void 0 ? void 0 : claFileContent.signedContributors.push(...reactedCommitters.newSigned);
let contentString = JSON.stringify(claFileContent, null, 2);
let contentBinary = Buffer.from(contentString).toString('base64');
Expand All @@ -1918,20 +1918,13 @@ function updateFile(sha, claFileContent, reactedCommitters) {
? input
.getSignedCommitMessage()
.replace('$contributorName', github_1.context.actor)
.replace('$pullRequestNo', pullRequestNo.toString())
.replace('$owner', github_1.context.issue.owner)
.replace('$repo', github_1.context.issue.repo)
: `@${github_1.context.actor} has signed the CLA from Pull Request #${pullRequestNo}`,
// .replace('$pullRequestNo', pullRequestNo.toString())
.replace('$owner', owner)
.replace('$repo', repo)
: `@${github_1.context.actor} has signed the CLA in ${owner}/${repo}#${pullRequestNo}`,
content: contentBinary,
branch: input.getBranch()
});
const test = input
.getSignedCommitMessage()
.replace('$contributorName', github_1.context.actor)
.replace('$pullRequestNo', pullRequestNo.toString())
.replace('$owner', github_1.context.issue.owner)
.replace('$repo', github_1.context.issue.repo);
console.log(test);
});
}
exports.updateFile = updateFile;
Expand Down
20 changes: 7 additions & 13 deletions src/persistence/persistence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ export async function updateFile(
isRemoteRepoOrOrgConfigured() ? getPATOctokit() : getDefaultOctokitClient()

const pullRequestNo = context.issue.number
console.log(input.getSignedCommitMessage())
console.log(JSON.stringify(context.issue, null, 3))
const owner = context.issue.owner
const repo = context.issue.repo

claFileContent?.signedContributors.push(...reactedCommitters.newSigned)
let contentString = JSON.stringify(claFileContent, null, 2)
let contentBinary = Buffer.from(contentString).toString('base64')
Expand All @@ -58,20 +59,13 @@ export async function updateFile(
? input
.getSignedCommitMessage()
.replace('$contributorName', context.actor)
.replace('$pullRequestNo', pullRequestNo.toString())
.replace('$owner', context.issue.owner)
.replace('$repo', context.issue.repo)
: `@${context.actor} has signed the CLA from Pull Request #${pullRequestNo}`,
// .replace('$pullRequestNo', pullRequestNo.toString())
.replace('$owner', owner)
.replace('$repo', repo)
: `@${context.actor} has signed the CLA in ${owner}/${repo}#${pullRequestNo}`,
content: contentBinary,
branch: input.getBranch()
})
const test = input
.getSignedCommitMessage()
.replace('$contributorName', context.actor)
.replace('$pullRequestNo', pullRequestNo.toString())
.replace('$owner', context.issue.owner)
.replace('$repo', context.issue.repo)
console.log(test)
}

function isRemoteRepoOrOrgConfigured(): boolean {
Expand Down

0 comments on commit 7ae6ca3

Please sign in to comment.