GITHUB_OUTPUT scope for custom actions seems not same as GH actions
Bug report info
act version: 0.2.57
GOOS: darwin
GOARCH: arm64
NumCPU: 10
Docker host: unix:///Users/khaled-abushqear/.docker/run/docker.sock
Sockets found:
/var/run/docker.sock
$HOME/.docker/run/docker.sock
Config files:
/Users/khaled-abushqear/.actrc:
-P ubuntu-latest=ghcr.io/catthehacker/ubuntu:runner-latest
-P ubuntu-22.04=ghcr.io/catthehacker/ubuntu:runner-22.04
-P ubuntu-20.04=ghcr.io/catthehacker/ubuntu:runner-20.04
-P ubuntu-18.04=ghcr.io/catthehacker/ubuntu:runner-18.04
Build info:
Go version: go1.20.12
Module path: github.com/nektos/act
Main version: (devel)
Main path: github.com/nektos/act
Main checksum:
Build settings:
-buildmode: exe
-compiler: gc
-trimpath: true
CGO_ENABLED: 0
GOARCH: arm64
GOOS: darwin
vcs: git
vcs.revision: e8856f0fb00fcdd16eef2325b845f55f5d346f51
vcs.time: 2023-08-21T16:17:06Z
vcs.modified: true
Docker Engine:
Engine version: 24.0.6
Engine runtime: runc
Cgroup version: 2
Cgroup driver: cgroupfs
Storage driver: overlay2
Registry URI: https://index.docker.io/v1/
OS: Docker Desktop
OS type: linux
OS version:
OS arch: aarch64
OS kernel: 6.4.16-linuxkit
OS CPU: 10
OS memory: 7844 MB
Security options:
name=seccomp,profile=unconfined
name=cgroupns
Command used with act
gh act -b --container-architecture linux/amd64 -W .github/workflows/connection_test.yml --eventpath .github/connection_test_payload_example.json --var-file .github/sample.variables.env
Describe issue
The workflows is a custom action located at (./.github/actions/connection-tester), I use it in my main action as follows:
- name: Executing the action
id: execute-test
uses: ./.github/actions/connection-tester
with:
env: ${{ inputs.kafka_env }}
subnet_id: ${{ inputs.subnet_id }}
I have defined output execution_output as example
outputs:
execution_output:
description: The execution output
value: ${{ steps.get-execution-output.outputs.execution_output }}
In the step "Copy outputs to variables" I define the id=get-execution-output which fills this variable with the needed data
in GitHub workflows, if the id was not defined -> the main workflow won't be able to read it:
${{ steps.execute-test.outputs.execution_output }}
# output is empty
in act-cli, even if id was not defined, it fills the content in the variable execution_output
I guess the reason is related to the scopes, it looks like GH workflow defines a separate scope for GITHUB_OUTPUT for each step, but in act-cli, it defines GITHUB_OUTPUT on the custom action level
Link to GitHub repository
No response
Workflow content
name: Connectivity Test
description: Connectivity Test
inputs:
env:
description: Target Kafka Cluster
required: true
subnet_id:
description: The subnet ID (to initialize the instance)
required: true
outputs:
execution_output:
description: The execution output
value: ${{ steps.get-execution-output.outputs.execution_output }}
md_output:
description: The execution output in markdown
value: ${{ steps.get-execution-output.outputs.md_output }}
rc:
description: The execution return code
value: ${{ steps.get-execution-output.outputs.rc }}
runs:
using: composite
steps:
- name: Play Ansible Playbook
uses: arillso/action.playbook@master
continue-on-error: true
with:
playbook: "${{ github.action_path }}/ansible/main_play.yml"
galaxy_file: "${{ github.action_path }}/ansible/requirements.yml"
extra_vars: "subnet_id=${{ inputs.subnet_id }} env=${{ inputs.env }}"
env:
ANSIBLE_HOST_KEY_CHECKING: 'false'
ANSIBLE_DEPRECATION_WARNINGS: 'false'
- name: Copy outputs to variables
id: get-execution-output
working-directory: ${{ github.action_path }}
shell: bash
run: ./copy-outputs.sh
Relevant log output
➜ kafka-tests git:(feature/update=summary-html) ✗ gh act -b --container-architecture linux/amd64 -W .github/workflows/connection_test.yml --eventpath .github/connection_test_payload_example.json --var-file .github/sample.variables.env
[Kafka Connection Test/Performing Connectivity Test] 🚀 Start image=ghcr.io/catthehacker/ubuntu:runner-latest
INFO[0000] Parallel tasks (0) below minimum, setting to 1
[Kafka Connection Test/Performing Connectivity Test] 🐳 docker pull image=ghcr.io/catthehacker/ubuntu:runner-latest platform=linux/amd64 username= forcePull=true
INFO[0001] Parallel tasks (0) below minimum, setting to 1
[Kafka Connection Test/Performing Connectivity Test] 🐳 docker create image=ghcr.io/catthehacker/ubuntu:runner-latest platform=linux/amd64 entrypoint=["tail" "-f" "/dev/null"] cmd=[] network="host"
[Kafka Connection Test/Performing Connectivity Test] 🐳 docker run image=ghcr.io/catthehacker/ubuntu:runner-latest platform=linux/amd64 entrypoint=["tail" "-f" "/dev/null"] cmd=[] network="host"
[Kafka Connection Test/Performing Connectivity Test] 🐳 docker exec cmd=[chown -R 1001:1001 /Users/khaled-abushqear/workspace/kafka-tests] user=0 workdir=
| chown: changing ownership of '/Users/khaled-abushqear/workspace/kafka-tests/private_key.pem': Permission denied
| chown: changing ownership of '/Users/khaled-abushqear/workspace/kafka-tests/.git/objects/25/fd944077244789ea6a3e347ed60b8a57db6d56': Permission denied
.
. (not sure why there are too much permission related logs here)
.
[Kafka Connection Test/Performing Connectivity Test] ⭐ Run Main Output Inputs
[Kafka Connection Test/Performing Connectivity Test] 🐳 docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/0] user= workdir=
| {
| client_env: dev-rh,
| kafka_env: Staging,
| subnet_id: subnet-c64a20b0
| }
[Kafka Connection Test/Performing Connectivity Test] ✅ Success - Main Output Inputs
[Kafka Connection Test/Performing Connectivity Test] ⭐ Run Main Executing the action
[Kafka Connection Test/Performing Connectivity Test] ⭐ Run Main Copy outputs to variables
[Kafka Connection Test/Performing Connectivity Test] 🐳 docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/execute-test-composite-0.sh] user= workdir=/Users/khaled-abushqear/workspace/kafka-tests/.github/actions/connection-tester
[Kafka Connection Test/Performing Connectivity Test] ✅ Success - Main Copy outputs to variables
[Kafka Connection Test/Performing Connectivity Test] ⚙ ::set-output:: md_output=# Results
+ # -----------------------------------------
+
+ Connection was Failed ❌
+ NoBrokersAvailable
+
+ # -----------------------------------------
+
[Kafka Connection Test/Performing Connectivity Test] ⚙ ::set-output:: error=this
is
an
error
[Kafka Connection Test/Performing Connectivity Test] ⚙ ::set-output:: rc=0
[Kafka Connection Test/Performing Connectivity Test] ⚙ ::set-output:: execution_output=
# -----------------------------------------
Connection was Failed ❌
NoBrokersAvailable
# -----------------------------------------
[Kafka Connection Test/Performing Connectivity Test] ⚙ ::set-output:: md_output=
[Kafka Connection Test/Performing Connectivity Test] ⚙ ::set-output:: rc=
[Kafka Connection Test/Performing Connectivity Test] ⚙ ::set-output:: execution_output=
[Kafka Connection Test/Performing Connectivity Test] ✅ Success - Main Executing the action
[Kafka Connection Test/Performing Connectivity Test] ⚙ ::set-output:: execution_output=
# -----------------------------------------
Connection was Failed ❌
NoBrokersAvailable
# -----------------------------------------
[Kafka Connection Test/Performing Connectivity Test] ⚙ ::set-output:: md_output=# Results
```diff
+ # -----------------------------------------
+
+ Connection was Failed ❌
+ NoBrokersAvailable
+
+ # -----------------------------------------
+
`-`-`
[Kafka Connection Test/Performing Connectivity Test] ⚙ ::set-output:: error=this
is
an
error
[Kafka Connection Test/Performing Connectivity Test] ⚙ ::set-output:: rc=0
[Kafka Connection Test/Performing Connectivity Test] ⭐ Run Main debug
[Kafka Connection Test/Performing Connectivity Test] 🐳 docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/2] user= workdir=
| rc=0
| error:
| this
| is
| an
| error
| md_output:
| # Results
| ```diff
| + # -----------------------------------------
| +
| + Connection was Failed ❌
| + NoBrokersAvailable
| +
| + # -----------------------------------------
| +
| ```
| execution_output:
|
| # -----------------------------------------
|
| Connection was Failed ❌
| NoBrokersAvailable
|
| # -----------------------------------------
|
[Kafka Connection Test/Performing Connectivity Test] ✅ Success - Main debug
[Kafka Connection Test/Performing Connectivity Test] ⭐ Run Main Adding results to the summary
[Kafka Connection Test/Performing Connectivity Test] 🐳 docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/3] user= workdir=
[Kafka Connection Test/Performing Connectivity Test] ✅ Success - Main Adding results to the summary
[Kafka Connection Test/Performing Connectivity Test] ⭐ Run Post Executing the action
[Kafka Connection Test/Performing Connectivity Test] ✅ Success - Post Executing the action
[Kafka Connection Test/Performing Connectivity Test] Cleaning up container for job Performing Connectivity Test
[Kafka Connection Test/Performing Connectivity Test] 🏁 Job succeeded
Additional information
No response
Fwiw, here's a simple workflow run: https://github.com/check-spelling-sandbox/nektos-issue-action-outputs-1/actions/runs/8560809761/job/23460628099
Run echo "$outputs"
GitHub
{
"empty-action-output": ""
}
Act
{
"empty-action-output": "",
"output3": "from-composite-step2"
}