trigger.dev icon indicating copy to clipboard operation
trigger.dev copied to clipboard

docs: improve env var documentation with .env upload + ctx environmen…

Open lindseystead opened this issue 1 month ago • 2 comments

docs: improve env var documentation with .env upload + ctx environment details

Closes #1248

✅ Checklist

  • [x] I have followed every step in the contributing guide
  • [x] The PR title follows the convention.
  • [x] I ran and tested the code works

Summary

This PR addresses issue #1248 by adding two missing documentation sections to the environment variables guide:

  1. Initial load from .env file: Documents how to use envvars.upload() to initially load environment variables from a .env file into Trigger.dev cloud environment. This was previously undocumented.

  2. Getting the current environment: Documents how to access the current environment information (ctx.environment.slug, ctx.environment.type, etc.) when using envvars.retrieve(), which previously had no direct way to determine the current environment.


Testing

  • Verified the documentation renders correctly in the docs site
  • Checked that code examples are syntactically correct
  • Confirmed the sections are properly placed in the documentation structure

Changelog

  • Added "Initial load from .env file" section with examples for both outside and inside task contexts
  • Added "Getting the current environment" section explaining how to use ctx.environment to access environment information
  • Both sections include code examples and links to related documentation

Screenshots

N/A - Documentation only change

lindseystead avatar Nov 13 '25 17:11 lindseystead

⚠️ No Changeset found

Latest commit: 997c183364a42d7428619e03e8bfb65660794aed

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

changeset-bot[bot] avatar Nov 13 '25 17:11 changeset-bot[bot]

Walkthrough

This pull request updates the deployment environment variables documentation file by adding sections that explain how to perform initial environment variable loading using envvars.upload() with code examples for both project-scoped and task-scoped usage. It also documents how to retrieve current environment information within a task via the context object (ctx.environment, ctx.project.ref), including clarification on what each property provides, and introduces a contrasting note between envvars.upload() and syncEnvVars.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10–15 minutes

  • Verify accuracy of envvars.upload() API usage and behavior descriptions in both project-scoped and task-scoped contexts
  • Confirm correctness of context object property access examples (ctx.environment.slug, ctx.environment.type, ctx.environment.id, ctx.project.ref)
  • Validate the distinction and contrast drawn between envvars.upload() and syncEnvVars
  • Ensure code examples are executable and follow project documentation conventions

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main changes: adding documentation for .env file upload and context environment details in the env var guide.
Description check ✅ Passed The description follows the template structure with all required sections completed: issue link, checklist, summary, testing details, changelog, and screenshots note.
Linked Issues check ✅ Passed The PR fully addresses both requirements from issue #1248: documents envvars.upload() for initial .env loading and explains how to access current environment via ctx.environment.
Out of Scope Changes check ✅ Passed All changes are documentation updates directly addressing the two objectives from issue #1248, with no unrelated code modifications present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar Nov 13 '25 18:11 coderabbitai[bot]