Skip to content

Commit

Permalink
wip: adding a TODO to remember
Browse files Browse the repository at this point in the history
  • Loading branch information
karliatto committed Nov 15, 2024
1 parent 84bd8f5 commit 93544ea
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions scripts/ci/check-connect-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@ const updateConfigFromJSON = async () => {

console.log('Checking if there were changes.');
const changes = await exec('git', ['diff', CONFIG_FILE_PATH]);
// Use the content to generate the hash in the branch so it is the same with same content.
// If we would use the hash provided by Git it would be different because it contains date as well.
const fileContent = await fs.readFile(CONFIG_FILE_PATH, 'utf8');
const hash = crypto.createHash('sha256').update(fileContent).digest('hex');

// Use the hash to create branch name to avoid using a branch that already exists.
const branchName = `chore/update-device-authenticity-config-${hash}`;

if (changes.stdout !== '') {
console.log('There were changes in keys.');

Expand Down Expand Up @@ -116,6 +124,7 @@ const updateConfigFromJSON = async () => {
'trezor/trezor-suite',
]);
console.log(`Closed PR #${prNumber}`);
// TODO: after closing the PR we should delete the branch.
} catch (error) {
console.error(`Failed to close PR #${prNumber}:`, error.message);
}
Expand All @@ -124,13 +133,6 @@ const updateConfigFromJSON = async () => {
console.log(`No open pull requests found.`);
}

// Use the content to generate the hash in the branch so it is the same with same content.
// If we would use the hash provided by Git it would be different because it contains date as well.
const fileContent = await fs.readFile(CONFIG_FILE_PATH, 'utf8');
const hash = crypto.createHash('sha256').update(fileContent).digest('hex');

// Use the hash to create branch name to avoid using a branch that already exists.
const branchName = `chore/update-device-authenticity-config-${hash}`;
const commitMessage = 'chore(connect): update device authenticity config';
await exec('git', ['checkout', '-b', branchName]);
commit({
Expand Down

0 comments on commit 93544ea

Please sign in to comment.