Skip to content

Conversation

@kevinbackhouse
Copy link
Contributor

I want to automatically open .env in the editor when you first create a codespace. The openFiles section in devcontainer.json
didn't work because .env isn't a checked-in file. post-create.sh also didn't work because the code command doesn't work yet at that stage of the devcontainer initialization. So I've moved it to post-attach.sh.

Copilot AI review requested due to automatic review settings January 30, 2026 18:40
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 .env file creation and automatic opening logic from post-create.sh to post-attach.sh to enable automatic opening of the .env file in the VS Code editor. The change addresses a limitation where the code command is not available during the postCreateCommand phase but is available during postAttachCommand.

Changes:

  • Removed .env file creation logic from post-create.sh
  • Added .env file creation and automatic opening via code .env command to post-attach.sh
  • Removed .env from the openFiles array in devcontainer.json as it's now opened programmatically

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
.devcontainer/post-create.sh Removed the .env file creation logic that was previously executed during container creation
.devcontainer/post-attach.sh Added .env file creation and automatic opening logic to run when attaching to the container
.devcontainer/devcontainer.json Removed .env from the openFiles configuration since it's now opened programmatically via the code command

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

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings January 30, 2026 18:49
@kevinbackhouse kevinbackhouse marked this pull request as ready for review January 30, 2026 18:49
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

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


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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant