mirror of
https://github.com/nektos/act.git
synced 2026-04-26 01:15:51 +03:00
[GH-ISSUE #1558] Add support for Github Actions Variables #784
Labels
No labels
area/action
area/cli
area/docs
area/image
area/runner
area/workflow
backlog
confirmed/not-planned
kind/bug
kind/discussion
kind/external
kind/feature-request
kind/question
meta/duplicate
meta/invalid
meta/need-more-info
meta/resolved
meta/wontfix
meta/workaround
needs-work
pull-request
review/not-planned
size/M
size/XL
size/XXL
stale
stale-exempt
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/act#784
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @lktslionel on GitHub (Jan 13, 2023).
Original GitHub issue: https://github.com/nektos/act/issues/1558
Hello,
GitHub releases GitHub Actions Variables. It will be great to be able the use
vars.VAR_NAMEwith our workflow document.See: https://docs.github.com/en/rest/actions/variables?apiVersion=2022-11-28
Thanks
Regards
@lktslionel commented on GitHub (Jan 13, 2023):
I'm open to contributing but I need guidance on how to get started and which part of the code is handling that part.
I think it will be similar to how
env.EEEEandsecrets.XXXare being handled but apart from that, I am completely blind 😄 .@KnisterPeter commented on GitHub (Jan 13, 2023):
Hi @lktslionel,
first of all I think there need to be an idea how to add this to act. Currently there is no access to GitHub APIs and I do think it shouldn't be there. Secrets and Env-Vars are set via the command line and I could think of that for vars as well.
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)
And then work up all the way to the command line arguments.
@grantcarthew commented on GitHub (Apr 26, 2023):
I tried to pass "vars" in the environment variable command line option:
This didn't work.
This is a show-stopper for me. Well, I can't have an action that works with GitHub and
act.Sorry, I'm not a Go dev yet and am time-limited (aren't we all?).
@mcascone commented on GitHub (Apr 28, 2023):
+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
.envand.secrets: support.varswith the same mechanisms: default to.vars, override with--vars-file.Thanks! :)
@haktan-suren commented on GitHub (May 6, 2023):
+1
@mwierzchowski commented on GitHub (May 6, 2023):
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?
@kferrone commented on GitHub (May 11, 2023):
This needs to be very high priority. This is not ready for use without it.
@adamhalesworth commented on GitHub (May 12, 2023):
It would be great to be able to supply
varstoact, e.g. to provide aRUN_OFFSETto maintain build continuity (which is my use case). Usingsecretsis workable, but it makes the process cumbersome since the value is hidden in the UI.As @mwierzchowski suggested, YAML or TOML is very readable and could simplify context configuration, but even having this implemented in the same format as
.envwould be fantastic.@basos9 commented on GitHub (May 12, 2023):
This is needed for sure
@mcascone commented on GitHub (May 12, 2023):
@KnisterPeter, I opened https://github.com/nektos/act/pull/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.
@KnisterPeter commented on GitHub (May 24, 2023):
@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.
@wildsheepz commented on GitHub (May 31, 2023):
@KnisterPeter, I made the changes needed to add a
--var-file, tested using a workflow to verify that secrets is still masked and${{ vars.Example }}is working.@askb commented on GitHub (May 31, 2023):
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.
@wildsheepz commented on GitHub (May 31, 2023):
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.
@grantcarthew commented on GitHub (Jun 1, 2023):
Hi Kuan @wildsheepz,
Just wanted to say thanks mate. It looks like you're the only one stepping up for this and there will be many people interested. Your work is appreciated.
@wildsheepz commented on GitHub (Jun 10, 2023):
#1833 has been merged into master.
@askb commented on GitHub (Jun 12, 2023):
Thanks for fixing this Kuan @wildsheepz
@duzenko commented on GitHub (Jun 20, 2023):
@wildsheepz commented on GitHub (Jun 20, 2023):
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.
@duzenko commented on GitHub (Jun 20, 2023):
Sorry, whose job is it to "bump the version"?
@haktan-suren commented on GitHub (Jun 25, 2023):
For those who don't know how to build from master
@askb commented on GitHub (Jul 4, 2023):
Is there an equivalent to build / install the binary using the HEAD on other platforms?
ex on linux we use
curl -s https://raw.githubusercontent.com/nektos/act/master/install.sh | bash@dragonprevost commented on GitHub (Aug 10, 2023):
Thank you @wildsheepz 🙏
@L-Sypniewski commented on GitHub (Aug 17, 2024):
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:
Replacing
${{ vars.SUPABASE_DEV_PROJECT_ID }}with the actual value fixes the problem.According to the docs from a linked PR it should work:
To run act with repository variables that are acessible inside the workflow via ${{ vars.VARIABLE }},A piece of code from my Github actions:
@y-takebe commented on GitHub (Jan 11, 2025):
@L-Sypniewski
I suggest changing
-varto--var. It works in my local environment.https://nektosact.com/usage/index.html?highlight=var#vars