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: ACT #67

Closed
Tracked by #275
Zageron opened this issue Mar 30, 2023 · 36 comments
Closed
Tracked by #275

Context access might be invalid: ACT #67

Zageron opened this issue Mar 30, 2023 · 36 comments
Labels
bug Something isn't working

Comments

@Zageron
Copy link

Zageron commented Mar 30, 2023

Describe the bug
I believe this is a quality of life issue rather than a bug.
It would be nice for there to be a documented way, perhaps a quick actions, to ignore certain warnings.

The issue is that if: ${{ !env.ACT }} warns that ACT might be invalid. Which it will be when not running in an environment that defines ACT. Not sure if warning that an environment variable might not be declared is useful.

To Reproduce
Steps to reproduce the behavior:

  1. Create any workflow block that contains an if statement referencing an environment variable that isn't declared in an env block.

Expected behavior
Either no warning, or a way to set particular environment variables to be ignored in this context.

Screenshots
image

Extension Version
v0.25.3

@Zageron Zageron added the bug Something isn't working label Mar 30, 2023
@Zageron
Copy link
Author

Zageron commented Mar 30, 2023

After further searching, appears to be a duplicate of both #61 and #47.

@janaka
Copy link

janaka commented May 1, 2023

I'm also experiencing this issue. It makes no sense to me that this warning is being issued. Either the extension can validate all context or if it cannot do some then don't do any. Given that variables and secrets are viewable on the left I would imagine if can validate.

@leonardorb
Copy link

Also having this issue. Is there a way to validate the context here?

@tylerclark
Copy link

Fixed in next release: #61 (comment)

@felipesu19
Copy link
Contributor

Closing for fix in next release 💯

@floehopper
Copy link

@tylerclark:

Fixed in next release: #61 (comment)

I can't see a commit which fixes this - even an unreleased one. Where did you see it was fixed?

@wtachau
Copy link

wtachau commented Jul 6, 2023

Still seeing this issue FYI

@elviskahoro
Copy link

I'm also still seeing this!

@80rian
Copy link

80rian commented Jul 10, 2023

definitely not fixed in the latest version.

@avh03
Copy link

avh03 commented Jul 13, 2023

same here, the issue still persists in 0.25.8

@marcospgp
Copy link

I would love to have no yellow underline on my workflow files :)

@brunokloss
Copy link

i'm almost disabling the extension... problem showing in v.0.25.8 here too :(

@matlads
Copy link

matlads commented Jul 21, 2023

I am disabling the extension for now. i'll check back in about 5 months 😞

@Zageron
Copy link
Author

Zageron commented Jul 21, 2023

@felipesu19 @cschleiden
Ya'll are posting in a closed issue, no one is going to see this. Pinging for visibility.

@cschleiden
Copy link
Member

Have you tried declaring ACT as an environment variable? Something like

name: Demo workflow

env:
  ACT:

on:
  push:
  workflow_dispatch:
    inputs:
      name:
        type: string

jobs:
  say-hello:
    runs-on: ubuntu-latest

    steps:
      - run: echo "Hello ${{ env.ACT }}"

@PrimeTimeTran
Copy link

PrimeTimeTran commented Jul 29, 2023

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

@epreston
Copy link

epreston commented Aug 6, 2023

Have you tried declaring ACT as an environment variable? Something like

That didn't seem to work as expected. The "secrets" object is a simple dictionary of name / value pairs. Is it possible to add a config section for what we expect the object to look like ? Same with the env ? This way we don't need to erase the current value when its running to use an env or secret without warnings.

@cschleiden
Copy link
Member

@epreston the secrets context is populated using the repository and org information from github.com. Does that not work for you? Or are you using GHES?

@epreston
Copy link

epreston commented Aug 7, 2023

No. The issue is being able to add custom values.

It's good that it already has the values from the documentation.

@epreston
Copy link

epreston commented Aug 7, 2023

So unless we only use the prepopulated attributes on secrets or env, our scripts are filled with error warnings. The purpose of these objects is to extend them.

A way to add known values to the shape of these objects, like adding words to a spell checker, would resolve this issue.

@cschleiden
Copy link
Member

It uses the actual secrets configured for the repository, not just from the documentation.

@epreston
Copy link

epreston commented Aug 7, 2023

Possible issue with that feature. What's the best way for me to help ? How can I generate a reproduction ?

@epreston
Copy link

epreston commented Aug 7, 2023

One reproduction would be following the steps from https://app.codecov.io/

They have you create a:

secrets.CODECOV_TOKEN

Then when you go to edit that .yml file, it will always show this error where CODECOV_TOKEN is used.

issue

Other plugins, like the spell checker, allow us to add words to the workspace settings to resolve similar issues.

@epreston
Copy link

epreston commented Aug 7, 2023

I can confirm this works and is populated in github and that the plugin has no knowledge of the secrets configured for the repository.

@Zageron
Copy link
Author

Zageron commented Aug 7, 2023

It would be a very impressive feature to have GH aware context. Just the keys mind you, values would not be good.

@cschleiden
Copy link
Member

@Zageron that is supported by the extension:

CleanShot 2023-08-08 at 10 15 54@2x

@epreston
Copy link

epreston commented Aug 8, 2023

@cschleiden what is required to allow the plugin to enumerate those secrets ?

@cschleiden
Copy link
Member

cschleiden commented Aug 8, 2023

Nothing, just login and open the checked out repository in vscode.

Edit: you need permissions to the repo, of course.

@epreston
Copy link

epreston commented Aug 8, 2023

Since those Azure ones are well known and might be populated by the plugin staticly, could you create a secret named CODECOV_TOKEN and see if it appears in the list and allows it without warning ?

Thank you kindly.

@petrgazarov
Copy link

@epreston I had to uninstall/reinstall the extension for the secret names autocomplete to start working. Also, fixed the yellow underlines.

@AmrAhmedA
Copy link

Any possible fix?

@jacobmassengill
Copy link

@epreston I had to uninstall/reinstall the extension for the secret names autocomplete to start working. Also, fixed the yellow underlines.

This resolved the issue for me, can't believe I didn't try this first myself 😑

@ahmadnassri
Copy link

uninstall/reinstall only works temporarily, the issue still occurs if you're referencing organization secrets

@ahmadnassri
Copy link

I think this issue need to be re-opened

@MarioLiebisch
Copy link

Just installed the extension (0.26.2) and immediately stumbled over this, which is not helpful.

@squiddickod squiddickod mentioned this issue Oct 30, 2023
Closed
@mark-pictor-csec
Copy link

If I restart vscode, these warnings go away until I open a file under .github. But the instant I open one, all the warnings come back.

In my case the underlying cause seems to be a lack of alias support (#239).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

No branches or pull requests