gitea-backporter icon indicating copy to clipboard operation
gitea-backporter copied to clipboard

Idea: Run a command on a PR branch

Open silverwind opened this issue 2 years ago • 6 comments

The bot could accept a mention with a command like

@GiteaBot run `make fmt`

If this exact syntax is matched, check out the branch, run the command, and commit the results with a message run `make fmt` requested by @silverwind. Usage should be restricted to maintainer roles and above.

silverwind avatar May 29 '23 12:05 silverwind

I'll give it a shot this weekend. Which tools would I need to add to the docker image? Go, Node, Make...?

yardenshoham avatar May 29 '23 12:05 yardenshoham

git, go, node (with npm), make, curl at least. Maybe just use the test_env image which should have all of them.

silverwind avatar May 29 '23 12:05 silverwind

Unlike a backport, which happens on push this might have a request coming in when a make fmt is already running so I have to think about queuing work as there's only one of these that might run at a time

yardenshoham avatar May 31 '23 15:05 yardenshoham

Could use a temporary label like command/pending to prevent duplicate runs. Also, it serves a double purpose in indicating to users that the command was accepted.

silverwind avatar May 31 '23 17:05 silverwind

I'm talking about 2 maintainers triggering a command while we only have 1 git repo in the filesystem (we can't use it concurrently). I wonder if there are locks in javascript

yardenshoham avatar Jun 03 '23 16:06 yardenshoham

I don't suppose these action scripts run all within the same process, right? If so, no amount of in-process lock will help, but if the file system is shared between executions, you could put some sort of lockfile into it.

silverwind avatar Jun 05 '23 19:06 silverwind