Skip to content

Commit

Permalink
chore: update mergeReleaseChangelog.mjs no5 [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
ilhan007 authored Nov 2, 2024
1 parent 0f8428f commit 4bcdd77
Showing 1 changed file with 15 additions and 26 deletions.
41 changes: 15 additions & 26 deletions .github/actions/mergeReleaseChangelog.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// import { promises as fs } from 'node:fs';

const extractChangelogSections = (releaseBody) => {
const fixes = [];
const features = [];
Expand Down Expand Up @@ -36,25 +34,17 @@ const updateRelease = async (releaseContext) => {
const tag = `v${releaseContext.version}`; // Ensure `version` is defined in your script's scope

try {
// const response = await releaseContext.github.request('PATCH /repos/{owner}/{repo}/releases/tags/{tag}', {
// owner: releaseContext.owner,
// repo: releaseContext.repo,
// tag,
// body,
// });

console.log("Release Context:", releaseContext);
console.log(`Release body ${tag}:`, body);

// console.log("Release updated successfully:", response.data);
await releaseContext.github.request('PATCH /repos/{owner}/{repo}/releases/tags/{tag}', {
owner: releaseContext.owner,
repo: releaseContext.repo,
tag,
body,
});

console.log("Release updated successfully:", releaseContext);
} catch (error) {
console.error("Error updating release:", error);
console.error("Error updating release:", error, );
}

// if (!response.ok) {
// throw new Error(`Failed to update release: ${response.statusText}`);
// }
console.log('Minor release changelog updated successfully.');
};

/**
Expand All @@ -64,14 +54,13 @@ const updateRelease = async (releaseContext) => {
* @param options.context
*/
export default async function run({ github, context }) {
// const lerna = await fs.readFile(new URL('../../lerna.json', import.meta.url), 'utf8');
// const { version } = JSON.parse(lerna);
// if (!version.startsWith("2")) {
// console.warn('Skip: the task is relevant for version 2');
// return;
// }
const lerna = await fs.readFile(new URL('../../lerna.json', import.meta.url), 'utf8');
const { version } = JSON.parse(lerna);

const version = "2.4.0";
if (!version.startsWith("2")) {
console.warn('Skip: the task is relevant for version 2');
return;
}

try {
const { owner, repo } = context.repo;
Expand Down

0 comments on commit 4bcdd77

Please sign in to comment.