-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add result output #11
Conversation
octodns-sync --config-file="${_config_path}" --doit | ||
RESULT=$(octodns-sync --config-file="${_config_path}" --log-stream-stdout --doit) | ||
else | ||
octodns-sync --config-file="${_config_path}" | ||
RESULT=$(octodns-sync --config-file="${_config_path}" --log-stream-stdout) | ||
fi | ||
echo "$RESULT" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here, rather than route the output through an environment variable will it work to store it in a file? For example:
octodns-sync --config-file="${_config_path}" --log-stream-stdout | tee /tmp/octodns-sync.log
Then you could use the Setting the comment body from a file approach to use the output in the next step of your job.
This way octodns-sync
would still output directly for the Actions log and the unmodified output would remain available for other uses in addition to this specific case with peter-evans' Actions.
I'll setup a test for this later today or tomorrow. If you happen to check it in the meantime, @thattommyhall, I'll be curious to hear what you find.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
@thattommyhall to illustrate that ☝️ I made an example in https://github.com/solvaholic/ideal-octo-pancake.
I pushed a new version of the solvaholic/octodns-sync container to Docker hub that writes the octodns-sync output to a file:
# Run octodns-sync.
echo "INFO: _config_path: ${_config_path}"
if [ "${_doit}" = "--doit" ]; then
octodns-sync --config-file="${_config_path}" \
--log-stream-stdout --doit | tee ${GITHUB_WORKSPACE}/octodns-sync.log
else
octodns-sync --config-file="${_config_path}" \
--log-stream-stdout | tee ${GITHUB_WORKSPACE}/octodns-sync.log
fi
And added a step to the workflow job to parse the output from the file:
- id: get-comment-body
run: |
body=$(cat ${GITHUB_WORKSPACE}/octodns-sync.log)
body="${body//'%'/'%25'}"
body="${body//$'\n'/'%0A'}"
body="${body//$'\r'/'%0D'}"
echo ::set-output name=body::$body
The automation added this: https://github.com/solvaholic/ideal-octo-pancake/pull/1#issuecomment-706599506
Would that approach meet your needs?
In #24 I switched this to use @thattommyhall I'll mark this pull request closed. Please do re-open if the log file won't meet your needs or we've more to discuss. Thank you 🙇 |
I am using this to do chat-ops with
peter-evans/{slash-command-dispatch|create-or-update-comment}