Skip to content

Move .gitignore creation from init to logs download#13749

Merged
pelikhan merged 2 commits intomainfrom
copilot/ensure-gitignore-file-exists
Feb 4, 2026
Merged

Move .gitignore creation from init to logs download#13749
pelikhan merged 2 commits intomainfrom
copilot/ensure-gitignore-file-exists

Conversation

Copy link
Contributor

Copilot AI commented Feb 4, 2026

The .github/aw/logs/.gitignore file was created eagerly during gh aw init, requiring users to run init before downloading logs. Now created lazily on every gh aw logs invocation.

Changes

  • pkg/cli/init.go: Removed ensureLogsGitignore() calls from initializeBasicRepository() and InitRepository()
  • pkg/cli/logs_orchestrator.go: Added ensureLogsGitignore() at start of DownloadWorkflowLogs() - errors logged but non-blocking
  • pkg/cli/init_command.go: Removed .gitignore creation from help text
  • Tests: Updated to reflect new behavior - init no longer creates the file

Implementation

func DownloadWorkflowLogs(...) error {
    // Ensure .github/aw/logs/.gitignore exists on every invocation
    if err := ensureLogsGitignore(); err != nil {
        // Log but don't fail - this is not critical for downloading logs
        logsOrchestratorLog.Printf("Failed to ensure logs .gitignore: %v", err)
    }
    // ... rest of function
}

The ensureLogsGitignore() function remains unchanged - idempotent check-and-create logic in pkg/cli/git.go.

Original prompt

Do not eagerly generate a .gitignore file in .github/aw/logs in the init command.

The logs download code should ensure this file exists on every invocation.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

- Remove .gitignore creation from init command (initializeBasicRepository and InitRepository functions)
- Add .gitignore creation to logs download orchestrator (DownloadWorkflowLogs function)
- Update init command help text to remove mention of .gitignore creation
- Update init tests to no longer expect .gitignore file creation
- .gitignore file is now created on every logs download invocation, not eagerly during init

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan pelikhan marked this pull request as ready for review February 4, 2026 15:52
Copilot AI review requested due to automatic review settings February 4, 2026 15:52
Copilot AI changed the title [WIP] Ensure .gitignore file is generated for logs directory Move .gitignore creation from init to logs download Feb 4, 2026
Copilot AI requested a review from pelikhan February 4, 2026 15:54
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR moves the generation of .github/aw/logs/.gitignore from the init command to the logs download command, ensuring the file is created on every logs download invocation rather than only during repository initialization.

Changes:

  • Removed .gitignore creation from both initializeBasicRepository and InitRepository functions in init.go
  • Added .gitignore creation at the beginning of DownloadWorkflowLogs in logs_orchestrator.go with graceful error handling
  • Updated init command help text to remove mention of .gitignore creation

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
pkg/cli/logs_orchestrator.go Added call to ensureLogsGitignore() at the start of DownloadWorkflowLogs with non-critical error handling
pkg/cli/init.go Removed ensureLogsGitignore() calls from both initializeBasicRepository and InitRepository functions
pkg/cli/init_command.go Updated help text to remove mention of .gitignore creation for logs directory
pkg/cli/init_test.go Removed test assertions that checked for .gitignore file creation, added comments explaining the change
pkg/cli/init_command_test.go Removed test assertion that checked for .gitignore file creation in init tests

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@pelikhan pelikhan merged commit 529183c into main Feb 4, 2026
162 of 163 checks passed
@pelikhan pelikhan deleted the copilot/ensure-gitignore-file-exists branch February 4, 2026 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments