Open2

GitHub ActionsでHugoを使うときにPostCSSのエラーで落ちる現象の対処

困ってること

使ってるWorkflow:

name: CI

on:
    push:
        branches:
            - master

jobs:
    deploy:
        runs-on: ubuntu-18.04
        steps:
            - name: Install Hugo
              uses: peaceiris/actions-hugo@v2
              with:
                  hugo-version: '0.88.1'
                  extended: true

            - name: Checkout master branch
              uses: actions/checkout@v2
              with:
                  ref: master
                  submodules: true

            - name: Build web page
              run: hugo --minify

            - name: Push to gh-pages
              uses: peaceiris/actions-gh-pages@v3
              with:
                  github_token: ${{ secrets.GITHUB_TOKEN }}
                  publish_branch: gh-pages
                  publish_dir: public/

↓こういうのが出る.ローカル環境で同じHugo v0.88.1+extended使ってるときは出ない.

> Run hugo --minify
Start building sites … 
hugo v0.88.1-5BC54738+extended linux/amd64 BuildDate=2021-09-04T09:39:19Z VendorInfo=gohugoio
Error: Error building site: POSTCSS: failed to transform "css/main.css" (text/css). Check your PostCSS installation; install with "npm install postcss-cli". See https://gohugo.io/hugo-pipes/postcss/
Total in 1771 ms

↑のInstall Hugoのあとにこれ入れたら直った

            - name: Install PostCSS
              run: |
                npm install -g postcss postcss-cli autoprefixer
ログインするとコメントできます