Gitea incorrect API call

Using drone/drone:latest and gitea/gitea:1.10.


Drone API calls POST /api/repos/{namespace}/{name}/builds and POST /api/repos/{namespace}/{name}/builds?branch={branch} do not work for a Gitea repo. These API calls trigger an incorrect API call to Gitea, being GET /api/v1/repos/{owner}/{repo}/git/commits/{ref} instead of GET /api/v1/repos/{owner}/{repo}/git/refs/{ref}.

As seen in drone/service/commit/commit.go lines 45 and 90, the same function FindCommit() is used to perform API requests for both commits and refs, hence leading to the wrong API call being made for refs.

Suggested solution:

Add an extra function FindCommitByRef() in go-scm/scm/driver/gitea/git.go and other drivers which performs the correct API call.

A pull request with the proposed solution has been made: Fix gitea API call for triggering pipelines #50.