In the gitleaks action it is not possible to scan a specific directory only.
gitleaks allows you to run a a scan of directory , there does not seems to be a support to do the same with the github action.
Common use case is a monorepo where only one folder belongs to a project.