prettier_action
prettier_action copied to clipboard
[BUG] Plugin dependencies doesn't seem to be installed
What exactly happened? Using the workflow config below:
name: Frontend Linting (Prettier)
on:
workflow_dispatch:
push:
branches:
- master
paths:
- '**.css'
- '**.js'
- '**.vue'
pull_request:
branches:
- master
paths:
- '**.css'
- '**.js'
- '**.vue'
jobs:
prettier:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
# Make sure the actual branch is checked out when running on pull requests.
ref: ${{ github.head_ref }}
- name: Prettify code
uses: creyD/[email protected]
with:
prettier_options: --write **/*.{css,js,vue}
prettier_plugins: prettier-plugin-tailwindcss
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Frontend Linting (Prettier)
skip_fetch: true
What should've happened? Tailwind dependency should be installed as expected.
How did it look?
Run creyD/[email protected]
with:
prettier_options: --write **/*.{css,js,vue}
prettier_plugins: prettier-plugin-tailwindcss
commit_message: Prettified Code!
same_commit: false
file_pattern: *
dry: false
prettier_version: false
working_directory: false
only_changed: false
github_token: ***
Run PATH=$(cd $GITHUB_ACTION_PATH; npm bin):$PATH /home/runner/work/_actions/creyD/prettier_action/v4.[2](https://github.com/dwarfhq/comwell-v2/actions/runs/3360387533/jobs/5569519547#step:3:2)/entrypoint.sh
PATH=$(cd $GITHUB_ACTION_PATH; npm bin):$PATH /home/runner/work/_actions/creyD/prettier_action/v4.2/entrypoint.sh
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
INPUT_COMMIT_MESSAGE: Prettified Code!
INPUT_COMMIT_DESCRIPTION:
INPUT_SAME_COMMIT: false
INPUT_COMMIT_OPTIONS:
INPUT_FILE_PATTERN: *
INPUT_PRETTIER_OPTIONS: --write **/*.{css,js,vue}
INPUT_DRY: false
INPUT_PRETTIER_VERSION: false
INPUT_ONLY_CHANGED: false
INPUT_PRETTIER_PLUGINS: prettier-plugin-tailwindcss
INPUT_WORKING_DIRECTORY: false
INPUT_GITHUB_TOKEN: ***
Installing prettier...
Checking plugin: prettier-plugin-tailwindcss
Prettifying files...
Files:
Error: .storybook/main.js: Error: Cannot find module 'tailwindcss/plugin'
Error: Require stack:
Error: - /home/runner/work/comwell-v2/comwell-v2/tailwind.config.js
Error: - /home/runner/work/_actions/creyD/prettier_action/v4.2/node_modules/prettier/index.js
Error: - /home/runner/work/_actions/creyD/prettier_action/v4.2/node_modules/prettier/cli.js
Error: - /home/runner/work/_actions/creyD/prettier_action/v4.2/node_modules/prettier/bin-prettier.js
Error: at Function.Module._resolveFilename (node:internal/modules/cjs/loader:985:15)
Error: at Function.Module._load (node:internal/modules/cjs/loader:8[3](https://github.com/dwarfhq/comwell-v2/actions/runs/3360387533/jobs/5569519547#step:3:3)3:27)
Error: at Module.require (node:internal/modules/cjs/loader:1057:19)
Error: at require (node:internal/modules/cjs/helpers:103:18)
Error: at Object.<anonymous> (/home/runner/work/comwell-v2/comwell-v2/tailwind.config.js:1:16)
Error: at Module._compile (node:internal/modules/cjs/loader:1155:1[4](https://github.com/dwarfhq/comwell-v2/actions/runs/3360387533/jobs/5569519547#step:3:4))
Error: at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10)
Error: at Module.load (node:internal/modules/cjs/loader:1033:32)
Error: at Function.Module._load (node:internal/modules/cjs/loader:868:12)
Error: at Module.require (node:internal/modules/cjs/loader:10[5](https://github.com/dwarfhq/comwell-v2/actions/runs/3360387533/jobs/5569519547#step:3:5)[7](https://github.com/dwarfhq/comwell-v2/actions/runs/3360387533/jobs/5569519547#step:3:7):1[9](https://github.com/dwarfhq/comwell-v2/actions/runs/3360387533/jobs/5569519547#step:3:9))
Same here with the svelte plugin.
---
name: Lint Code Base
on:
push:
branches: ['**']
pull_request:
branches: ['master']
jobs:
run-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- name: Prettify code
uses: creyD/[email protected]
with:
prettier_options: --write **/*.{html,js,css,md,svelte}
prettier_plugins: prettier-plugin-svelte
prettier_version: 2.8.1
Output is
with:
prettier_options: --write **/*.{html,js,css,md,svelte}
prettier_plugins: prettier-plugin-svelte
prettier_version: 2.8.1
commit_message: Prettified Code!
same_commit: false
file_pattern: *
dry: false
working_directory: false
only_changed: false
github_token: ***
Run PATH=$(cd $GITHUB_ACTION_PATH; npm bin):$PATH /home/runner/work/_actions/creyD/prettier_action/v4.2/entrypoint.sh
PATH=$(cd $GITHUB_ACTION_PATH; npm bin):$PATH /home/runner/work/_actions/creyD/prettier_action/v4.2/entrypoint.sh
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
INPUT_COMMIT_MESSAGE: Prettified Code!
INPUT_COMMIT_DESCRIPTION:
INPUT_SAME_COMMIT: false
INPUT_COMMIT_OPTIONS:
INPUT_FILE_PATTERN: *
INPUT_PRETTIER_OPTIONS: --write **/*.{html,js,css,md,svelte}
INPUT_DRY: false
INPUT_PRETTIER_VERSION: 2.8.1
INPUT_ONLY_CHANGED: false
INPUT_PRETTIER_PLUGINS: prettier-plugin-svelte
INPUT_WORKING_DIRECTORY: false
INPUT_GITHUB_TOKEN: ***
Installing prettier...
Checking plugin: prettier-plugin-svelte
Prettifying files...
Files:
Error: Cannot find module 'prettier-plugin-svelte'
Error: Require stack:
Error: - /home/runner/work/_actions/creyD/prettier_action/v4.2/node_modules/prettier/index.js
Error: - /home/runner/work/_actions/creyD/prettier_action/v4.2/node_modules/prettier/cli.js
Error: - /home/runner/work/_actions/creyD/prettier_action/v4.2/node_modules/prettier/bin-prettier.js
Problem running prettier with --write **/*.{html,js,css,md,svelte}
Error: Process completed with exit code 1.
So it seems like the npm install --silent
in the entrypoint.sh
isn't working as intended. Possible privs issue or something maybe, so no plugins can be installed or something? Removing the --silent
will reveal all.
Is there any solution for this? For me it seems to be not installing daisyui
for Tailwind. I think the issue is that this Action only allows prettier plugins to be installed. If it allowed for other dependencies to be installed here, this bug could be fixed?
I will add an option for this with the next update. We could do it like this: "allow_other_plugins" which is default on false and you can switch it over to true to avoid the check. However I don't know if this actually fixes the issue.