diff --git a/actions/pinact/pinact.js b/actions/pinact/pinact.js index df5141fc..bc4ba292 100644 --- a/actions/pinact/pinact.js +++ b/actions/pinact/pinact.js @@ -307,7 +307,7 @@ function runPinact(pinactPath, repoPath, pinactConfigPath = '') { Logger.header('=== Changes made by pinact ==='); Logger.log(''); try { - const diff = execFileSync(executablePaths.git, ['diff', '--color=always', '.github/workflows'], { cwd: repoPath, encoding: 'utf-8' }); + const diff = execFileSync(executablePaths.git, ['diff', '--color=always'], { cwd: repoPath, encoding: 'utf-8' }); Logger.log(diff); } catch (diffError) { Logger.warning('⚠️ Could not display diff: ' + diffError.message); @@ -360,7 +360,7 @@ function commitAndPush(repoPath, options) { execFileSync(executablePaths.git, ['checkout', '-b', branchName], { cwd: repoPath }); // Add all changes - execFileSync(executablePaths.git, ['add', '.github/workflows'], { cwd: repoPath }); + execFileSync(executablePaths.git, ['add', '.'], { cwd: repoPath }); // Commit changes const commitMessage = 'chore: update GitHub Actions to use commit hashes'; diff --git a/tests/pinact/test_pinact.test.js b/tests/pinact/test_pinact.test.js index 610a709b..232070e0 100644 --- a/tests/pinact/test_pinact.test.js +++ b/tests/pinact/test_pinact.test.js @@ -318,6 +318,11 @@ function handleGitCommand(args, options) { return ''; } + // Handle git add + if (args[0] === 'add') { + return ''; + } + return ''; } @@ -1052,11 +1057,14 @@ describe('Pinact Action', () => { }); describe('Git Operations', () => { + beforeEach(() => { + setupSingleRepoWithChanges(); + }); + test('should configure git with custom author', async () => { process.env.INPUT_GIT_AUTHOR_NAME = 'Custom Bot'; process.env.INPUT_GIT_AUTHOR_EMAIL = 'bot@example.com'; - setupSingleRepoWithChanges(); await runPinactAction({ github: mockGithub, context: mockContext, core: mockCore }); @@ -1075,7 +1083,6 @@ describe('Pinact Action', () => { test('should create branch with custom name', async () => { process.env.INPUT_PR_BRANCH_NAME = 'custom-branch'; - setupSingleRepoWithChanges(); await runPinactAction({ github: mockGithub, context: mockContext, core: mockCore }); @@ -1087,7 +1094,6 @@ describe('Pinact Action', () => { }); test('should commit with appropriate message', async () => { - setupSingleRepoWithChanges(); await runPinactAction({ github: mockGithub, context: mockContext, core: mockCore }); @@ -1097,6 +1103,17 @@ describe('Pinact Action', () => { expect.any(Object) ); }); + + test('should stage all changed files regardless of directory', async () => { + + await runPinactAction({ github: mockGithub, context: mockContext, core: mockCore }); + + expect(execFileSync).toHaveBeenCalledWith( + expect.stringMatching(/git/), + ['add', '.'], + expect.any(Object) + ); + }); }); describe('Pull Request Creation', () => {