Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

224
Views
Can't pass environment variable from GitHub Actions to nodejs script

To be short I have an Angular app where I have env config. I decided to write a build number directly into the field of that config file.

So I made a script that is being run by Node after checkout and before the actual build step and writes a build number into that file. This is a fragment of my GitHub Actions workflow yml for it:

        run: |
          npm install
          node setbuildnumber.js build=${{ env.GITHUB_ACTION }}
          npm run build-demo

The script works when I test it separately. And it runs in Actions as I see. But after I build and deploy my Angular app, I see my build number is undefined.

Before writing a question, I looked through Stack Overflow topics and only found a variant where it was recommended to write a variable value to file and then read it with Node script. But that solution looks unclean.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I'm sure now that arguments aren't being passed into the node script. So I've written the variable name into the temporary file, read it, written it into the angular environment configs recursively and deleted the file after all. This is the only thing that worked for me practically.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!