unjs / unjs/std-env

Support standard build envs for CI / Git integrations

Open
#59 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

discussion
Dominant language
TypeScript
Stars
641
Forks
41
PR merge metrics
No merged PRs in 30d

Description

CI/CD pipelines often provide variables such as deployment URL, git hash, git branch, etc. We might expose standard exports that can scan them.

Some providers:

Vercel

https://vercel.com/docs/projects/environment-variables/system-environment-variables

VERCEL_URL, VERCEL_BRANCH_URL, VERCEL_GIT_PROVIDER, VERCEL_GIT_REPO_SLUG, VERCEL_GIT_REPO_OWNER, VERCEL_GIT_REPO_ID, VERCEL_GIT_COMMIT_REF, VERCEL_GIT_COMMIT_SHA, VERCEL_GIT_COMMIT_MESSAGE, VERCEL_GIT_COMMIT_AUTHOR_LOGIN, VERCEL_GIT_COMMIT_AUTHOR_NAME, VERCEL_GIT_PREVIOUS_SHA

Netlify

https://docs.netlify.com/configure-builds/environment-variables/

REPOSITORY_URL, BRANCH, HEAD, COMMIT_REF, CACHED_COMMIT_REF, CACHED_COMMIT_REF, PULL_REQUEST, REVIEW_ID, URL, DEPLOY_URL, DEPLOY_PRIME_URL

Github Actions

https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables

GITHUB_SHA, GITHUB_ACTOR, GITHUB_API_URL, GITHUB_BASE_REF, GITHUB_HEAD_REF, GITHUB_REF, GITHUB_REF_NAME, GITHUB_REPOSITORY, GITHUB_REPOSITORY_OWNER, GITHUB_REPOSITORY_OWNER_ID, GITHUB_WORKFLOW_SHA

Gitlab CI

https://docs.gitlab.com/ee/ci/variables/predefined_variables.html

CI_COMMIT_AUTHOR, CI_COMMIT_BEFORE_SHA, CI_COMMIT_BRANCH, CI_COMMIT_DESCRIPTION, CI_COMMIT_MESSAGE, CI_COMMIT_REF_NAME, CI_COMMIT_SHA, CI_COMMIT_SHORT_SHA, CI_COMMIT_TAG, CI_ENVIRONMENT_URL, CI_PAGES_URL,

Cloudflare pages

https://developers.cloudflare.com/pages/configuration/build-configuration/#environment-variables

CF_PAGES, CF_PAGES_COMMIT_SHA, CF_PAGES_BRANCH, CF_PAGES_URL

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the provider documentation linked in the issue for Vercel, Netlify, GitHub Actions, GitLab CI, and Cloudflare Pages. Compare their listed variables and determine the standard exports and provider-specific mappings needed; the work is done when the supported build environments can be scanned consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
ci-cd, devops, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.