Files
scwrypts/py/linear/comment.py
T

46 lines
1.3 KiB
Python
Raw Normal View History

2023-01-11 17:09:59 -07:00
#!/usr/bin/env python
2023-02-21 18:44:27 -07:00
from py.lib.http.linear import graphql
from py.lib.scwrypts import execute
2023-01-11 17:09:59 -07:00
2023-02-21 18:44:27 -07:00
from py.lib.scwrypts.exceptions import ImportedExecutableError
2023-01-11 17:09:59 -07:00
if __name__ != '__main__':
2023-02-21 18:44:27 -07:00
raise ImportedExecutableError()
#####################################################################
def get_query(args):
body = f'"""from wrobot:\n```\n{args.message}\n```\n"""'
return f'''
mutation CommentCreate {{
commentCreate(
input: {{
issueId: "{args.issue_id}"
body: {body}
}}
) {{ success }}
}}'''
def main(args, stream):
response = graphql(get_query(args))
stream.writeline(response)
#####################################################################
execute(main,
description = 'comment on an inssue in linear.app',
parse_args = [
( ['-d', '--issue-id'], {
'dest' : 'issue_id',
'help' : 'issue short-code (e.g. CLOUD-319)',
'required' : True,
}),
( ['-m', '--message'], {
'dest' : 'message',
'help' : 'comment to post to the target issue',
'required' : True,
}),
]
2023-01-11 17:09:59 -07:00
)