mirror of
https://github.com/actions-hub/stylelint.git
synced 2024-10-05 18:14:23 -04:00
first commit
This commit is contained in:
commit
8887c617d2
4 changed files with 95 additions and 0 deletions
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
.idea
|
||||
.git
|
||||
.DS_Store
|
18
Dockerfile
Normal file
18
Dockerfile
Normal file
|
@ -0,0 +1,18 @@
|
|||
FROM exelban/baseimage:node-latest
|
||||
|
||||
LABEL name="stylelint" \
|
||||
version="1.0.0" \
|
||||
repository="https://github.com/exelban/stylelint" \
|
||||
homepage="https://github.com/exelban/stylelint" \
|
||||
maintainer="Serhiy Mytrovtsiy <mitrovtsiy@ukr.net>" \
|
||||
com.github.actions.name="stylelint" \
|
||||
com.github.actions.description="GitHub Action that runs stylelint." \
|
||||
com.github.actions.icon="layout" \
|
||||
com.github.actions.color="black"
|
||||
|
||||
COPY README.md /
|
||||
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
43
README.md
Normal file
43
README.md
Normal file
|
@ -0,0 +1,43 @@
|
|||
# stylelint
|
||||
GitHub Action that runs [stylelint](https://stylelint.io).
|
||||
|
||||
## Usage
|
||||
|
||||
```yaml
|
||||
- uses: exelban/stylelint@master
|
||||
```
|
||||
|
||||
### Default values
|
||||
#### Configuration file
|
||||
Action will check if stylelint is already installed. If not, it will install styleling.
|
||||
Also its check if configuration file is exist (`.stylelintrc`).
|
||||
|
||||
By default action use next configuration:
|
||||
```json
|
||||
{
|
||||
"extends": "stylelint-config-standard",
|
||||
"rules": {
|
||||
"indentation": 2
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### Pattern
|
||||
If pattern is not provided, action will use default one: `*.css`.
|
||||
```yaml
|
||||
- uses: exelban/stylelint@master
|
||||
with:
|
||||
args: ./**/*.scss
|
||||
```
|
||||
|
||||
#### Indentation
|
||||
Indentation can be set by environment variable `INDENT_SPACES`.
|
||||
|
||||
```yaml
|
||||
- uses: exelban/stylelint@master
|
||||
env:
|
||||
INDENT_SPACES: 4
|
||||
```
|
||||
|
||||
## License
|
||||
[MIT License](https://github.com/exelban/stylelint/blob/master/LICENSE)
|
31
entrypoint.sh
Normal file
31
entrypoint.sh
Normal file
|
@ -0,0 +1,31 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
stylelint_path="node_modules/.bin/stylelint"
|
||||
indent_spaces=2
|
||||
|
||||
if [ ! -e stylelint_path ]; then
|
||||
yarn add stylelint stylelint-config-standard --silent
|
||||
fi
|
||||
|
||||
if [ ! -e "./.stylelintrc" ]; then
|
||||
if [ -z "${INDENT_SPACES-}" ]; then
|
||||
indent_spaces=$INDENT_SPACES
|
||||
fi
|
||||
|
||||
echo "{
|
||||
\"extends\": \"stylelint-config-standard\",
|
||||
\"rules\": {
|
||||
\"indentation\": "$indent_spaces"
|
||||
}
|
||||
}" > .stylelintrc
|
||||
fi
|
||||
|
||||
if [ -z "$*" ]; then
|
||||
pattern="./*.css"
|
||||
else
|
||||
pattern="$*"
|
||||
fi
|
||||
|
||||
sh -c "$stylelint_path $pattern"
|
Loading…
Reference in a new issue