Skip to content

Conversation

cedstrom
Copy link

Add the inline diff on a per file basis to be compatible with GitHub

Example:

curl http://localhost:3000/api/v1/repos/cedstrom/test/pulls/1/files?token=[redacted]
[
    {
        "filename": ".gitignore",
        "status": "added",
        "additions": 2,
        "deletions": 0,
        "changes": 2,
        "html_url": "http://localhost:3000/cedstrom/test/src/commit/ce2c53223388eaaa026c25156b807e30acc05a56/.gitignore",
        "contents_url": "http://localhost:3000/api/v1/repos/cedstrom/test/contents/.gitignore?ref=ce2c53223388eaaa026c25156b807e30acc05a56",
        "raw_url": "http://localhost:3000/cedstrom/test/raw/commit/ce2c53223388eaaa026c25156b807e30acc05a56/.gitignore",
        "patch": "diff --git a/.gitignore b/.gitignore\n--- a/.gitignore\n+++ b/.gitignore\n@@ -0,1 +1,2 @@\n @@ -0,0 +1,2 @@\n++.env\n++.env.local\n\n"
    },
    {
        "filename": "README.md",
        "status": "changed",
        "additions": 1,
        "deletions": 0,
        "changes": 1,
        "html_url": "http://localhost:3000/cedstrom/test/src/commit/ce2c53223388eaaa026c25156b807e30acc05a56/README.md",
        "contents_url": "http://localhost:3000/api/v1/repos/cedstrom/test/contents/README.md?ref=ce2c53223388eaaa026c25156b807e30acc05a56",
        "raw_url": "http://localhost:3000/cedstrom/test/raw/commit/ce2c53223388eaaa026c25156b807e30acc05a56/README.md",
        "patch": "diff --git a/README.md b/README.md\n--- a/README.md\n+++ b/README.md\n@@ -1,2 +1,3 @@\n @@ -1,2 +1,3 @@\n  # test\n  \n++This is my first PR.\n\n"
    }
]

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Oct 10, 2025
@github-actions github-actions bot added modifies/api This PR adds API routes or modifies them modifies/go Pull requests that update Go code labels Oct 10, 2025
Add the inline diff on a per file basis to be compatible with GitHub

Example:

```
curl http://localhost:3000/api/v1/repos/cedstrom/test/pulls/1/files?token=[redacted]
```

```
[
    {
        "filename": ".gitignore",
        "status": "added",
        "additions": 2,
        "deletions": 0,
        "changes": 2,
        "html_url": "http://localhost:3000/cedstrom/test/src/commit/ce2c53223388eaaa026c25156b807e30acc05a56/.gitignore",
        "contents_url": "http://localhost:3000/api/v1/repos/cedstrom/test/contents/.gitignore?ref=ce2c53223388eaaa026c25156b807e30acc05a56",
        "raw_url": "http://localhost:3000/cedstrom/test/raw/commit/ce2c53223388eaaa026c25156b807e30acc05a56/.gitignore",
        "patch": "diff --git a/.gitignore b/.gitignore\n--- a/.gitignore\n+++ b/.gitignore\n@@ -0,1 +1,2 @@\n @@ -0,0 +1,2 @@\n++.env\n++.env.local\n\n"
    },
    {
        "filename": "README.md",
        "status": "changed",
        "additions": 1,
        "deletions": 0,
        "changes": 1,
        "html_url": "http://localhost:3000/cedstrom/test/src/commit/ce2c53223388eaaa026c25156b807e30acc05a56/README.md",
        "contents_url": "http://localhost:3000/api/v1/repos/cedstrom/test/contents/README.md?ref=ce2c53223388eaaa026c25156b807e30acc05a56",
        "raw_url": "http://localhost:3000/cedstrom/test/raw/commit/ce2c53223388eaaa026c25156b807e30acc05a56/README.md",
        "patch": "diff --git a/README.md b/README.md\n--- a/README.md\n+++ b/README.md\n@@ -1,2 +1,3 @@\n @@ -1,2 +1,3 @@\n  # test\n  \n++This is my first PR.\n\n"
    }
]
```
@cedstrom
Copy link
Author

For context, I want to use https://github.com/ray5273/ollama-pr-review-action in Gitea, but it depends on this API.

@lunny
Copy link
Member

lunny commented Oct 10, 2025

But the patch maybe very big. Is that necessary to always have that field?

@wxiaoguang
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. modifies/api This PR adds API routes or modifies them modifies/go Pull requests that update Go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants