mirror of
https://github.com/actualbudget/actual.git
synced 2026-03-11 20:44:32 -05:00
* [AI] Desktop client, E2E, loot-core, sync-server and tooling updates Co-authored-by: Cursor <cursoragent@cursor.com> * Refactor database handling in various modules to use async/await for improved readability and error handling. This includes updates to database opening and closing methods across multiple files, ensuring consistent asynchronous behavior. Additionally, minor adjustments were made to encryption functions to support async operations. * Refactor sync migration tests to utilize async/await for improved readability. Updated transaction handling to streamline event expectations and cleanup process. * Refactor various functions to utilize async/await for improved readability and error handling. Updated service stopping, encryption, and file upload/download methods to ensure consistent asynchronous behavior across the application. * Refactor BudgetFileSelection component to use async/await for onSelect method, enhancing error handling and readability. Update merge tests to utilize async/await for improved clarity in transaction merging expectations. * Refactor filesystem module to use async/await for init function and related database operations, enhancing error handling and consistency across file interactions. Updated tests to reflect asynchronous behavior in database operations and file writing. * Fix typo in init function declaration to ensure it returns a Promise<void> instead of Proise<void>. * Update VRT screenshots Auto-generated by VRT workflow PR: #6987 * Update tests to use async/await for init function in web filesystem, ensuring consistent asynchronous behavior in database operations. * Update VRT screenshot for payees filter test to reflect recent changes * [AI] Fix no-floating-promises lint error in desktop-electron Wrapped queuedClientWinLogs.map() with Promise.all and void operator to properly handle the array of promises for executing queued logs. Co-authored-by: Matiss Janis Aboltins <MatissJanis@users.noreply.github.com> * Refactor promise handling in global and sync event handlers * Update VRT screenshots Auto-generated by VRT workflow PR: #6987 --------- Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Matiss Janis Aboltins <MatissJanis@users.noreply.github.com>
78 lines
2.0 KiB
JavaScript
Executable File
78 lines
2.0 KiB
JavaScript
Executable File
#!/usr/bin/env node
|
|
|
|
import fs from 'fs';
|
|
|
|
import { Octokit } from '@octokit/rest';
|
|
|
|
const token = process.env.GITHUB_TOKEN;
|
|
const repo = process.env.GITHUB_REPOSITORY;
|
|
const issueNumber = process.env.GITHUB_EVENT_ISSUE_NUMBER;
|
|
const prDetailsJson = process.env.PR_DETAILS;
|
|
|
|
if (!token || !repo || !issueNumber || !prDetailsJson) {
|
|
console.log('Missing required environment variables');
|
|
process.exit(1);
|
|
}
|
|
|
|
const [owner, repoName] = repo.split('/');
|
|
const octokit = new Octokit({ auth: token });
|
|
|
|
function setOutput(name, value) {
|
|
fs.appendFileSync(process.env.GITHUB_OUTPUT, `${name}=${value}\n`);
|
|
}
|
|
|
|
async function checkReleaseNotesExists() {
|
|
try {
|
|
const prDetails = JSON.parse(prDetailsJson);
|
|
if (!prDetails) {
|
|
console.log('No PR details available, skipping file check');
|
|
setOutput('result', 'false');
|
|
return;
|
|
}
|
|
|
|
const fileName = `upcoming-release-notes/${prDetails.number}.md`;
|
|
|
|
// Get PR info to get head SHA
|
|
const { data: pr } = await octokit.rest.pulls.get({
|
|
owner,
|
|
repo: repoName,
|
|
pull_number: issueNumber,
|
|
});
|
|
|
|
const prHeadSha = pr.head.sha;
|
|
console.log(
|
|
`Checking for file on PR branch: ${pr.head.ref} (${prHeadSha})`,
|
|
);
|
|
|
|
// Check if file exists
|
|
try {
|
|
await octokit.rest.repos.getContent({
|
|
owner,
|
|
repo: repoName,
|
|
path: fileName,
|
|
ref: prHeadSha,
|
|
});
|
|
|
|
console.log(
|
|
`Release notes file already exists on PR branch: ${fileName}`,
|
|
);
|
|
setOutput('result', 'true');
|
|
} catch (error) {
|
|
if (error.status === 404) {
|
|
console.log(
|
|
`No existing release notes file found on PR branch: ${fileName}`,
|
|
);
|
|
setOutput('result', 'false');
|
|
} else {
|
|
console.log('Error checking file existence:', error.message);
|
|
setOutput('result', 'false');
|
|
}
|
|
}
|
|
} catch (error) {
|
|
console.log('Error in file existence check:', error.message);
|
|
setOutput('result', 'false');
|
|
}
|
|
}
|
|
|
|
void checkReleaseNotesExists();
|