gptscript-ai/modify-github-issues

Enhancement to example.gpt script

Opened this issue · 0 comments

When GPTSCRIPT_GITHUB_TOKEN is not set , example.gpt script fails as follows:

gptscript modifygit.gpt
17:09:57 started  [main]
17:09:57 sent     [main]
17:09:57 started  [https://raw.githubusercontent.com/gptscript-ai/query-github-issues/2abf8c483076052c1f778a497575f5dbc31df2b0/tool.gpt(2)] [input={"query":"repo:g-linville/test is:issue is:closed in:title Test issue"}]
17:09:57 sent     [https://raw.githubusercontent.com/gptscript-ai/query-github-issues/2abf8c483076052c1f778a497575f5dbc31df2b0/tool.gpt(2)]
17:09:57 ended    [https://raw.githubusercontent.com/gptscript-ai/query-github-issues/2abf8c483076052c1f778a497575f5dbc31df2b0/tool.gpt(2)]
17:09:57 continue [main]
17:09:57 sent     [main]
17:09:57 started  [https://raw.githubusercontent.com/gptscript-ai/modify-github-issues/436d3468f1e2e26944b2b0a2b27cae6fc910f248/tool.gpt(3)] [input={"command":"comment","comment":"This issue has been noted.","number":"1","repo":"g-linville/test"}]
17:09:57 sent     [https://raw.githubusercontent.com/gptscript-ai/modify-github-issues/436d3468f1e2e26944b2b0a2b27cae6fc910f248/tool.gpt(3)]
time="2024-03-14T17:09:58-07:00" level=error msg="Error commenting: POST https://api.github.com/repos/g-linville/test/issues/1/comments: 401 Requires authentication []"
17:09:58 failed to run tool [] cmd [/Users/sangeethahariharan/Library/Caches/gptscript/repos/436d3468f1e2e26944b2b0a2b27cae6fc910f248/go1.22.1/bin/gptscript-go-tool {"command":"comment","comment":"This issue has been noted.","number":"1","repo":"g-linville/test"}]: exit status 1
2024/03/14 17:09:58 ERROR: time="2024-03-14T17:09:58-07:00" level=error msg="Error commenting: POST https://api.github.com/repos/g-linville/test/issues/1/comments: 401 Requires authentication []"
: exit status 1

Can we make this script to error out saying that we expect GPTSCRIPT_GITHUB_TOKEN to be set ?