mirror of
https://github.com/actualbudget/actual.git
synced 2026-03-11 20:44:32 -05:00
* Initial plan * [AI] Make AI-generated release notes not run on release/ branches Co-authored-by: jfdoming <9922514+jfdoming@users.noreply.github.com> * [AI] Use explicit startsWith(github.head_ref) if conditions instead of JS changes Co-authored-by: jfdoming <9922514+jfdoming@users.noreply.github.com> * Delete extra condition * Add release notes for PR #7107 * [autofix.ci] apply automated fixes * FIx note * Add head branch information to PR details * Refactor conditions for release notes generation * Sec --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jfdoming <9922514+jfdoming@users.noreply.github.com> Co-authored-by: Julian Dominguez-Schatz <julian.dominguezschatz@gmail.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
65 lines
1.6 KiB
JavaScript
Executable File
65 lines
1.6 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;
|
|
|
|
if (!token || !repo || !issueNumber) {
|
|
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 getPRDetails() {
|
|
try {
|
|
console.log(
|
|
`Fetching PR details for ${owner}/${repoName}#${issueNumber}...`,
|
|
);
|
|
|
|
const { data: pr } = await octokit.rest.pulls.get({
|
|
owner,
|
|
repo: repoName,
|
|
pull_number: issueNumber,
|
|
});
|
|
|
|
console.log('PR details fetched successfully');
|
|
console.log('- PR Number:', pr.number);
|
|
console.log('- PR Author:', pr.user.login);
|
|
console.log('- PR Title:', pr.title);
|
|
console.log('- Base Branch:', pr.base.ref);
|
|
console.log('- Head Branch:', pr.head.ref);
|
|
|
|
const result = {
|
|
number: pr.number,
|
|
author: pr.user.login,
|
|
title: pr.title,
|
|
baseBranch: pr.base.ref,
|
|
headBranch: pr.head.ref,
|
|
};
|
|
|
|
setOutput('result', JSON.stringify(result));
|
|
} catch (error) {
|
|
console.log('Error getting PR details:', error.message);
|
|
console.log('Stack:', error.stack);
|
|
setOutput('result', 'null');
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
getPRDetails().catch(error => {
|
|
console.log('Unhandled error:', error.message);
|
|
console.log('Stack:', error.stack);
|
|
setOutput('result', 'null');
|
|
process.exit(1);
|
|
});
|