I would have expected MY_ENV_VAR to be non-empty on the second attempt after it is exported.
name: tests
on:
push:
branches:
- "**"
tags:
- "!**"
workflow_call:
jobs:
testing:
runs-on: ubuntu-24.04
steps:
- uses: nick-fields/retry@v3
with:
shell: bash
max_attempts: 2
retry_on: error
polling_interval_seconds: 5
timeout_minutes: 90
command: |
set -x
echo "MY_ENV_VAR='${MY_ENV_VAR}'"
if [ "${MY_ENV_VAR}" == "" ]; then
exit 1
else
exit 0
fi
on_retry_command: |
echo "MY_ENV_VAR=true" >> $GITHUB_ENV
export "MY_ENV_VAR=true"
See: https://github.com/nh13/nick-fields-retry-env-var/actions/runs/13893887269/job/38870357956