Skip to content

Commit 6093046

Browse files
committed
fix(context-ledger): run script from workspace directory
1 parent 5d1e458 commit 6093046

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

action.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,7 @@ runs:
332332
PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
333333
VERSION_INCREMENT: ${{ inputs.version_increment }}
334334
run: |
335-
cd "${{ github.action_path }}"
336-
node lib/generate-changelog.js
335+
node "${{ github.action_path }}/lib/generate-changelog.js"
337336
338337
- name: Check changelog status
339338
if: steps.check-suggestions.outputs.should_skip != 'true'

lib/generate-changelog.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -259,13 +259,13 @@ async function updateChangelog() {
259259
console.log('Version increment:', versionIncrement);
260260

261261
// Read input data files
262-
const commitsData = fs.readFileSync(path.join(process.cwd(), 'recent_commits.txt'), 'utf8').trim();
263-
const changedFilesData = fs.readFileSync(path.join(process.cwd(), 'changed_files.txt'), 'utf8').trim();
262+
const commitsData = fs.readFileSync('recent_commits.txt', 'utf8').trim();
263+
const changedFilesData = fs.readFileSync('changed_files.txt', 'utf8').trim();
264264

265265
// Check if there are any commits to analyze
266266
if (!commitsData) {
267267
console.log('No commits found to analyze');
268-
fs.writeFileSync(path.join(process.cwd(), 'changelog_status.txt'), 'NO_UPDATE');
268+
fs.writeFileSync('changelog_status.txt', 'NO_UPDATE');
269269
return;
270270
}
271271

@@ -315,7 +315,7 @@ async function updateChangelog() {
315315

316316
if (newChangelogContent === 'NO_UPDATE_NEEDED') {
317317
console.log('Claude determined no changelog update is needed');
318-
fs.writeFileSync(path.join(process.cwd(), 'changelog_status.txt'), 'NO_UPDATE');
318+
fs.writeFileSync('changelog_status.txt', 'NO_UPDATE');
319319
return;
320320
}
321321

@@ -349,11 +349,11 @@ async function updateChangelog() {
349349

350350
// Save the new content with marker for suggestions
351351
const newContentWithMarker = newChangelogContent + '\n\n<!-- AI_APPEND_HERE -->';
352-
fs.writeFileSync(path.join(process.cwd(), 'new_content.txt'), newContentWithMarker);
353-
fs.writeFileSync(path.join(process.cwd(), 'changelog_status.txt'), 'UPDATED');
352+
fs.writeFileSync('new_content.txt', newContentWithMarker);
353+
fs.writeFileSync('changelog_status.txt', 'UPDATED');
354354

355355
// Save version info
356-
fs.writeFileSync(path.join(process.cwd(), 'version_info.txt'), JSON.stringify({
356+
fs.writeFileSync('version_info.txt', JSON.stringify({
357357
version: newVersion,
358358
increment: increment,
359359
previousVersion: latestTag
@@ -365,7 +365,7 @@ async function updateChangelog() {
365365

366366
} catch (error) {
367367
console.error('Error updating changelog:', error);
368-
fs.writeFileSync(path.join(process.cwd(), 'changelog_status.txt'), 'ERROR');
368+
fs.writeFileSync('changelog_status.txt', 'ERROR');
369369
process.exit(1);
370370
}
371371
}

0 commit comments

Comments
 (0)