-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Add support for Github Actions Variables #1558
Comments
I'm open to contributing but I need guidance on how to get started and which part of the code is handling that part. |
Hi @lktslionel, A starting point would be to add them to the expression parser (stating here: https://github.com/nektos/act/blob/master/pkg/exprparser/interpreter.go#L150) |
I tried to pass "vars" in the environment variable command line option: act --env 'vars.FOO=BAR' This didn't work. Sorry, I'm not a Go dev yet and am time-limited (aren't we all?). |
+1 agree, not supporting variables - as opposed to environment variables - is a big miss. I don't even have environment variables in my personal repo. 💯 agree with following the same patters as Thanks! :) |
+1 |
IMHO, all the contexts (like env, vars, secrets) should be handled the same way by act. No need for integration with the GitHub API - probably that would be completely undesired since may lead to unexpected sideeffects. As additional thing to consider, all types contexts could be defined in one file (with separate sections). This could simplify managing all the values at once and simplify setup (e.g. 1 entry in the .gitignore). In the scenario where all the contexts are defined in one file, we could consider format a little more human readable. YAML or TOML maybe? |
This needs to be very high priority. This is not ready for use without it. |
It would be great to be able to supply As @mwierzchowski suggested, YAML or TOML is very readable and could simplify context configuration, but even having this implemented in the same format as |
This is needed for sure |
I don't really know what i'm doing here, but I'm copying the pattern for Env vars to use with Vars - essentially, non-secret secrets. Based on nektos#1558 (comment)
@KnisterPeter, I opened #1802 to implement this, but i'm really working blind here. I just copied the pattern used for the Env var, and created a Vars flow. I'm happy to follow this through but i'll need to some guidance on where to go next. |
@mcascone You probably need to go through all act code here from the cli options parsing to all call sides of the expression parser. This is not the smallest change and up to now you only touched the surface (the parser). I would suggest to make yourself familiar with the whole codebase. |
@KnisterPeter, I made the changes needed to add a |
When is this fix going to be out! Having the same issue with out tests and workflow. It's going to be a pain to rewrite all the workflows to change the all the var to env.
|
Well, I have a full time job and writing the unit tests to satisfy the coverage requirements is going to take time. You could just compile it from my fork and use that if you need it urgently. |
Hi Kuan @wildsheepz, |
#1833 has been merged into master. |
Thanks for fixing this Kuan @wildsheepz |
|
It's merged into main, but the version has not bumped yet. If you need it now, you will need to compile master on your own. |
Sorry, whose job is it to "bump the version"? |
For those who don't know how to build from master
|
Is there an equivalent to build / install the binary using the HEAD on other platforms? |
Thank you @wildsheepz 🙏 |
I don't want to open an issue since I'm not sure if the problem is on my side, but the variables don't work for me (secrets are correctly substituted). I've tried both with .env file and passing a value as a commandline parameter: act -j deploy-chagnes-to-dev-db --secret-file ./.act/.secrets -var SUPABASE_DEV_PROJECT_ID=<ID_VALUE> Replacing According to the docs from a linked PR it should work: A piece of code from my Github actions: deploy-chagnes-to-dev-db:
defaults:
run:
working-directory: ./Frontend/
name: Lint Supabase and apply migrations to dev instance
runs-on: ubuntu-24.04
env:
SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_DEV_ACCESS_TOKEN }}
SUPABASE_DB_PASSWORD: ${{ secrets.SUPABASE_DEV_DB_PASSWORD }}
SUPABASE_PROJECT_ID: ${{ vars.SUPABASE_DEV_PROJECT_ID }}
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Supabase CLI
uses: supabase/setup-cli@v1
- name: Create fake .env file for Supabase CLI
run: |
echo 'GITHUB_CLIENT_ID="SOMEID"' > .env
echo 'GITHUB_SECRET="SOMESECRET"' >> .env
echo 'SENDGRID_API_KEY="SOMEKEY"' >> .env
echo 'OPENAI_API_KEY="SOMEKEY"' >> .env
# - name: Start supabase DB
# run: supabase db start
# - name: Lint Supabase
# run: supabase db lint
- name: Apply migrations to dev instance
run: |
supabase link --project-ref "$SUPABASE_PROJECT_ID"
supabase db reset --linked |
Hello,
GitHub releases GitHub Actions Variables. It will be great to be able the use
vars.VAR_NAME
with our workflow document.See: https://docs.github.com/en/rest/actions/variables?apiVersion=2022-11-28
Thanks
Regards
The text was updated successfully, but these errors were encountered: