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

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.