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

feat: exclude match directory #346

Merged
merged 3 commits into from Aug 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion __tests__/main.test.ts
Expand Up @@ -58,7 +58,7 @@ test('returns the paths of the filtered files (input files, input source files)'
test('returns the paths of the all other files (input files)', async () => {
mockedEnv({
...defaultEnv,
INPUT_FILES: '!__tests__\n!*.md\n!dist\n!jest\n!.*\n!src\n!lib',
INPUT_FILES: '!__tests__\n!*.md\n!dist\n!jest\n!.*\n!src/main.ts\n!lib',
})

const EXPECTED_FILENAMES = [
Expand All @@ -67,6 +67,8 @@ test('returns the paths of the all other files (input files)', async () => {
'jest.config.js',
'package.json',
'renovate.json',
'src/cleanup.ts',
'src/utils.ts',
'tsconfig.json',
'yarn.lock'
]
Expand Down
5 changes: 4 additions & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion src/main.ts
@@ -1,3 +1,4 @@
import {GlobOptions} from '@actions/glob'
import * as path from 'path'
import * as core from '@actions/core'
import * as glob from '@actions/glob'
Expand Down Expand Up @@ -150,7 +151,10 @@ export async function run(): Promise<void> {
filePatterns = `**\n${filePatterns}`
}

const globOptions = {followSymbolicLinks}
const globOptions: GlobOptions = {
followSymbolicLinks,
matchDirectories: false
}
const globber = await glob.create(filePatterns, globOptions)
let paths = await globber.glob()

Expand Down