SHA256
1
0
Files
autogits/gitea_status_proxy

gitea_status_proxy

Allows bots without code owner permission to set Gitea's commit status

Basic usage

To beging, you need the json config and a Gitea token with permissions to the repository you want to write to.

Keys should be randomly generated, i.e by using openssl: openssl rand -base64 48

Generate a json config file, with the key generated from running the command above, save as example.json:

{
	"forge_url": "https://src.opensuse.org/api/v1",
	"keys": ["$YOUR_TOKEN_GOES_HERE"]
}

start the proxy:

GITEA_TOKEN=YOURTOKEN ./gitea_status_proxy -config example.json
2025/10/30 12:53:18 [I] server up and listening on :3000

Now the proxy should be able to accept requests under: localhost:3000/repos/{owner}/{repo}/statuses/{sha}, the token to be used when authenticating to the proxy must be in the keys list of the configuration json file (example.json above)

example:

On a separate terminal, you can use curl to post a status to the proxy, if the GITEA_TOKEN has permissions on the target repository, it will result in a new status being set for the given commit

curl -X 'POST' \
  'localhost:3000/repos/szarate/test-actions-gitea/statuses/cd5847c92fb65a628bdd6015f96ee7e569e1ad6e4fc487acc149b52e788262f9' \
  -H 'accept: application/json' \
  -H 'Authorization: token $YOUR_TOKEN_GOES_HERE' \
  -H 'Content-Type: application/json' \
  -d '{
  "context": "Proxy test",
  "description": "Status posted from the proxy",
  "state": "success",
  "target_url": "https://src.opensuse.org"
}'

After this you should be able to the results in the pull request, e.g from above: szarate/test-actions-gitea#1