Description
Description
The action workflow cannot be triggered after the mirror repository is synchronized when the workflow has branch filter parameters (see the below code)
on:
push:
branches:
- main
But when the workflow does not have any filter parameters (see the below code), the workflow can be triggered.
on:
push
The reproduce steps:
- Setup a new mirror repository (the upstream repository should have a workflow file like the first code at the above)
- Enable actions for this repository
- Push a new commit to the upstream repository
- Sync the mirror repository
- The workflow would not be triggered
I check the log file (log level is set to trace
), and find these logs
2023/05/20 21:26:05 ...actions/workflows.go:86:DetectWorkflows() [T] detect workflow "docker-release.yml" for event &jobparser.Event{Name:"push", acts:map[string][]string{"tags":[]string{"v*"}}, schedules:[]map[string]string(nil)} matching "push"
2023/05/20 21:26:05 ...actions/workflows.go:86:DetectWorkflows() [T] detect workflow "docker-snapshot.yml" for event &jobparser.Event{Name:"push", acts:map[string][]string{"branches":[]string{"main"}}, schedules:[]map[string]string(nil)} matching "push"
2023/05/20 21:26:05 ...s/notifier_helper.go:146:notify() [T] repo /data/git/repositories/****/****.git with commit 2d290990bfed049db1056432379fc54755bcb85e couldn't find workflows
So I check the code in modules/actions/workflows.go:200
. The variable refName
does not contain git.BranchPrefix
(refs/heads/
), so the workflow would not be triggered after the repository is synchronized if the workflow file has branch filter.
Then I check the results
variable in services/mirror/mirror_pull.go:413
, the field refName
also does not contain git.BranchPrefix
.
Gitea Version
Test in v1.19.3 and latest commit #1698c15cba8f9eedfcb6af8226f3e97950480aca
Can you reproduce the bug on the Gitea demo site?
No
Log Gist
No response
Screenshots
No response
Git Version
2.40.1
Operating System
Debian 11
How are you running Gitea?
I use the gitea/gitea:1.19.3
docker image to run gitea. To verify whether the latest version has fixed this issue, I download the latest code, and execute TAGS="bindata sqlite sqlite_unlock_notify" make build
(the golang version is 1.20.4, the nodejs version is 18.16.0) to build the latest binary file and put it into gitea/gitea:1.19.3
image, then use the modified image to test.
Database
MySQL