Using secret variables in another secret variable

I have two script variables TARGET_STAGE and POST_DEPLOY_HOOK

I want to the value of TARGET_STAGE in POST_DEPLOY_HOOK. How can do this in secrets

Will something like this work, ${{ secrets.TARGET_STAGE }}/../deploy_shot.sh

@tbhaxor,

When we define a secret, we seem can’t pass the value of another secret as the part of this secret’s value.
I tested like this:

  1. Define 4 secrets.

    Name value
    MY_SEC_01 111
    MY_SEC_02 ${{ secrets.My_Sec_01 }}222
    MY_SEC_03 111
    MY_SEC_04 111222
  2. Set a step in the workflow.

    jobs:
      job1:
        runs-on: ubuntu-latest
        steps:
          - name: Create files
            run: |
              if [[ ${{ secrets.MY_SEC_01 }} == ${{ secrets.MY_SEC_03 }} ]]; then
                echo "MY_SEC_01 = MY_SEC_03 ✅"
              else
                echo "MY_SEC_01 != MY_SEC_03 ❌"
              fi
           
              if [[ ${{ secrets.MY_SEC_02 }} == ${{ secrets.MY_SEC_04 }} ]]; then
                echo "MY_SEC_02 = MY_SEC_04 ✅"
              else
                echo "MY_SEC_02 != MY_SEC_04 ❌"
              fi
    
  3. The result: https://github.com/TestWorkflowsRML/GHA-Syntax/runs/1319598393?check_suite_focus=true#step:2:97

@brightran How about this one?

if [[ '${{ format('{0}{1}', secrets.MY_SEC_01, '222') }}' == '${{ secrets.MY_SEC_04 }}' ]]