Skip to content

Commit

Permalink
remove unused validation.
Browse files Browse the repository at this point in the history
  • Loading branch information
jackton1 committed Aug 8, 2022
1 parent 17ae444 commit f59cc99
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 245 deletions.
16 changes: 0 additions & 16 deletions __tests__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,19 +148,3 @@ test('returns the paths of the filtered files in the paths-output-file', async (
pathsOutputFile
)
})

test('returns warning for no match found', async () => {
mockedEnv({
...defaultEnv,
INPUT_FILES: '-**.yml'
})

// @ts-ignore
core.warning = jest.fn()

await run()

expect(core.warning).toBeCalledWith(
'Invalid pattern detected: "-**.yml". Ensure that subdirectory patterns are prefixed with "**/" and all multi line string patterns are specified without quotes. See: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet'
)
})
8 changes: 0 additions & 8 deletions 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.

10 changes: 2 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,27 +31,21 @@
"dependencies": {
"@actions/core": "1.9.0",
"@actions/exec": "1.1.1",
"@actions/github": "5.0.3",
"@actions/glob": "0.3.0",
"@actions/io": "1.1.2",
"is-glob": "^4.0.3",
"temp-dir": "2.0.0",
"uuid": "8.3.2"
},
"devDependencies": {
"@types/jest": "28.1.6",
"@types/jest": "^28.1.6",
"@types/node": "18.6.4",
"@types/uuid": "8.3.4",
"@types/is-glob": "4.0.2",
"@typescript-eslint/eslint-plugin": "^5.33.0",
"@typescript-eslint/parser": "5.32.0",
"@vercel/ncc": "0.34.0",
"eslint": "8.21.0",
"eslint-plugin-github": "4.3.7",
"eslint-plugin-jest": "26.8.0",
"eslint-plugin-prettier": "4.2.1",
"jest": "28.1.3",
"js-yaml": "4.1.0",
"mocked-env": "1.3.5",
"prettier": "2.7.1",
"ts-jest": "28.0.7",
"typescript": "4.7.4"
Expand Down
23 changes: 0 additions & 23 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import * as path from 'path'
import * as core from '@actions/core'
import * as glob from '@actions/glob'
import {promises as fs} from 'fs'
import isGlob from 'is-glob'

import {
getDeletedFiles,
Expand Down Expand Up @@ -180,28 +179,6 @@ export async function run(): Promise<void> {
core.setOutput('paths-output-file', pathsOutputFile)
core.saveState('paths-output-file', pathsOutputFile)
core.info(`Successfully created paths-output-file: ${pathsOutputFile}`)
} else {
const defaultExcludedPatterns = DEFAULT_EXCLUDED_FILES.map(
ep => `!${path.join(workingDirectory, ep.replace(/^!/, ''))}`
)
const invalidPatterns = filePatterns
.split('\n')
.filter(
p =>
p !== '' &&
!p.startsWith('!') &&
isGlob(p, {strict: false}) &&
!defaultExcludedPatterns.includes(p)
)
.map(p => `${p.replace(`${workingDirectory}${path.sep}`, '')}`)

if (invalidPatterns.length > 0) {
core.warning(
`Invalid pattern detected: "${invalidPatterns.join(
', '
)}". Ensure that subdirectory patterns are prefixed with "**/" and all multi line string patterns are specified without quotes. See: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet`
)
}
}
}

Expand Down

0 comments on commit f59cc99

Please sign in to comment.