In my CI/CD steps I use Github Actions (CI) and Octopus Deploy (CD).
Now, in my Github Actions (CI) step I am trying to pass custom variables to Octopus Deploy (CD) step. In Github Actions I use a create-release-action and then also use deploy-release-action to trigger the Octopus pipeline like so:
[ ...Octopus Authentication Step ...]
- name: Create Release
uses: OctopusDeploy/create-release-action@v3
with:
server: ${{ vars.MY_SERVER_URL }}
space: "Default"
project: "my-deploy-pipeline"
release_number: "v${{ github.run_number }}"
git_ref: "${{ github.ref }}"
git_commit: "${{ github.sha }}"
- name: Deploy Release
id: deploy_release
uses: OctopusDeploy/deploy-release-action@v3
with:
server: ${{ vars.MY_SERVER_URL }}
space: 'Default'
project: "my-deploy-pipeline"
release_number: "v${{ github.run_number }}"
environments: "Development"
variables: |
MyVar: <somevar>
BuildNumber: ${{ github.run_number }}
GitCommit: ${{ github.sha }}
Branch: ${{ github.ref_name }}
However, even though I see the pipeline deploying in Octopus, but, in my Octopus pipeline Shell-script step I cannot seem to be able fetch / subsititute the custom variables MyVar, BuildNumber, GitCommit, Branch, they all result in empty values.
I tried multiple variations for substitutions in the script like:
#!/bin/sh
echo "${MyVar}"
echo $MyVar
echo '#{Octopus.Action[deploy_release].Output.MyVar}'
echo "$(get_octopusvariable 'MyVar')"
in my verbose logs during Octopus deploy I get:
Performing variable substitution on '/octopus/Work/hExz1E4LvkqWVncxIQCdg/Script.sh'
Sun, Sep 14th 2025 14:32:11 -04:00
Verbose Parsing file '/octopus/Work/hExz1E4LvkqWVncxIQCdg/Script.sh' with Octostache returned the following error: `The following tokens were unable to be evaluated: '#{MyVar}', ... <and others here>`
There is an example in the official octopus-github-docs how to use the Github Action deploy step with variables - but there is no explanation how these variables are retrieved on the Octopus side. If you have any clue how to do this - it would be from great help.
Ok - I found out what I was missing here. Its hard to understand as the docs are not really pointing to what needs to be done.
Create Project-variables in Octopus Process matching the ones in your Github Action OctopusDeploy/deploy-release-action@v3 build step, with an empty or default value.
You then need to make prompted variables prompted-variables out of these variables.
For that, in the Variable-Tab in the Octopus UI:
Open Editor >> check Prompted Variable box.Here the prompted-variable docs for octopus. Its not obvious as this can in the UI only be achieved through clicking on Open Editor . Then you can retrieve these variables in your Octopus step like any other variable like so: ${MyVar}