-1

If .mdl and .tpt files are committed to the repository, a specific unit has a batch file also that needs to be triggered. Does anyone know how to resolve this issue?

Paths:

src/model/units/.mdl
tests/Impl/Unittest/units/.tpt
tests/Impl/Unittest/units/.bat

I need script, how to do and what to do for this issue.

James Z
  • 12,209
  • 10
  • 24
  • 44
Murali
  • 1
  • 2
  • Welcome to Stack Overflow. Does this answer your question? [How to run GitHub Actions workflow only if the pushed files are in a specific folder](https://stackoverflow.com/questions/63822219/how-to-run-github-actions-workflow-only-if-the-pushed-files-are-in-a-specific-fo) – A.L Jun 12 '23 at 08:55

1 Answers1

1

As explained in the official documentation, you could use the paths syntax to achieve what you want:

on:
  push:
    paths:
      - '**.mdl'
      - '**.tpt'
      - '**.bat'

This workflow will trigger every time a .mdl, .tpt or .bat file is pushed to the repository (for any branch).

Note that this implementation could also work with pull_request events.

GuiFalourd
  • 15,523
  • 8
  • 44
  • 71
  • Can you help me resolve the following scenario: If a commit occurs to either the .tpt or .mdl file, the corresponding unit that contains the batch file should run, while the other units should not run? If you have any template of this scenario please share it. That would be great helpfull to me. Thanks in advance!! – Murali Jun 12 '23 at 15:30
  • In that case, I would check the path which has been used through the [path-filter](https://github.com/dorny/paths-filter) action in a `setup` job, and then only run a second job if one of the paths you want has been updated. – GuiFalourd Jun 12 '23 at 18:20