Content-Length: 760950 | pFad | https://github.com/github/vscode-github-actions/issues/222

9B "Context access might be invalid" warning thrown for repository variables and secrets · Issue #222 · github/vscode-github-actions · GitHub
Skip to content
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

Open
Tracked by #275
afefer opened this issue Jun 21, 2023 · 102 comments
Open
Tracked by #275
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@afefer
Copy link

afefer commented Jun 21, 2023

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
image

Extension Version
v0.25.8

Additional context
Add any other context about the problem here.

@aschen-builder
Copy link

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.

@moshest
Copy link

moshest commented Jul 12, 2023

Any update on this?

@acharyasaagar
Copy link

I still see this as well; the extension version is v0.25.8

@evertonspader-tomtom
Copy link

Seeing the same here constantly with v0.25.8

@avh03
Copy link

avh03 commented Jul 13, 2023

Just wanted to confirm that the issue continues to persist in 0.25.8 (and it's feeling really annoying)

@anthony9187
Copy link

also seeing this constantly in v0.25.8 with env variables, but not secrets

@mickael-h
Copy link

Same here. A bit annoying indeed 👍

@Bohemus307
Copy link

Still persists kind of embarrassing for GH

@enriquepevida
Copy link

ah, i see this is an actual issue. i was going mad with this. Let´s hope it´s fixed soon.

@felipesu19 felipesu19 moved this from Backlog 🗒 to Triaged 📝 in GitHub Actions VS Code Extension Jul 26, 2023
@felipesu19
Copy link
Collaborator

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.

@felipesu19 felipesu19 added the help wanted Extra attention is needed label Jul 26, 2023
@PrimeTimeTran
Copy link

PrimeTimeTran commented Jul 29, 2023

I uninstalled, reinstalled and restarted VSCode and then the warnings went away. v0.25.8

@techguydave
Copy link

techguydave commented Aug 6, 2023

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.

@japo32
Copy link

japo32 commented Aug 7, 2023

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 :(

@adambirds
Copy link

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.

@larouxn
Copy link

larouxn commented Aug 16, 2023

👋 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.

@gregalia
Copy link

gregalia commented Aug 17, 2023

I get this warning for any environment variable exported in a previous step via echo "foo=bar" >>$GITHUB_ENV

v0.26.1

@JoelYoung01
Copy link

I uninstalled, reinstalled and restarted VSCode and then the warnings went away. v0.25.8

This worked for me.

Cyberboss added a commit to tgstation/tgstation-server that referenced this issue Aug 25, 2023
@BertelBB
Copy link

This seems to only happen when environment property is dynamic.

image

@marano
Copy link

marano commented Sep 1, 2023

I get this error for all of my secrets, am I missing something?

Screenshot 2023-09-01 at 07 48 23

@budokans
Copy link

budokans commented Sep 5, 2023

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.

@BertelBB
Copy link

BertelBB commented Sep 5, 2023

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.

@drewagentsync
Copy link

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.

@qortex
Copy link

qortex commented Sep 7, 2023

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.

@sunski411
Copy link

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.

@scarecrow-11
Copy link

Restarting the VSCode Window doesn't seem to be working here.

@8192K
Copy link

8192K commented Jun 25, 2024

In a devcontainer, the only way for me was to disable the extension, click reload and then enable it again.

@grantjoy
Copy link

grantjoy commented Jun 26, 2024

After signin in the Github Actions extensions, I also had to tick the "Use-enterprise" option in the Github Action extension settings. Repo belongs to an organization account. Hope this will help someone.

This did it for me. Thank you @jivea!

@brimmann
Copy link

Restarting worked for me.

@OkkarMin
Copy link

OkkarMin commented Aug 7, 2024

Hello everyone,

After signin in the Github Actions extensions, I alos had to tick the "Use-enterprise" option in the Github Action extension settings. Repo belongs to an organization account. Hope this will help someone.

This worked for me!

@grantjoy
Copy link

grantjoy commented Aug 7, 2024

Use-enterprise worked for a while until it stopped working. Downgrading to 0.25.7 got it working again.

Something changed between 0.25.7 and 0.25.8 that broke the auth for the extension and that bug persists today through all version after 0.25.7.

The error I see when moving from 0.25.7 and 0.25.8 (after authing in 0.25.7) is: Error running command github-actions.explorer.current-branch.refresh: command 'github-actions.explorer.current-branch.refresh' not found. This is likely caused by the extension that contributes github-actions.explorer.current-branch.refresh.

@boonyarit-iamsaard
Copy link

Here is my workaround, I switched from SSH to HTTPS and the warning disappeared. I hope this helps.

@ssbarnea
Copy link

While I can fully understand why this feature was implemented there is a significant number of power-users of GHA which might use advances workflows, where the static analysis fails.

I have another job that is producing the entire matrix for for running the matrix tests jobs, and I am using its output. Here is how is used:

    outputs:
      matrix: ${{ steps.generate_matrix.outputs.matrix }} # noqa: unknown-context
      # triggers ^ "Context access might be invalid: matrix"

The only way to avoid is is to have some kind of magic noqa comments to silence it, like the comment that I added in the snippet.

Looking at https://github.com/github/vscode-github-actions/graphs/contributors I realise that this extension is not really under any kinda of active maintenance. In fact the last change that worth being mentioned in the release notes was in may 2023 :)

Still, I hope that @thyeggman might find some time to help here, even it would be with a comment that just suggests how this could be addressed (code reference, prefered way to deal with it in code).

@grantjoy
Copy link

grantjoy commented Aug 14, 2024

@boonyarit-iamsaard thanks for the suggestion but I run into the same problem using HTTPS as I do for SSH auth.

@ssbarnea I don't understand why they are still upgrading it at this point, as recently as 2 months ago. They broke it in 0.25.8 and just keep releasing broken versions.

@Zoltag
Copy link

Zoltag commented Sep 12, 2024

Environment: WSL2 Ubuntu
Github Actions version: v0.26.5

I am using a mixed environment - Github Enterprise for our codebase and Github for external resources. When I select Use-Enterprise, external resources are shown to be unavailable and when I deselect this option, internal resources are unavailable

image
image

In the first screenshot, it shows invalid token warnings - A simple developer reload window + sign back into Github is enough to resolve these, but the Sonar action from github.com cannot be found

In the second screenshot, the secrets seem to be detected correctly (despite being in the Enterprise repo), but the action located in the enterprise git cannot be found (even though I am authenticated to both enterprise and public githubs, action resolution appears to be linked to the Use-Enterprise toggle, while secrets resolution seems to always work - albeit with some bugs)

@SantiiRepair
Copy link

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.

Not working

@rohityadav-sas
Copy link

@jivea

After signin in the Github Actions extensions, I alos had to tick the "Use-enterprise" option in the Github Action extension settings. Repo belongs to an organization account. Hope this will help someone.

That just logs me out, without being able to log back in ("Sign in" button no longer works). I guess that's why you don't see the warnings - you're logged out. I suspect that's because now the Github-enterprise Uri is missing. (We do run a GitHub organization, but not GitHub enterprise).

Screenshot 2024-05-14 at 12 22 41 Screenshot 2024-05-14 at 12 23 35

This worked for me

@gekh
Copy link

gekh commented Sep 17, 2024

I have two actions for test and production branches. What helped me:

  • Git: Checkout to... test
  • Developer: Reload window
  • Git: Checkout to... produciton
  • Developer: Reload window

@tensor-works
Copy link

Still an issue almost 2 year later what is the github team doing

@Hecedu
Copy link

Hecedu commented Oct 17, 2024

This issue is also triggered by using a supported feature in which one passes an environment variable as the environment name for a reusable job eg:

jobs:
  reusable_job:
    name: Reusable job for ${{inputs.environment}}
    runs-on: ubuntu-latest
    environment:
      name: ${{inputs.environment}}

This causes all references to environment variables to display the warning message, even if they have been properly defined in their respective environments.

@iann838
Copy link

iann838 commented Oct 28, 2024

When are we getting a suppression setting, seeing this sight every single time while contributing to open source for the past several years has been to the point of irritation.
image

@SteviePreston
Copy link

I had to sign in via the side using the GitHub Actions extension and do a full reload.
If you are on an enterprise repo, Enable Github-actions: Use-enterprise

image

@krukonshedul
Copy link

This is completely unable to handle dynamic output parameters, such as the ones from aws-actions/amazon-ecr-login@v2.
I'd be grateful for an ability to completely turn this particular validation off. It degrades my experience significantly more than it does provide any value.

@mitsukuri
Copy link

Still an issue almost 2 year later what is the github team doing

Serving the board of directors who serve the investors who staked all their money on AI

@nabheet
Copy link

nabheet commented Jan 18, 2025

Not sure if this will help anyone, but I created an environment var while messing with environments and I was getting this same squiggly error about invalid context and whatnot.

Image

So I accidentally resolved it by adding environment: ENVIRONMENT_NAME field to the job. Squiggly gone!!!

Image

@matyashlavacek
Copy link

Would be great to either be able to inline suppress warning, or perhaps allow to set a default value for when the secret is not present, or disable warnings altogether. I use the extension only for intellisense, don't intend to ever log into GitHub in VSCode.

@nathan-weinberg
Copy link

This should really be something that can be disabled in the extension settings

@arxkdev
Copy link

arxkdev commented Jan 29, 2025

How on earth is this an issue almost 3 years later. This is still not fixed.

@dc0d
Copy link

dc0d commented Feb 7, 2025

The problem seem to still be there (VSCode, MacOS, everything latest update - for secrets at least).
Especially for secrets it would be better to not try to check them locally.

@Firgrep
Copy link

Firgrep commented Feb 18, 2025

Please prioritize fixing this or allowing for silencing warnings. It's quite annoying.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
Status: Triaged 📝
Development

No branches or pull requests









ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/github/vscode-github-actions/issues/222

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy