PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, August 19, 2022

[FIXED] How to read environment variables in env section of github action workflow

 August 19, 2022     environment-variables, github-actions     No comments   

Issue

I'm trying to set a env variable based on another env variable in a github workflow. I've tried a couple of syntax options but none seem to work

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]
  workflow_dispatch:

env:
  BASE_VERSION: 1.0.0
  FULL_VERSION: ${BASE_VERSION}-${{ github.run_number }}-${{ github.ref_name }}
jobs:
  1. The example for BASE_VERSION above just keeps ${BASE_VERSION} as a string
  2. $BASE_VERSION also just keeps $BASE_VERSION as a string
  3. ${{ env.BASE_VERSION }}-blabla just fails with syntax error

Is this doable?

The output I want is "1.0.0-1-master" for example


Solution

Is this doable?

It does not seem like a supported behaviour at the moment.

The docs on env mentions that

variables in the env map cannot be defined in terms of other variables in the map.



Answered By - lyzlisa
Answer Checked By - Terry (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing