-
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
[feature] Write octodns-sync
plan to pull request comment
#36
Conversation
and document its use in README.md
in addition to the output log. This assumes, as was observed in manual testing, the PlanHtml output will go to stdout whereas the other octodns-sync output will go to stderr.
.. See also #35
for when add_pr_comment is enabled
I changed my mind, would like to do this step in a separate pull request. It's unnecessary for this feature and it'll require changes to |
# Post the comment | ||
_user="fakename" \ | ||
_token="${PR_COMMENT_TOKEN}" \ | ||
_body="${_body}" \ | ||
GITHUB_EVENT_PATH="${GITHUB_EVENT_PATH}" \ | ||
python3 -c "import requests, os, json | ||
comments_url = json.load(open(os.environ['GITHUB_EVENT_PATH'], 'r'))['pull_request']['comments_url'] | ||
response = requests.post(comments_url, auth=(os.environ['_user'], os.environ['_token']), json={'body':os.environ['_body']}) | ||
print(response)" |
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.
For posterity: This block looks the way it does, here, because it was the first way I found to meet these constraints:
- Use the add an issue comment API with a provided personal access token
- Get
$_body
into the JSON payload ~safely - Do not install
gh
orcurl
- Do not introduce dependencies, for example an external Python script or package
and add changes to CHANGELOG.md
None.
I added to README.md to cover available features. |
, and fix a nit in README
I'll go ahead and merge this into |
@solvaholic are you planning on doing a new release with these changes or are you waiting until the feedback I had is addressed? Right now I'm pinning to a4b4942 and did my first deploy Friday. It worked great, thanks again for the great action. |
fixes #35
How to test with the changes in this pull request
Use
solvaholic/octodns-sync@issue35
to run the changes pushed to branchissue35
:Add an
html
output to yourplan_outputs
in your octodns config, for example inpublic.yaml
:Configure your workflow to enable
add_pr_comment
and provide a token:To-do list
octodns-sync
log and plan output to two separate files[ ] Expose those ☝️ file paths as action outputsoctodns-sync
plan as a comment to the triggering pull request when:pull_request
add-pr-comment
is "Yes"