Compare commits
3 Commits
d261a9f3fe
...
v0.1.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c345025221 | ||
|
|
64559f0250 | ||
|
|
b8463d66a0 |
@@ -95,7 +95,6 @@ jobs:
|
|||||||
needs: build
|
needs: build
|
||||||
runs-on: self-hosted
|
runs-on: self-hosted
|
||||||
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
|
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
|
||||||
environment: staging
|
|
||||||
steps:
|
steps:
|
||||||
- name: Update image tag in infra repo
|
- name: Update image tag in infra repo
|
||||||
env:
|
env:
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ func (c *Client) doOnce(ctx context.Context, method, path string, body []byte) (
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, 0, err
|
return nil, 0, err
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer func() { _ = resp.Body.Close() }()
|
||||||
b, err := io.ReadAll(resp.Body)
|
b, err := io.ReadAll(resp.Body)
|
||||||
return b, resp.StatusCode, err
|
return b, resp.StatusCode, err
|
||||||
}
|
}
|
||||||
@@ -122,7 +122,7 @@ func (c *Client) doRaw(ctx context.Context, method, path string, body []byte) (*
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer func() { _ = resp.Body.Close() }()
|
||||||
b, err := io.ReadAll(resp.Body)
|
b, err := io.ReadAll(resp.Body)
|
||||||
return &rawResponse{Body: b, Status: resp.StatusCode, Headers: resp.Header}, err
|
return &rawResponse{Body: b, Status: resp.StatusCode, Headers: resp.Header}, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ func splitUnifiedDiff(d []byte) map[string][]byte {
|
|||||||
|
|
||||||
flush := func() {
|
flush := func() {
|
||||||
if currentFile != "" {
|
if currentFile != "" {
|
||||||
m[currentFile] = []byte(current.String())
|
m[currentFile] = current.Bytes()
|
||||||
current.Reset()
|
current.Reset()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,11 +42,11 @@ func buildFilesJSON(files []string, additions int) string {
|
|||||||
func newPRFilesDiffServer(t *testing.T, filesJSON, rawDiff string) *httptest.Server {
|
func newPRFilesDiffServer(t *testing.T, filesJSON, rawDiff string) *httptest.Server {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
return httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
return httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
switch {
|
switch r.URL.Path {
|
||||||
case r.URL.Path == "/api/v1/repos/o/r/pulls/1/files":
|
case "/api/v1/repos/o/r/pulls/1/files":
|
||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
_, _ = w.Write([]byte(filesJSON))
|
_, _ = w.Write([]byte(filesJSON))
|
||||||
case r.URL.Path == "/api/v1/repos/o/r/pulls/1.diff":
|
case "/api/v1/repos/o/r/pulls/1.diff":
|
||||||
w.Header().Set("Content-Type", "text/plain")
|
w.Header().Set("Content-Type", "text/plain")
|
||||||
_, _ = w.Write([]byte(rawDiff))
|
_, _ = w.Write([]byte(rawDiff))
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package tools
|
package tools
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
||||||
"gitea.d-ma.be/mathias/gitea-mcp/internal/registry"
|
"gitea.d-ma.be/mathias/gitea-mcp/internal/registry"
|
||||||
@@ -21,8 +20,6 @@ func parseArgs(raw json.RawMessage, dst any) error {
|
|||||||
return json.Unmarshal(raw, dst)
|
return json.Unmarshal(raw, dst)
|
||||||
}
|
}
|
||||||
|
|
||||||
func _ctx(ctx context.Context) context.Context { return ctx } // stub for future hooks
|
|
||||||
|
|
||||||
// capLimit returns a sane page size: 0 or negative → def, > 50 → 50.
|
// capLimit returns a sane page size: 0 or negative → def, > 50 → 50.
|
||||||
func capLimit(in, def int) int {
|
func capLimit(in, def int) int {
|
||||||
if in <= 0 {
|
if in <= 0 {
|
||||||
|
|||||||
Reference in New Issue
Block a user