diff --git a/.github/workflows/repo_tests.yaml b/.github/workflows/repo_tests.yaml index dbea8d38..306ebd33 100644 --- a/.github/workflows/repo_tests.yaml +++ b/.github/workflows/repo_tests.yaml @@ -35,7 +35,8 @@ jobs: description: (compile-commands.json) post-init: | # black complains about py2 code - ${TRUNK_PATH} check disable black + # markdownlint fails for some reason, and what we really care about anyways is clang-tidy + ${TRUNK_PATH} check disable black markdownlint mkdir build cd build cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS=ON @@ -44,8 +45,6 @@ jobs: sed -i "s|lint:|lint:\n compile_commands: json|" .trunk/trunk.yaml cp local-action/repo_tests/yaml_cpp.yaml .trunk/user.yaml ${TRUNK_PATH} check enable clang-tidy - # markdownlint fails for some reason, and what we really care about anyways is clang-tidy - ${TRUNK_PATH} check disable markdownlint - repo: pallets/flask ref: 4bcd4be6b7d69521115ef695a379361732bcaea6 @@ -75,6 +74,23 @@ jobs: fi description: (test for setup-node) + - repo: prawn-test-staging-rw/node-packages-failure-test + ref: main + post-init: | + if [ "${FAILED_NODE_PACKAGE_INSTALL}" != "true" ]; then + echo "::error::Node package install didn't fail" + exit 1 + fi + if grep -q "✔ eslint" <(${TRUNK_PATH} check list --color=false); then + echo "::error::eslint not disabled" + exit 1 + fi + if grep -q "✔ stylelint" <(${TRUNK_PATH} check list --color=false); then + echo "::error::stylelint not disabled" + exit 1 + fi + description: (test for continuing on node package install failure) + - repo: replayio/devtools ref: 730a9f0ddaafefc2a1a293d6924ce3910cd156ac description: (has trunk.yaml) @@ -95,10 +111,7 @@ jobs: description: (has trunk.yaml) post-init: | # all of these linters have failures - ${TRUNK_PATH} check disable svgo - ${TRUNK_PATH} check disable golangci-lint - ${TRUNK_PATH} check disable prettier - ${TRUNK_PATH} check disable oxipng + ${TRUNK_PATH} check disable svgo golangci-lint prettier oxipng - repo: shopify/draggable ref: e6cf325a98c11b8aefbfb626b7a91b95d1c340c9 diff --git a/action.yaml b/action.yaml index e5fe0ddd..1e74710c 100644 --- a/action.yaml +++ b/action.yaml @@ -223,6 +223,7 @@ runs: run: | if [ ! -e .trunk/trunk.yaml ]; then ${TRUNK_PATH:-trunk} init + echo "INITIALIZED_TRUNK=true" >>$GITHUB_ENV fi - name: Detect setup strategy diff --git a/setup-env/action.yaml b/setup-env/action.yaml index 92da70f6..7d704d69 100644 --- a/setup-env/action.yaml +++ b/setup-env/action.yaml @@ -115,6 +115,26 @@ runs: hashFiles(env.HASH_GLOB) }} - name: Install ${{ env.PACKAGE_MANAGER }} packages + id: install_packages if: env.PACKAGE_MANAGER && (env.NODE_VERSION_FILE || env.RUN_INSTALL_NODE_PACKAGES) shell: bash run: ${{ env.INSTALL_CMD }} + continue-on-error: true + + - name: Check for package install + if: env.PACKAGE_MANAGER && (env.NODE_VERSION_FILE || env.RUN_INSTALL_NODE_PACKAGES) + shell: bash + run: | + if [ ${{ steps.install_packages.outcome }} == "success" ]; then + exit 0 + fi + echo "FAILED_NODE_PACKAGE_INSTALL=true" >>$GITHUB_ENV + + if [[ -z "${INITIALIZED_TRUNK}" ]]; then + echo "::error::Failed to install node packages." + echo "::error::Aborting because this repo has an existing trunk.yaml file." + exit 1 + fi + echo "::warning::Failed to install node packages." + echo "::warning::Disabling linters that depend on node packages." + ${TRUNK_PATH} check disable eslint stylelint