Open afefer opened 1 year ago
Also seeing this issue still with the latest release.
Previous issues #47 #61 and #67 stated the issue would be fixed with the next release, but issue continues to persist into release v0.25.8 and the change log seems to make no mention of a fix being deployed.
Any update on this?
I still see this as well; the extension version is v0.25.8
Seeing the same here constantly with v0.25.8
Just wanted to confirm that the issue continues to persist in 0.25.8 (and it's feeling really annoying)
also seeing this constantly in v0.25.8
with env
variables, but not secrets
Same here. A bit annoying indeed 👍
Still persists kind of embarrassing for GH
ah, i see this is an actual issue. i was going mad with this. Let´s hope it´s fixed soon.
Yep, its a bug. Moved to triage. No ETA on a fix, if someone makes a PR to fix, I'm happy to review it.
I uninstalled, reinstalled and restarted VSCode and then the warnings went away. v0.25.8
I was receiving this error after installing the extension. Simply running the "Developer: Reload Window" command fixed it for me without needing to reinstall. So far it hasn't seemed to return yet, at least for repo secrets.
I was receiving this error after installing the extension. Simply running the "Developer: Reload Window" command fixed it for me without needing to reinstall. So far it hasn't seemed to return yet, at least for repo secrets.
I tried this but it came back :(
Okay, at least in my instance, the issue seems to be because I have a setup like this:
organization/repo - Main repository. Secrets/vars are done on this.
myuser/repo - Fork which I do my work on before creating a merge to push to upstream/main. Therefore in actions, its thinks the vars/secrets don't exist because they existing the main repo not my fork. There should at least be a way of ignoring this specific error if this is the case.
👋 Reporting in, still happening on v0.26.1
.
There should at least be a way of ignoring this specific error if this is the case.
Agreed, there should at least be a # github-actions-extension ignore
comment one can use.
I get this warning for any environment variable exported in a previous step via echo "foo=bar" >>$GITHUB_ENV
v0.26.1
I uninstalled, reinstalled and restarted VSCode and then the warnings went away.
v0.25.8
This worked for me.
This seems to only happen when environment
property is dynamic.
I get this error for all of my secrets, am I missing something?
Expected behavior Secrets/vars should not throw a "Context access might be invalid" warning.
I actually like this warning. Because our YAML file has no access to production environment variables when we're editing it, it's a nice reminder to double-check our variable names.
Expected behavior Secrets/vars should not throw a "Context access might be invalid" warning.
I actually like this warning. Because our YAML file has no access to production environment variables when we're editing it, it's a nice reminder to double-check our variable names.
That's one way of looking at it. I would say a more realistic view is that it will condition you to ignore the warnings which causes the opposite effect of what you described.
I'm seeing this same behavior when pulling an output from a previous step through needs
"Context access might be invalid". Is this being triggered by the value not being available to read because the previous step has not run? Just wondering as you'd think it could see the output it'd be pulling the value from is in the previous needed step.
I had this error on secrets
. Turns out I wasn't properly signed in on github inside Vscode. Signing in and reloading fixed the issue.
I had this error on
secrets
. Turns out I wasn't properly signed in on github inside Vscode. Signing in and reloading fixed the issue.
How does one "sign in to GitHub inside VS Code"?
And I'd argue this is a bug regardless; if you're not signed in, then it should just assume all variables are fine, not spam you with spurious warnings.
However, this will cause VSCode to color this folder yellow, override source control's color. I can't tell if any project is committed or not as all my project folders are alway marked yellow. I might forget to commit changes for that reason.
How does one "sign in to GitHub inside VS Code"?
Open the "github actions" extension side-panel and click "Sign in with Github".
Authenticating this extension with Github worked for me.
And I'd argue this is a bug regardless; if you're not signed in, then it should just assume all variables are fine, not spam you with spurious warnings.
I agree this is still a bug, but Instead of assuming all variables are correct (which could easily be mistaken for being a valid secret) it should indicate that secrets (and potentially other checks) cannot be verified until authenticated. This extension requires authentication for a lot of features.
Saw this error after installing and signing in. Uninstalled it and reinstalled it, and it worked fine after
I signed in to github after installing the extension and saw the secrets errors. I completely quit VS Code and re-opened it again and the secrets were no longer throwing any warnings. :)
I signed in to github after installing the extension and saw the secrets errors. I completely quit VS Code and re-opened it again and the secrets were no longer throwing any warnings. :)
Yeah, this happened to me too. I think I just clicked the "refresh current branch" button in the sidebar and the errors went away.
Same here. Restarting VS Code after install and login fixed the issue for me!
V0.26.2 - as long as you are logged in and have given access to the extension, make sure you execute Developer: Reload Window
(or restart VSCode). I also had this issue until performing both these steps. Hope that helps someone.
Didn't saw it mentioned, so... dumb workaround if anyone needs:
${{ fromJSON(toJSON(secrets)).MY_LITTLE_SECRET }}
Easy to restore proper syntax when/if fix comes.
v0.26.2 it does not work for me using Developer: Reload Window
(or restart VSCode).
Context access might be invalid: PERSONAL_TOKEN
Here are my steps to resolve the warningContext access might be invalid: TOKEN
:
Here are my steps to resolve the warning
Context access might be invalid: TOKEN
:
- Install the GitHub Actions extension in VS Code.
- Open the GitHub Actions tab and ensure that you are logged in and have fetched the action info for your Git repository.
- In the SETTINGS section, verify the presence of the variables you have set under "Environments" and "Secrets".
- If the warning persists, try running "Refresh current branch" from the Command Palette. Alternatively, you can restart VS Code.
Yeah, this worked for me, thanks for sharing.
I'm using Github Actions v0.26.2.
This still happens with all dynamically generated environment variables and is pretty annoying
I'm seeing this on ${{ env.STORE_PATH }}
Hey guys, i think some of you are forgetting to set the environment before setting environment variables...
With the Github Actions VSCode Extension (i really recommend to use this if you intend to keep using GitHub Actions), in the "GitHub Actions" tab in left sidebar menu, (ensure that you're already logged in with your GitHub account), you can see which environment you env-variable is:
In my case, TEST(Environment) > TESTEE (Variable)
With that in mind, you have to set you environment in your job before calling the enviroments variables, just like this:
run-program:
runs-on: ubuntu-latest
needs: build
environment: TEST # set environment
env: # and then... call your variables
TESTEE: ${{ vars.TESTEE }}
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Run main file
run: python app/main.py
I hope this can help you, have a nice day! 😄
Thanks @iuritorres for writing this up! I was able to resolve this in my repo using some of the information here. Adding environment
kept giving me errors, but by adding
env:
MY_VAR:
to the job
in my workflow file, I was able to get the plugin to stop flagging uses of env.MY_VAR
. Not sure if this is a hack, but it worked for me
edit: clarity
Here are my steps to resolve the warning
Context access might be invalid: TOKEN
:
- Install the GitHub Actions extension in VS Code.
- Open the GitHub Actions tab and ensure that you are logged in and have fetched the action info for your Git repository.
- In the SETTINGS section, verify the presence of the variables you have set under "Environments" and "Secrets".
- If the warning persists, try running "Refresh current branch" from the Command Palette. Alternatively, you can restart VS Code.
This comment above in combination with running "Developer: Reload window" worked for me.
In case someone else has the same problem, I used the remote name origin
for my personal fork and upstream
for the org fork (which has the secrets), so I had to update this setting:
Unfortunately, even if the GitHub Actions extension is successfully logged in and Environments/Secrets/Variables are visible in the sidebar, I'm still having the issue. The lint warnings still appear if the variable is defined in a previous step via >> $GITHUB_ENV
, such as in this example:
(I'm using version 0.26.2
if it matters)
Unfortunately, even if the GitHub Actions extension is successfully logged in and Environments/Secrets/Variables are visible in the sidebar, I'm still having the issue. The lint warnings still appear if the variable is defined in a previous step via
>> $GITHUB_ENV
, such as in this example: (I'm using version0.26.2
if it matters)
I have exactly the same issue as yours. Quite annoying. (version 0.26.2)
Is there a way to disable this warning in VSCode?
Uninstalling / Installing again seems to have worked for me (so far)
How should this work for callable workflows? The plugin obviously can't know if necessary secrets/vars are in place in the repository which invokes my callable workflow.
There should definitely be a enable/disable for this feature.
Thanks @iuritorres for writing this up! I was able to resolve this in my repo using some of the information here. Adding
environment
kept giving me errors, but by addingenv: MY_VAR:
to the
job
in my workflow file, I was able to get the plugin to stop flagging uses ofenv.MY_VAR
. Not sure if this is a hack, but it worked for meedit: clarity
This worked for me.
For me I had to log into Github in the GithubActions plugin, and Developer: Reload Window and then it worked.
As a side but important note, it does seem that the GItHub Actions
extension does not handle the secret contexts when working in a multi-project workspace. That is the context for which I find this error occurring. When I open a single Git
repository in a new window there are no errors.
And the GitHub Actions
panel looks like:
The GitHub
extension meanwhile handles this perfectly fine in multi-project workspaces.
If I ever get some free time, I'll try to look at the code or compare it to another extension to see what I can find, but I am definitely out of my depth.
Here are my steps to resolve the warning
Context access might be invalid: TOKEN
:
- Install the GitHub Actions extension in VS Code.
- Open the GitHub Actions tab and ensure that you are logged in and have fetched the action info for your Git repository.
- In the SETTINGS section, verify the presence of the variables you have set under "Environments" and "Secrets".
- If the warning persists, try running "Refresh current branch" from the Command Palette. Alternatively, you can restart VS Code.
This didn't work for me. My difference is I'm using environment secrets/variables, not repository. This also only happens for variables for me and not secrets.
This seems to only happen when
environment
property is dynamic.
Same issue. My environment is dynamic. v0.26.2
Describe the bug After upgrading to 0.25.8, a "Context access might be invalid" warning is thrown for all repository variables and secrets in the workflow file. Refreshing the secrets/vars in the extension has no effect.
Expected behavior Secrets/vars should not throw a "Context access might be invalid" warning.
Screenshots
Extension Version
v0.25.8
Additional context Add any other context about the problem here.