Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import filters file from another repository #196

Open
Tchekda opened this issue Jul 8, 2023 · 2 comments
Open

Import filters file from another repository #196

Tchekda opened this issue Jul 8, 2023 · 2 comments

Comments

@Tchekda
Copy link

Tchekda commented Jul 8, 2023

Hello,
Inside our organization, we use a centralized repository for all our reusable Github actions. (OUR_ORG/pipelines in the example).
One of those reusable workflows uses the paths-filter action, and we want to have a file in OUR_ORG/pipelines with the default filters for all our projects. (The file is in .github/file-filters.yml in the example)

  • When we set filters: ./github/file-filters.yml, it doesn't work because that file doesn't exist inside the repository from which the reusable workflow is called.
  • When we set filters: OUR_ORG/pipelines/./github/file-filters.yml, it doesn't work either, seems like it doesn't understand that it is a repository reference and tries to load the path locally.

Not being able to load a centralized filter file is preventing us from having a pipeline that would work the same way across all our repositories.
Is there a way to do something on our end to make this happen or does it need to be fixed on your side ?

@ElviaSober
Copy link

Hi,

Your syntax doesn't seem to be fully correct in the examples that you have given. You can check here: https://docs.github.com/en/actions/using-workflows/reusing-workflows#creating-a-reusable-workflow for the syntax.

In short,

  • The examples you gave should have .github/ instead of ./github/ and all workflows should be in a .github/workflows/ directory (requirement from github, see the link above).
  • When you put the full path as your second example, you should put the branch reference in the end: filters: OUR_ORG/pipelines/.github/workflows/file-filters.yml@main. Instead of that you could checkout the OUR_ORG/pipelines repository in a previous step in the same job and then you should be able to use .github/workflows/file-filters.yml

@Tchekda
Copy link
Author

Tchekda commented Jun 17, 2024

Hello,
Sorry to bring it back after 1 year, finally got some time to work on it ;)
I tried your second suggestion and it still doesn't work...
The config file is available at ORG/pipelines/.github/path-filter.yml on the main branch and I am getting the following error on the app repo

Error: Configuration file 'ORG/pipelines/.github/file-filters.yml@main' not found

image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants