diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5ec79f53704398a..5901ba6a720e0cc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,6 +13,9 @@ jobs: compile: name: Compiles runs-on: ubuntu-latest + defaults: + run: + shell: bash --noprofile --norc -eo pipefail {0} steps: - uses: actions/checkout@v4 with: @@ -27,12 +30,12 @@ jobs: node_modules/.astro key: static - - run: npm ci - - run: npm run check + - run: npm ci |& tee -a build.log + - run: npm run check - run: npm run format:core:check ## TODO: content formatting checks - - run: npm run build + - run: npm run build |& tee -a build.log env: NODE_OPTIONS: "--max-old-space-size=4192" RUN_LINK_CHECK: true @@ -50,3 +53,18 @@ jobs: - name: Tests run: npm run test + + - name: post build errors as PR comment + if: failure() + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + # remove ANSI colours & try find some known error strings + ERRORS=$(cat build.log | sed 's/\x1B\[[0-9;]*[A-Za-z]//g' | awk 'tolower($0) ~ /\[.*error.*\]|npm err|\[vite\] error /,0') + + if [ -n "$ERRORS" ]; then + URL=$(gh run view ${{ github.run_id }} --json url --jq '.url') + BODY="[Build failed]($URL)\n\n\`\`\`txt\n$ERRORS\n\`\`\`" + + echo -e "$BODY" | gh pr comment ${{ github.event.number }} --repo ${{ github.repository }} --body-file - + fi diff --git a/astro.config.ts b/astro.config.ts index 7fbceed08ea8047..1902359c3770edb 100644 --- a/astro.config.ts +++ b/astro.config.ts @@ -179,7 +179,7 @@ export default defineConfig({ ...(runLinkCheck ? [ starlightLinksValidator({ - errorOnInvalidHashes: false, + errorOnInvalidHashes: true, errorOnLocalLinks: false, exclude: [ "/api/",