Skip to content

[Bug](solved?): Forgejo/Gitea failing due to bad API URL #3569

@jiriks74

Description

@jiriks74

Subject of the issue

Running this action on Forgejo/Gitea results in the following error:

::error::Not found.%0A

Debugging this lead me to the following URL definition:

https://github.com/peter-evans/create-pull-request/blob/16e0059bfd236716f0191bfcfa63d9ded4cf325f/dist/index.js#L1287

Changing this

From 9791a4f146d5369620ea3b934822e717d3d90034 Mon Sep 17 00:00:00 2001
From: jiriks74 <[email protected]>
Date: Sun, 15 Dec 2024 02:37:18 +0100
Subject: [PATCH] fix: Use the `v1` api as `v3` is not available on Forgejo.

---
 dist/index.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dist/index.js b/dist/index.js
index b555e94..8cbfb72 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -1284,7 +1284,7 @@ class GitHubHelper {
             options.auth = `${token}`;
         }
         if (githubServerHostname !== 'github.com') {
-            options.baseUrl = `https://${githubServerHostname}/api/v3`;
+            options.baseUrl = `https://${githubServerHostname}/api/v1`;
         }
         else {
             options.baseUrl = 'https://api.github.com';

resolves the issue and results in a working Action:

Steps to reproduce

  1. Use Forgejo/Gitea
  2. Create a simple Action modifying some files
  3. Use this Action for pushing the changes to the repository and creating a PR
  4. Run the new Action
  5. See the ::error::Not found.%0A error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions