-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We��ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Context access might be invalid" warning thrown for repository variables and secrets #222
Comments
Any update on this? |
I still see this as well; the extension version is v0.25.8 |
Seeing the same here constantly with |
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 |
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. |
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
Agreed, there should at least be a |
I get this warning for any environment variable exported in a previous step via v0.26.1 |
This worked for me. |
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 |
I had this error on |
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. |
Open the "github actions" extension side-panel and click "Sign in with Github". Authenticating this extension with Github worked for me.
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. |
Would be great if this could work without requiring github login. I would be completely fine with it assuming the required secrets exist when it doesn't know otherwise. |
@davecaplinger I am having a related issue with steps.action-id.outputs.* where I get "Context access might be invalid" if the * is being dynamically set by the github action (i.e action-id) based on user input. |
If you're still experiencing this issue, try using a An example of how it'd look: ${{ fromJSON(toJSON(secrets)).GITHUB_TOKEN }} This method's not the best of solutions, though it works if your local repository is unable to fetch / verify whether the specified environment variable or secret is really present. I still wouldn't rely on this, rather go for this method of trying to resolve it, as it worked for my latest repository. |
If you're facing the "Context access might be invalid" warning for repository variables and secrets. The reason is our YAML file does not have access to production environment variables when we're adding it. The warning is simple and here is what worked for me.
This should make the warning disappear. |
@maksims-terjohins - thanks, this solved the problem for me too. |
This comment was marked as resolved.
This comment was marked as resolved.
Hello everyone, After signin in the Github Actions extensions, I alos had to tick the "Use-enterprise" option in the Github Action extension settings. |
For me, it seems to be working out of the box now, without having to apply any of the proposed fixes from here |
You need to understand how this works. it fetches variables name from your GitHub account if you have created a variable there it will not give any warning. - Context access might be invalid: PHPSESSID
- Contains the names and values of secrets that are available to a workflow run. For more information Giving a Warning due to If the warning persists even after adding the variable in GitHub, consider reloading VS Code. |
Are you using MacOS? I had to restart VS Code with ⌘ + Q, and it went away after checking I did have the secrets correctly set in my repository settings. |
@franccesco No, I'm using windows. |
@promid After adding the env, can you restart the VS code. (Developer:Reload Window) |
Thanks for the reply, @SyedSibtainRazvi. I forgot to say that the envs are set by |
Is there any way to disable this warning when using a dynamic environment? |
Relogging into Actions and reloading window fixed the warning for me too! |
Joining the club asking about this - I've got dynamic environment variables and VS Code extension won't shut up about me referencing them |
I can also confirm this happens when you specify the jobs context environment property dynamically. It's not able to properly track that a variable exists. This is specific to "variables" my "secrets" seem to be tracked correctly. |
We do have all variables "in our GitHub account", still getting VS Code warnings. |
This is my experience: After opened .yml file for the first time, VS Code Askme to install the Github Action Extension, i get access to my secrets and variables in the lateral panel but in config i get the same warn message, but i restarted the VS Code Programm and the warn message dissapeared |
This worked for me after carefully adding GitHub Secrets, pushing/pulling my repo, and then pressing Ctrl + Shift + P and selecting "Developer: Reload Window. |
I want to use the language server for GHA without having the sidebar enabled but apparently that is required in order to access the secrets. I would rather have an option to disable messages like this as they are distracting and incorrect. They should appear only when the extension can access secrets and fails to find them, not when it does not have access to them. |
If you installed the GitHub Actions extension, all you have to do is perform a Developer reload in VS code 'Developer: Reload Window' and the error should go away. |
Restarting the VSCode Window doesn't seem to be working here. |
In a devcontainer, the only way for me was to disable the extension, click reload and then enable it again. |
This did it for me. Thank you @jivea! |
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
![image](https://cdn.statically.io/img/private-user-images.githubusercontent.com/3399494/247365821-d609569c-2ec7-41cd-a3f8-667980b6c81f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE3NjkyNTksIm5iZiI6MTcyMTc2ODk1OSwicGF0aCI6Ii8zMzk5NDk0LzI0NzM2NTgyMS1kNjA5NTY5Yy0yZWM3LTQxY2QtYTNmOC02Njc5ODBiNmM4MWYucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDcyMyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA3MjNUMjEwOTE5WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZjEyOTM0MzA1NzdiYTM2MTg4MWZhMGE5NzJjMWFjMzg4ZDM3ZTM1ZDVkZWU4NTI4OWMxM2VjYjQ3NmViNDc2NCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.KBrqRQnztUdk0aYx7yeBBg52VLT9hyyEVwiVpQ5DP0I)
![image](https://cdn.statically.io/img/private-user-images.githubusercontent.com/3399494/247366270-7ef29778-8c73-45f9-a050-0f9e258907b0.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE3NjkyNTksIm5iZiI6MTcyMTc2ODk1OSwicGF0aCI6Ii8zMzk5NDk0LzI0NzM2NjI3MC03ZWYyOTc3OC04YzczLTQ1ZjktYTA1MC0wZjllMjU4OTA3YjAucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDcyMyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA3MjNUMjEwOTE5WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MmJhZGEzMWFkOWNjMTM4NzFhZDBmMjY3ZTE2MWIyNzM3YzcyZTNlY2Y5M2FlMzAxNjBjMTM5OTAxZGFiOWZjMyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.ERYeMF5P5XwStRJtj9XOdolsCFrmjgNdkpaKQwSqfIc)
Extension Version
v0.25.8
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: