Merge branch 'main' into add-pr-checks

This commit is contained in:
scubbo 2025-03-03 22:52:31 +00:00
commit de78ced784

View File

@ -32,10 +32,6 @@ export async function main(sourceRepo: Repo, targetRepo: Repo, dryRun: boolean,
console.log(`DEBUG - sourceRepoCloneCommand: ${sourceRepoCloneCommand}`); console.log(`DEBUG - sourceRepoCloneCommand: ${sourceRepoCloneCommand}`);
execSync(sourceRepoCloneCommand); execSync(sourceRepoCloneCommand);
execSync(`git clone https://${repoString(targetRepo)} ${TARGET_DIR}`); execSync(`git clone https://${repoString(targetRepo)} ${TARGET_DIR}`);
// Seems like setting `--author` on `git commit` is not sufficient - still need to set `user` as well (I guess those
// are the difference between `comitted by` and `written by`?)
execSync(`git config --global user.email "commit-report-sync-bot@scubbo.org"`, { cwd: TARGET_DIR });
execSync(`git config --global user.name "Commit Report Sync Bot"`, { cwd: TARGET_DIR });
// Logic: // Logic:
// * Go back as far in source commit history as the given number of commits // * Go back as far in source commit history as the given number of commits
@ -245,6 +241,15 @@ function createRepresentativeCommit(sourceRepo: Repo,sourceCommit: Commit) {
cwd: TARGET_DIR cwd: TARGET_DIR
}) })
// Seems like setting `--author` on `git commit` is not sufficient - still need to set `user` as well (I guess those
// are the difference between `comitted by` and `written by`?)
// Confirmed by following the instructions [here](https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-github-profile/managing-contribution-settings-on-your-profile/why-are-my-contributions-not-showing-up-on-my-profile#your-local-git-commit-email-isnt-connected-to-your-account)
// to check the "made by" address, and confirming that it did not match the email set in the `--author` flag.
// Note that, contrary to advice given by the CLI, this does not use the global config, but the local one - because,
// otherwise, if this was run locally, it would mess up the host system's config.
execSync(`git config user.email "${sourceCommit.author_email}"`, { cwd: TARGET_DIR });
execSync(`git config user.name "${sourceCommit.author_name}"`, { cwd: TARGET_DIR });
try { try {
// Do _not_ arbitrarily remove the `hash` - it's used for signalling identity in `main()` // Do _not_ arbitrarily remove the `hash` - it's used for signalling identity in `main()`
const args = `"${sourceRepo.owner}/${sourceRepo.name}: ${sourceCommit.message} - ${sourceCommit.hash}" --date="${format(sourceCommit.date, 'yyyy-MM-dd HH:mm:ss')}" --author="${sourceCommit.author_name} <${sourceCommit.author_email}>"`; const args = `"${sourceRepo.owner}/${sourceRepo.name}: ${sourceCommit.message} - ${sourceCommit.hash}" --date="${format(sourceCommit.date, 'yyyy-MM-dd HH:mm:ss')}" --author="${sourceCommit.author_name} <${sourceCommit.author_email}>"`;