go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
44.19k stars 5.42k forks source link

Query both `.gitea` and `.github` for workflows #31456

Closed Sharaf5 closed 1 month ago

Sharaf5 commented 3 months ago

Description

I had some already set workflows inside «.github» dir Once I created one inside «.gitea» I no longer see first ones

Gitea Version

1.22

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

dockerized

How are you running Gitea?

inside docker «gitea:latest» and «act_runner:latest»

Database

SQLite

delvh commented 3 months ago

That isn't exactly a bug but rather intended behavior: Gitea/Act first queries the .gitea folder for workflows. If it doesn't find any, it checks if the repo is perhaps coming from GitHub, so if there is a .github folder that we fallback to. It is not intended that you have both, as a repo should be hosted either mainly on Gitea, or mainly on GitHub. Not both.

I don't see a usecase for querying both, it complicates a lot of calculations for no real benefit.

Sharaf5 commented 3 months ago

I really don't find it useful to have a hard coded folders and only parse one this should be a list of folders in repe settings where it's parsed one by one and all executions are returned with defauld to both gitea and github

delvh commented 3 months ago

Why is it "not useful to have hard coded folders"? What's the benefit of querying both? Why not store all files in the same directory?

Sharaf5 commented 3 months ago

I was willing build a repo with all my reusable workflow with some of theme to run on github and not others and some for gitea and github there might be someone else who want to use another folder name like ci or workflows for workflows

lunny commented 3 months ago

A proposal label is suitable for this issue.

Sharaf5 commented 3 months ago

Yes @lunny but I think Actions shouldn't use one dir is still a suitable title anyway, any intension to implement it ?

yp05327 commented 2 months ago

I think this is a good proposal. As there are still some unsupported workflows syntax in Gitea Action now (and in future), users can not completely using the same workflows in both GitHub and Gitea in some cases. So users can disable and rewrite them in .gitea/workflows and will not effect the existing workflows for using in GitHub.

lunny commented 2 months ago

I think this is a good proposal. As there are still some unsupported workflows syntax in Gitea Action now (and in future), users can not completely using the same workflows in both GitHub and Gitea in some cases. So users can disable and rewrite them in .gitea/workflows and will not effect the existing workflows for using in GitHub.

You requirement looks like different from the proposal one. You need an override feature. Maybe .gitea/workflows/test.yaml will override .github/workflows/test.yaml? It will become more complicated.

yp05327 commented 2 months ago

override is more complex and limit the usage.

wxiaoguang commented 2 months ago

I was willing build a repo with all my reusable workflow with some of theme to run on github and not others and some for gitea and github

Maybe you could try:

  1. use symlink (haven't tested whether it really works for actions, but it is a proper approach)
  2. use a bot to sync some "workflows"

As the discussion above, making ".gitea" actions inherit/re-use the ".github" actions is not a good approach, it would only cause bugs and confusions.

Sharaf5 commented 2 months ago

I think this is a good proposal. As there are still some unsupported workflows syntax in Gitea Action now (and in future), users can not completely using the same workflows in both GitHub and Gitea in some cases. So users can disable and rewrite them in .gitea/workflows and will not effect the existing workflows for using in GitHub.

Do you meen rewriting the workflow manually or overwritting on gitea Manual rewriting by user will be going with my proposal but the overriding dirs or files would just add more complecation for code even if there is a copy of the file in two dirs as one could disable the workflow

Sharaf5 commented 2 months ago
  1. use symlink (haven't tested whether it really works for actions, but it is a proper approach)

Don't seem to be best thing but I may try

  1. use a bot to sync some "workflows"

Don't understand this

Sharaf5 commented 2 months ago

As the discussion above, making ".gitea" actions inherit/re-use the ".github" actions is not a good approach, it would only cause bugs and confusions.

it's really built on top of act so, why I should repeat file that has a working workflow compatible with both, we need only to disable and rewrite manually what makes conflection

and it's the biggest deal for act_runner to still compatible with github action workflow syntax for now as gitea action still lake many of it's features

also gitea is a self hosted and one may bring it down for any reason ... more compitability between sites meens mirrors could run actions easly once one has any downtime on servers

what I was thinking about is

then like normal

that would help mixid workflows and mirrord setup like most of mine

I really tried to implement it myself as a new learning task but seams go is not easy for me at all

Sharaf5 commented 2 months ago

I also wondered

I may be overthinking but why not

GiteaBot commented 1 month ago

We close issues that need feedback from the author if there were no new comments for a month. :tea: