Comments (15)
Yeah I have no clue, please help.
from ok.sh.
Here - just for reference - is formatted json from a different debug run than the above comment. The only difference is that the uploaded file name contains a underscore ("_") - "folk_testmod.zip", but in the above comment it's "folktestmod.zip":
{
"url": "https://api.github.com/repos/stellaris-mods/testing/releases/7806517",
"assets_url": "https://api.github.com/repos/stellaris-mods/testing/releases/7806517/assets",
"upload_url": "https://uploads.github.com/repos/stellaris-mods/testing/releases/7806517/assets?name=folk_testmod.zip",
"html_url": "https://github.com/stellaris-mods/testing/releases/tag/20170919-r2",
"id": 7806517,
"tag_name": "20170919-r2",
"target_commitish": "master",
"name": null,
"draft": false,
"author": {
"login": "folknor",
"id": 233791,
"avatar_url": "https://avatars2.githubusercontent.com/u/233791?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/folknor",
"html_url": "https://github.com/folknor",
"followers_url": "https://api.github.com/users/folknor/followers",
"following_url": "https://api.github.com/users/folknor/following{/other_user}",
"gists_url": "https://api.github.com/users/folknor/gists{/gist_id}",
"starred_url": "https://api.github.com/users/folknor/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/folknor/subscriptions",
"organizations_url": "https://api.github.com/users/folknor/orgs",
"repos_url": "https://api.github.com/users/folknor/repos",
"events_url": "https://api.github.com/users/folknor/events{/privacy}",
"received_events_url": "https://api.github.com/users/folknor/received_events",
"type": "User",
"site_admin": false
},
"prerelease": false,
"created_at": "2017-09-19T11:52:53Z",
"published_at": "2017-09-19T11:53:03Z",
"assets": [],
"tarball_url": "https://api.github.com/repos/stellaris-mods/testing/tarball/20170919-r2",
"zipball_url": "https://api.github.com/repos/stellaris-mods/testing/zipball/20170919-r2",
"body": "* Updated readme.md with changes from steam.bbcode.\n* Steam.bbcode update."
}
from ok.sh.
Ok, I can reproduce it now. The response headers are getting output along with the JSON response body. Still digging into why only in this method and not elsewhere.
from ok.sh.
That's a lot more readable and sane in Lua than sh 😀. Cool idea to use the path string from the docs. Very much inline with GH's "URI templates" approach and I've wondered why that hasn't seemed to catch on elsewhere.
Thanks for the reply 👍.
from ok.sh.
Here's some output with set -x:
+ [ X-GitHub-Request-Id = Link_next ]
+ IFS=: read -r hdr val
+ output=
+ printf %s\n
+ cat
+ :
+ cat
+ [ 1 -eq 1 ]
+ _log info Remaining next link follows: 50
+ local level=info
+ local message=Remaining next link follows: 50
+ shift 2
+ local lname
+ lname=INFO
+ level=4
+ printf %s %s: %s\n ok.sh INFO Remaining next link follows: 50
ok.sh INFO: Remaining next link follows: 50
+ [ -n ]
+ return
+ local upload_url={ "url": "https://api.github.com/repos/stellaris-mods/testing/releases/7806555", "assets_url": "https://api.github.com/repos/stellaris-mods/testing/releases/7806555/assets", "upload_url": "https://uploads.github.com/repos/stellaris-mods/testing/releases/7806555/assets?name=folktestmod.zip", "html_url": "https://github.com/stellaris-mods/testing/releases/tag/20170919-r3", "id": 7806555, "tag_name": "20170919-r3", "target_commitish": "master", "name": null, "draft": false, "author": { "login": "folknor", "id": 233791, "avatar_url": "https://avatars2.githubusercontent.com/u/233791?v=4", "gravatar_id": "", "url": "https://api.github.com/users/folknor", "html_url": "https://github.com/folknor", "followers_url": "https://api.github.com/users/folknor/followers", "following_url": "https://api.github.com/users/folknor/following{/other_user}", "gists_url": "https://api.github.com/users/folknor/gists{/gist_id}", "starred_url": "https://api.github.com/users/folknor/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/folknor/subscriptions", "organizations_url": "https://api.github.com/users/folknor/orgs", "repos_url": "https://api.github.com/users/folknor/repos", "events_url": "https://api.github.com/users/folknor/events{/privacy}", "received_events_url": "https://api.github.com/users/folknor/received_events", "type": "User", "site_admin": false }, "prerelease": false, "created_at": "2017-09-19T11:56:11Z", "published_at": "2017-09-19T11:56:36Z", "assets": [ ], "tarball_url": "https://api.github.com/repos/stellaris-mods/testing/tarball/20170919-r3", "zipball_url": "https://api.github.com/repos/stellaris-mods/testing/zipball/20170919-r3", "body": "* Testing without _ in name." }
/home/folk/.local/bin/ok.sh: 1566: local: "url":: bad variable name
+ excode=2
+ trap - EXIT
+ exec
+ exec
+ exec
+ rm -rf /tmp/ok.sh.3915.6785868917
+ exit 2
from ok.sh.
Thanks for all the details. I'll try to reproduce and report back.
from ok.sh.
I have a lot more debug output and I'm ready to assist in testing for the next 3-4 hours if needed.
from ok.sh.
Thanks for the offer! I won't be able to get to it until after work so several hours at the soonest but I'll comment when I do.
from ok.sh.
Does it work if you remove the -j
flag?
This function is an outlier in that it's the only one that requires jq to perform an internal query. I've thought about removing it or splitting it out for that reason (see #9). That said, it at least needs a check in its current form. I've added one in #48.
from ok.sh.
No, it does not work without -j
, I said that in the initial description.
I will try again with your latest commits soon, thank you.
from ok.sh.
Same error as before, here is all the output from -vvv -x, with raw binary data snipped out: https://hastebin.com/raw/apivosazig
from ok.sh.
That said, it does actually upload the asset. It just errors immediately after.
from ok.sh.
Thanks, I missed the test without the -j
flag. Looks like the JSON response from the intermediary step is getting mangled somewhere. I'll take another stab at reproducing.
from ok.sh.
This function may just be too fragile so I'm thinking of stripping it down to just the basics (#65). A lot less convenient but hopefully more straightforward to use if edge-cases happen. Thoughts welcome.
from ok.sh.
Seems entirely sensible to me. I didn't want to bother you with this, and I'm much more comfortable with lua than bash scripting, so I wrote a replacement for myself a year or so ago.
The code is quite insane, because I had this "brilliant idea" that it should generate the functions from the github docs per path, for example to implement GET /repos/:owner/:repo/issues/:number/labels
in my library, all you do is write get("repos/:owner/:repo/issues/:number/labels")
, and you're done.
Optionally, you can write
get("repos/:owner/:repo/issues/:number/labels", {
"state", "open", {
open = true,
closed = true,
all = true,
},
...
})
To denote that the runtime-generated API function should take an argument "state" that it passes as a HTTP parameter, where the default value is "open", and the 3 allowed values are open/closed/all.
To then call this function in your own code, you do
local _gh = require("lua-github")
local httpHeaders, jsonResponse = _gh.GET["repos/:owner/:repo/issues/:number/labels"](
"folknor",
"repository-name",
42,
"closed"
)
print(jsonResponse.upload_url) -- The response in this case has no .upload_url, I guess
The library worked when I made it, but I've not used it for a year or so. GH might have changed their API surface as well, for all I know.
I'm not sure why I described the code in such detail above, but it started by wanting to explain why I hadn't pestered you about my ok.sh upload_asset bug report :-)
https://github.com/folknor/lua-github/blob/master/src/github.lua
from ok.sh.
Related Issues (20)
- Add support for github deployments API
- Gl
- Reformat _filters to use @tsv for readability? HOT 1
- Add a CONTRIBUTORS doc HOT 1
- No usable output from script HOT 5
- Add meta data HOT 4
- Tag name that looks like a float not treated as string HOT 1
- Create tag as part of release? HOT 2
- Investigate parsing URI Templates HOT 1
- Normalize user & repo usage? HOT 2
- upload_asset with Upload URL error HOT 11
- idkwtf list_issues = curl: (6) Could not resolve host: api.github.com<https ?? HOT 4
- Fix Busybox compatibility (or come up with another way to make a POSIX-like env) HOT 2
- POSIX compliance; ok shells. HOT 2
- no way to create_issue? HOT 3
- repo creation fails HOT 4
- About authentication (netrc), add an environment for authentication. HOT 1
- what is a direction querystring argument? HOT 2
- upload_asset pipes HTTP headers into jq HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ok.sh.