Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 16 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,19 @@ export default {

## Inputs

| Name | Description | Required | Default |
| ------------------- | ------------------------------------------------------------------- | -------- | ------------------------ |
| token | Token used for pushing fixes and commenting on PRs. | true | |
| working-directory | Working directory to run the action in | false | "." |
| web-components-src | The path to the directory containing the web components source code | false | "src/\*_/_.{ts,tsx}" |
| test-src | The path to the directory containing the test source code | false | "src/test/\*_/_.test.ts" |
| test-results-path | The path to the test results file | false | "./test-results.xml" |
| coverage-path | The path to the coverage file | false | "coverage/lcov.info" |
| run-static-analysis | Whether to run static analysis | false | true |
| run-code-formatting | Whether to run code formatting | false | true |
| run-tests | Whether tests should be run. | false | true |
| run-coverage | Whether to run coverage | false | true |
| create-comment | Whether to create a comment on the PR | false | true |
| coverage-pass-score | The minimum coverage score required to pass | false | "80" |
| Name | Description | Required | Default |
| ------------------- | ------------------------------------------------------------------- | -------- | --------------------------- |
| token | Token used for pushing fixes and commenting on PRs. | true | |
| working-directory | Working directory to run the action in | false | "." |
| web-components-src | The path to the directory containing the web components source code | false | "src/\*_/_.{ts,tsx}" |
| test-src | The path to the directory containing the test source code | false | "src/test/\*_/_.test.ts" |
| test-results-path | The path to the test results file | false | "./test-results.xml" |
| coverage-path | The path to the coverage file | false | "coverage/lcov.info" |
| run-static-analysis | Whether to run static analysis | false | true |
| run-code-formatting | Whether to run code formatting | false | true |
| run-tests | Whether tests should be run. | false | true |
| run-coverage | Whether to run coverage | false | true |
| create-comment | Whether to create a comment on the PR | false | true |
| coverage-pass-score | The minimum coverage score required to pass | false | "80" |
| eslint-config-path | The path to the ESLint configuration file | false | "eslint.config.\*" |
| test-config-path | The path to the test configuration file | false | "web-test-runner.config.\*" |
11 changes: 9 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,15 @@ inputs:
required: false
default: "80"

# Define your outputs here.
# outputs:
eslint-config-path:
description: "The path to the ESLint configuration file"
required: false
default: "eslint.config.*"

test-config-path:
description: "The path to the test configuration file"
required: false
default: "web-test-runner.config.*"

runs:
using: node20
Expand Down
18 changes: 15 additions & 3 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.

23 changes: 21 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@ const getInputs = (
string,
string,
boolean,
string,
string,
] => {
// get the token and octokit
let token = "";
Expand Down Expand Up @@ -253,6 +255,14 @@ const getInputs = (
? true
: getBooleanInput("create-comment");

const eslintConfigPath: string = isLocal
? "eslint.config.*"
: getInput("eslint-config-path");

const testConfigPath: string = isLocal
? "web-test-runner.config.*"
: getInput("test-config-path");

return [
token,
workingDirectory,
Expand All @@ -266,6 +276,8 @@ const getInputs = (
coveragePassScore,
coveragePath,
createComment,
eslintConfigPath,
testConfigPath,
];
};

Expand Down Expand Up @@ -308,6 +320,8 @@ export async function run(): Promise<void> {
coveragePassScore,
coveragePath,
createComment,
eslintConfigPath,
testConfigPath,
] = getInputs(isLocal);

// Check if the working directory is different from the current directory
Expand All @@ -325,7 +339,11 @@ export async function run(): Promise<void> {
const eslintStr: StepResponse | undefined = doStaticAnalysis
? await eslint({
label: "ESLint",
command: "npx eslint -f unix " + wcSrcDirectory,
command:
"npx eslint -f unix " +
wcSrcDirectory +
" --config " +
eslintConfigPath,
})
: undefined;

Expand Down Expand Up @@ -377,7 +395,8 @@ export async function run(): Promise<void> {
command:
'npx web-test-runner \"' +
testSrcDirectory +
'\" --node-resolve --coverage',
'\" --node-resolve --coverage --config ' +
testConfigPath,
},
testResultsPath,
)
Expand Down