github / github/vscode-github-actions

Support Custom GitHub Action use of GITHUB_ENV

Open
#47 14 comments 42 reactions 0 assignees View on GitHub
enhancement
Dominant language
TypeScript
Stars
660
Forks
213
PR merge metrics
No merged PRs in 30d

Description

**Is your feature request related to a problem? Please describe.**
Some GitHub Actions use `GITHUB_ENV` to set up custom environment variables.
When used inside a workflow, use `${{ env.CUSTOM_VARIABLE }}` is flagged as `Context access might be invalid`.

**Describe the solution you'd like**
Enable the custom GitHub Actions developer to define statically or dynamically the generated environment variables (like for the action output) and use it in this plugin to remove false-positive.

**Additional context**

This workflow is flagged with the issue

```yaml
name: "Context access might be invalid"
on: push
jobs:
context-access-might-be-invalid:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup environment variables
uses: rlespinasse/github-slug-action@v4

- name: Print custom environment variables
run: echo ${{ env.GITHUB_REF_SLUG }}
```
And produces
Capture d’écran 2023-03-28 à 20 15 36

Contributor guide

Open the contributing guide

Research direction

No source file, test, or entry point is named in the issue. Start by tracing how the extension validates env context and how custom action outputs are represented; compare that behavior with the GITHUB_ENV workflow example. Done means custom environment variables from actions can be declared or resolved without the false-positive diagnostic.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.