Skip to content

CICD-026 · Use a repository configuration variable ​

Encyclopedia · Variables, outputs and data flow · All snippets

Previous · CICD-025 · Next · CICD-027

1. Where it fits ​

  • Placement .github/workflows/ci.yml, under a job's steps.
  • Prerequisites GitHub Actions job or equivalent Gitea version with environment file support.
  • Platforms github-actions, gitea-actions.
  • Parameters REGION.

2. Copy the snippet ​

yaml
env:
  REGION: ${{ vars.DEPLOY_REGION }}
run: test -n "$REGION"

3. How it works ​

The expression reads a repository-scoped configuration value, then maps it to REGION in the step process. test -n makes a missing configuration value visible.

4. Verify the result ​

Configure a non-secret repository variable with exact spelling. Empty configuration should fail visibly.

Validation syntax-validated (YAML parse). Status definitions.