Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions actions/pinact/pinact.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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';
Expand Down
23 changes: 20 additions & 3 deletions tests/pinact/test_pinact.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,11 @@ function handleGitCommand(args, options) {
return '';
}

// Handle git add
if (args[0] === 'add') {
return '';
}

return '';
}

Expand Down Expand Up @@ -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 });

Expand All @@ -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 });

Expand All @@ -1087,7 +1094,6 @@ describe('Pinact Action', () => {
});

test('should commit with appropriate message', async () => {
setupSingleRepoWithChanges();

await runPinactAction({ github: mockGithub, context: mockContext, core: mockCore });

Expand All @@ -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', () => {
Expand Down
Loading