Skip to content

Commit

Permalink
Remove "command" input deprecated in v11.
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidAnson committed Nov 21, 2023
1 parent b1a3c7b commit 1e5b660
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 147 deletions.
2 changes: 2 additions & 0 deletions .github/dictionary.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
CommonMark
config
LLMs
markdownlint-cli2-action
npm
README
truthy
64 changes: 0 additions & 64 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,70 +69,6 @@ jobs:
id: test
- run: exit 1
if: steps.test.outcome != 'failure'
command-config:
name: Command = config (test/errors.md, 2 errors)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rm .markdownlint.json
- uses: ./
with:
command: config
globs: |
config/test.markdownlint.jsonc
test/*
continue-on-error: true
id: test
- run: exit 1
if: steps.test.outcome != 'failure'
command-config-invalid:
name: Command = config (invalid configuration file, fails)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./
with:
command: config
globs: |
invalid.markdownlint.jsonc
test/*
continue-on-error: true
id: test
- run: exit 1
if: steps.test.outcome != 'failure'
command-config-missing:
name: Command = config (missing configuration file, fails)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./
with:
command: config
continue-on-error: true
id: test
- run: exit 1
if: steps.test.outcome != 'failure'
command-fix:
name: Command = fix (test/errors.md, 0 errors)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./
with:
command: fix
globs: 'test/*'
command-unsupported:
name: Command = unsupported (fails)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./
with:
command: unsupported
continue-on-error: true
id: test
- run: exit 1
if: steps.test.outcome != 'failure'
config:
name: config (test/errors.md, 2 errors)
runs-on: ubuntu-latest
Expand Down
16 changes: 0 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,6 @@ information.

## Inputs

### command (optional)

> **Deprecated in favor of the "fix" and "config" inputs**
>
> Command to run (unset, `fix`, or `config`)
>
> If unspecified or `""`, the `markdownlint-cli2` command is run.
>
> If set to `fix`, the `markdownlint-cli2-fix` command is run and supported
> issues will be fixed automatically.
>
> If set to `config`, the `markdownlint-cli2-config` command is run and the
> first element of `globs` should specify a supported configuration file.
>
> For more detail: [documentation for `markdownlint-cli2`][command-line].
### config (optional)

Path of a file to use for the base configuration object (defaults to none)
Expand Down
5 changes: 0 additions & 5 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ branding:
icon: check-square
color: orange
inputs:
command:
description: Command to run (unset, "fix", or "config")
deprecationMessage: This input is deprecated in favor of the "fix" and "config" inputs
default: ''
required: false
config:
description: Path of a file to use for the base configuration object (defaults to none)
default: ''
Expand Down
42 changes: 11 additions & 31 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58908,37 +58908,17 @@ if (fix) {
argv.push("--fix");
}

let invoke = true;
const command = core.getInput("command");
switch (command) {
case "":
// Default behavior
break;
case "config":
argv.unshift("--config");
break;
case "fix":
argv.unshift("--fix");
break;
default:
core.setFailed(`Unsupported command: ${command}`);
invoke = false;
break;
}

if (invoke) {
const parameters = {
argv,
logMessage,
"optionsOverride": {
"outputFormatters": [[outputFormatter]]
}
};
markdownlintCli2(parameters).then(
(code) => code && core.setFailed(`Failed with exit code: ${code}`),
(error) => core.setFailed(`Failed due to error: ${error}`)
);
}
const parameters = {
argv,
logMessage,
"optionsOverride": {
"outputFormatters": [[outputFormatter]]
}
};
markdownlintCli2(parameters).then(
(code) => code && core.setFailed(`Failed with exit code: ${code}`),
(error) => core.setFailed(`Failed due to error: ${error}`)
);

})();

Expand Down
42 changes: 11 additions & 31 deletions markdownlint-cli2-action.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,34 +60,14 @@ if (fix) {
argv.push("--fix");
}

let invoke = true;
const command = core.getInput("command");
switch (command) {
case "":
// Default behavior
break;
case "config":
argv.unshift("--config");
break;
case "fix":
argv.unshift("--fix");
break;
default:
core.setFailed(`Unsupported command: ${command}`);
invoke = false;
break;
}

if (invoke) {
const parameters = {
argv,
logMessage,
"optionsOverride": {
"outputFormatters": [[outputFormatter]]
}
};
markdownlintCli2(parameters).then(
(code) => code && core.setFailed(`Failed with exit code: ${code}`),
(error) => core.setFailed(`Failed due to error: ${error}`)
);
}
const parameters = {
argv,
logMessage,
"optionsOverride": {
"outputFormatters": [[outputFormatter]]
}
};
markdownlintCli2(parameters).then(
(code) => code && core.setFailed(`Failed with exit code: ${code}`),
(error) => core.setFailed(`Failed due to error: ${error}`)
);

0 comments on commit 1e5b660

Please sign in to comment.