Skip to content

Commit 0d00973

Browse files
Option to only store feedback locally, not on GitHub (#51)
Tested and it works great. Ran into some issues with logs, but that's a separate thing that seems to happen elsewhere. Fixes #28. After this gets in, I'll make a release.
1 parent db038e5 commit 0d00973

File tree

2 files changed

+20
-15
lines changed

2 files changed

+20
-15
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ This package is designed to support the following workflow:
2323
```yaml
2424
github issues:
2525
username: "YOUR_NEW_DEDICATED_ISSUE_CREATION_ACCOUNT"
26+
send to github: True # Make this false if you want to store feedback on the server
2627
token: "..." # A valid GitHub personal access token associated with the username above
2728
default repository owner: YOUR_GITHUB_USER_OR_ORG_HERE
2829
allowed repository owners: # List the repo that your account will be allowed to create issues on

docassemble/GithubFeedbackForm/data/questions/feedback.yml

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ code: |
2929
gentle_exit
3030
else:
3131
issue_template = generic_report[reason]
32-
send_to_github
32+
note_issue
3333
prevent_going_back()
3434
store_variables_snapshot(persistent=True)
3535
end_results
@@ -57,6 +57,8 @@ code: server_share_answers = get_config("github issues", {}).get("feedback sessi
5757
---
5858
code: server_ask_panel = get_config("github issues", {}).get("ask panel", False)
5959
---
60+
code: should_send_to_github = get_config("github issues", {}).get("send to github", True)
61+
---
6062
code: github_user = url_args.get('github_user', default_github_user_or_organization) or "suffolklitlab-issues"
6163
---
6264
code: github_repo = url_args.get('github_repo', default_repository) or "demo"
@@ -303,31 +305,33 @@ content: |
303305
---
304306
########################## Send to GitHub code ##########################
305307
need:
308+
- should_send_to_github
306309
- question_id
307310
- variable
308311
- package_version
309312
- filename
310313
code: |
311-
if not task_performed('sent to github', persistent=True):
314+
if not task_performed('issue noted', persistent=True):
312315
saved_uuid
313316
if showifdef('would_be_on_panel', False):
314317
add_panel_participant(panel_email)
315-
issue_url
316-
if issue_url:
317-
if saved_uuid:
318-
set_feedback_github_url(saved_uuid, issue_url)
319-
else:
320-
al_error_email
321-
log(f"This form was not able to add an issue on the {github_user}/{github_repo} repo. Check your config.")
322-
if al_error_email and not is_likely_spam(issue_template.content):
323-
log(f"Unable to create issue on repo {github_repo}, falling back to emailing {al_error_email}")
324-
send_email(to=al_error_email, subject=f"{github_repo} - {issue_template.subject_as_html(trim=True)}", template=issue_template)
318+
if should_send_to_github:
319+
issue_url
320+
if issue_url:
321+
if saved_uuid:
322+
set_feedback_github_url(saved_uuid, issue_url)
325323
else:
326-
log(f"~~~USER FEEDBACK~~~ {github_repo} -{issue_template.subject_as_html(trim=True)} - {issue_template.content_as_html(trim=True)}")
327-
mark_task_as_performed('sent to github', persistent=True)
324+
al_error_email
325+
log(f"This form was not able to add an issue on the {github_user}/{github_repo} repo. Check your config.")
326+
if al_error_email and not is_likely_spam(issue_template.content):
327+
log(f"Unable to create issue on repo {github_repo}, falling back to emailing {al_error_email}")
328+
send_email(to=al_error_email, subject=f"{github_repo} - {issue_template.subject_as_html(trim=True)}", template=issue_template)
329+
else:
330+
log(f"~~~USER FEEDBACK~~~ {github_repo} -{issue_template.subject_as_html(trim=True)} - {issue_template.content_as_html(trim=True)}")
331+
mark_task_as_performed('issue noted', persistent=True)
328332
else:
329333
log("Already sent feedback to github from a feedback interview, not going to send again")
330-
send_to_github = True
334+
note_issue = True
331335
---
332336
code: |
333337
saved_uuid = save_feedback_info(interview=filename, session_id=orig_session_id if actually_share_answers else None, template=issue_template)

0 commit comments

Comments
 (0)