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

support sub-directory pattern #1

Open
giautm opened this issue May 4, 2021 · 5 comments · May be fixed by #2
Open

support sub-directory pattern #1

giautm opened this issue May 4, 2021 · 5 comments · May be fixed by #2

Comments

@giautm
Copy link

giautm commented May 4, 2021

Hi, I try to use your Actions with the filter:

      - name: Generate matrix
        id: generate_matrix
        uses: ReyahSolutions/matrix-git-generator@v1
        with:
          filters: |
            apps/*/**

But, the output currently has only the element apps. How I can get apps/foo, apps/bar (or foo / bar) from the changes? I think the below code is related.

const baseFolder = potentialMatch.split("/")[0];

@ArthurKnoep
Copy link
Member

Hi,

Indeed it's currently not supported but we are open to contribution 😄

I think the best strategy here would be to add a depth param to the filters, maybe we could achieve that with something like this:

- name: Generate matrix
  id: generate_matrix
  uses: ReyahSolutions/matrix-git-generator@v1
  with:
    filters: |
      apps/*/**:2

@giautm
Copy link
Author

giautm commented May 4, 2021

Another way is support baseDir:

      - name: Generate matrix
        id: generate_matrix
        uses: ReyahSolutions/matrix-git-generator@v1
        with:
          baseDir: apps
          filters: |
            */**

@giautm
Copy link
Author

giautm commented May 4, 2021

I send a PRs. Currently, I can't install modules, because I can't connect to https://npm.reyah.ga, in your yarn.lock. I try to remove yarn.lock and use the global version of npm. But I ran into an error with tsc.

#2

giautm@GiauTM matrix-git-generator % yarn build     
yarn run v1.22.10
$ tsc
node_modules/@octokit/webhooks/dist-types/types.d.ts:22:90 - error TS1110: Type expected.

22 export declare type ToWebhookEvent<TEmitterEvent extends string> = TEmitterEvent extends `${infer TWebhookEvent}.${string}` ? TWebhookEvent : TEmitterEvent;
                                                                                            ~~~

node_modules/@octokit/webhooks/dist-types/types.d.ts:22:99 - error TS1005: '}' expected.

22 export declare type ToWebhookEvent<TEmitterEvent extends string> = TEmitterEvent extends `${infer TWebhookEvent}.${string}` ? TWebhookEvent : TEmitterEvent;
                                                                                                     ~~~~~~~~~~~~~

node_modules/@octokit/webhooks/dist-types/types.d.ts:22:112 - error TS1128: Declaration or statement expected.

22 export declare type ToWebhookEvent<TEmitterEvent extends string> = TEmitterEvent extends `${infer TWebhookEvent}.${string}` ? TWebhookEvent : TEmitterEvent;
                                                                                                                  ~

node_modules/@octokit/webhooks/dist-types/types.d.ts:22:113 - error TS1128: Declaration or statement expected.

22 export declare type ToWebhookEvent<TEmitterEvent extends string> = TEmitterEvent extends `${infer TWebhookEvent}.${string}` ? TWebhookEvent : TEmitterEvent;
                                                                                                                   ~

node_modules/@octokit/webhooks/dist-types/types.d.ts:22:115 - error TS1005: ';' expected.

22 export declare type ToWebhookEvent<TEmitterEvent extends string> = TEmitterEvent extends `${infer TWebhookEvent}.${string}` ? TWebhookEvent : TEmitterEvent;
                                                                                                                     ~

node_modules/@octokit/webhooks/dist-types/types.d.ts:44:54 - error TS1005: ';' expected.

44  * Error object with optional poperties coming from `octokit.request` errors
                                                        ~~~~~~~

node_modules/@octokit/webhooks/dist-types/types.d.ts:48:21 - error TS1005: ';' expected.

48      * @deprecated `error.event` is deprecated. Use the `.event` property on the aggregated error instance
                       ~~~~~

node_modules/@octokit/webhooks/dist-types/types.d.ts:55:21 - error TS1005: ';' expected.

55      * @deprecated `error.errors` is deprecated. Use `Array.from(error)`. See https://npm.im/aggregate-error
                       ~~~~~

node_modules/@octokit/webhooks/dist-types/types.d.ts:55:55 - error TS1005: ';' expected.

55      * @deprecated `error.errors` is deprecated. Use `Array.from(error)`. See https://npm.im/aggregate-error
                                                         ~~~~~

node_modules/@octokit/webhooks/dist-types/types.d.ts:74:1 - error TS1160: Unterminated template literal.

74 
   


Found 10 errors.```

@ArthurKnoep
Copy link
Member

Sorry for the delay, I had a problem with my mailbox,

Another way is support baseDir:

I also thought of a system like this in first place but in some cases you would want to set multiple base directory according to a pattern match.
But anyway I'm ok with the way you've implemented it, and also, I think this new param should not be mandatory in order to avoid breaking change.

Regarding the registry issue, npm.reyah.ga was an old private repository that we were using. I was able to fix the compilation issue that you have by replacing npm.reyah.ga by registry.yarnpkg.com in the original yarn.lock file

@ArthurKnoep ArthurKnoep linked a pull request May 5, 2021 that will close this issue
@giautm
Copy link
Author

giautm commented May 5, 2021

I have switched to using another solution to detect the changes directory in my monorepo (lhttps://lerna.js.org + publish script at the application package.json). But, I want to finish what I started; It may helpful for other projects.

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

Successfully merging a pull request may close this issue.

2 participants