Open DilumAluthge opened 3 years ago
Here is a reproducer. I am not sure if this is a bug in TagBotTriggers
or in the GitHub.jl package:
julia> import GitHub
julia> const GH = GitHub
GitHub
julia> using Base64: base64decode
julia> repo = GitHub.repo("ThummeTo/FMI.jl");
julia> files, pages = GH.directory(repo, ".github/workflows")
(GitHub.Content[GitHub.Content (all fields are Union{Nothing, T}):
typ: "file"
name: "Documentation.yml"
path: ".github/workflows/Documentation.yml"
sha: "3af6956ac60884bb2a4c7d742095d79fc846c8cf"
url: URI("https://api.github.com/repos/ThummeTo/FMI.jl/contents/.github/workflows/Documentation.yml?ref=main")
git_url: URI("https://api.github.com/repos/ThummeTo/FMI.jl/git/blobs/3af6956ac60884bb2a4c7d742095d79fc846c8cf")
html_url: URI("https://github.com/ThummeTo/FMI.jl/blob/main/.github/workflows/Documentation.yml")
download_url: URI("https://raw.githubusercontent.com/ThummeTo/FMI.jl/main/.github/workflows/Documentation.yml")
size: 694, GitHub.Content (all fields are Union{Nothing, T}):
typ: "file"
name: "Julia TagBot.yml"
path: ".github/workflows/Julia TagBot.yml"
sha: "f49313b662013f43aac7de2c738e1163a9715ff4"
url: URI("https://api.github.com/repos/ThummeTo/FMI.jl/contents/.github/workflows/Julia%20TagBot.yml?ref=main")
git_url: URI("https://api.github.com/repos/ThummeTo/FMI.jl/git/blobs/f49313b662013f43aac7de2c738e1163a9715ff4")
html_url: URI("https://github.com/ThummeTo/FMI.jl/blob/main/.github/workflows/Julia%20TagBot.yml")
download_url: URI("https://raw.githubusercontent.com/ThummeTo/FMI.jl/main/.github/workflows/Julia%20TagBot.yml")
size: 362], Dict{String, String}())
julia> for f in files
@info "" f.typ f.name f.path
end
┌ Info:
│ f.typ = "file"
│ f.name = "Documentation.yml"
└ f.path = ".github/workflows/Documentation.yml"
┌ Info:
│ f.typ = "file"
│ f.name = "Julia TagBot.yml"
└ f.path = ".github/workflows/Julia TagBot.yml"
julia> for f in files
f.typ == "file" || continue
@info "" f.typ f.name f.path
file = GH.file(repo, f.path)
contents = String(base64decode(file.content))
end
┌ Info:
│ f.typ = "file"
│ f.name = "Documentation.yml"
└ f.path = ".github/workflows/Documentation.yml"
┌ Info:
│ f.typ = "file"
│ f.name = "Julia TagBot.yml"
└ f.path = ".github/workflows/Julia TagBot.yml"
ERROR: Error found in GitHub reponse:
Status Code: 400
Body:
<html>
<head>
<meta content="origin" name="referrer">
<title>Bad request · GitHub</title>
<meta name="viewport" content="width=device-width">
<style type="text/css" media="screen">
body {
background-color: #f6f8fa;
color: rgba(0, 0, 0, 0.5);
font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;
font-size: 14px;
line-height: 1.5;
}
.c { margin: 50px auto; max-width: 600px; text-align: center; padding: 0 24px; }
a { text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { color: #24292e; line-height: 60px; font-size: 48px; font-weight: 300; margin: 0px; }
p { margin: 20px 0 40px; }
#s { margin-top: 35px; }
#s a {
color: #666666;
font-weight: 200;
font-size: 14px;
margin: 0 10px;
}
</style>
</head>
<body>
<div class="c">
<h1>Whoa there!</h1>
<p>You have sent an invalid request. <br><br>
Please do not send this request again.
</p>
<div id="s">
<a href="https://support.github.com">Contact Support</a> —
<a href="https://githubstatus.com">GitHub Status</a> —
<a href="https://twitter.com/githubstatus">@githubstatus</a>
</div>
</div>
</body>
</html>
Stacktrace:
[1] error(::String, ::String, ::String)
@ Base ./error.jl:42
[2] handle_response_error(r::HTTP.Messages.Response)
@ GitHub ~/.julia/packages/GitHub/Em3bH/src/utils/requests.jl:177
[3] github_request(api::GitHub.GitHubWebAPI, request_method::Function, endpoint::String; auth::GitHub.AnonymousAuth, handle_error::Bool, headers::Dict{Any, Any}, params::Dict{Any, Any}, allowredirects::Bool)
@ GitHub ~/.julia/packages/GitHub/Em3bH/src/utils/requests.jl:68
[4] github_request
@ ~/.julia/packages/GitHub/Em3bH/src/utils/requests.jl:58 [inlined]
[5] #gh_get#4
@ ~/.julia/packages/GitHub/Em3bH/src/utils/requests.jl:72 [inlined]
[6] gh_get
@ ~/.julia/packages/GitHub/Em3bH/src/utils/requests.jl:72 [inlined]
[7] gh_get_json(api::GitHub.GitHubWebAPI, endpoint::String; options::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ GitHub ~/.julia/packages/GitHub/Em3bH/src/utils/requests.jl:78
[8] gh_get_json
@ ~/.julia/packages/GitHub/Em3bH/src/utils/requests.jl:78 [inlined]
[9] file(api::GitHub.GitHubWebAPI, repo::GitHub.Repo, path::String; options::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ GitHub ~/.julia/packages/GitHub/Em3bH/src/repositories/contents.jl:30
[10] file
@ ~/.julia/packages/GitHub/Em3bH/src/repositories/contents.jl:30 [inlined]
[11] #file#93
@ ./none:0 [inlined]
[12] file(repo::GitHub.Repo, path::String)
@ GitHub ./none:0
[13] top-level scope
@ ./REPL[7]:4
My guess is that GitHub.jl or HTTP.jl is failing to URL-escape the path.
So, for some reason, if the repository has a space in the name of the TagBot configuration file, it causes TagBot Triggers to fail.