fix: run puppeteer in the GitHub Actions environment

This commit is contained in:
Ryan Yin 2025-06-16 23:29:02 +08:00
parent 3e3ba3ff5c
commit 7adc16bf1d
2 changed files with 9 additions and 1 deletions

View File

@ -22,7 +22,6 @@ jobs:
- name: Run a command with nix develop - name: Run a command with nix develop
run: | run: |
nix develop .#export-pdf --ignore-environment --command bash -c ' nix develop .#export-pdf --ignore-environment --command bash -c '
export PUPPETEER_ARGS="--no-sandbox --disable-setuid-sandbox"
pnpm install pnpm install
pnpm export-pdf pnpm export-pdf
' '

View File

@ -27,6 +27,15 @@ const footerTemplate = `<div style="margin-bottom: -0.4cm; height: 70%; width: 1
export default defineUserConfig({ export default defineUserConfig({
urlOrigin: "https://nixos-and-flakes.thiscute.world/", urlOrigin: "https://nixos-and-flakes.thiscute.world/",
// When process.env.CI is true (in GitHub Actions), disable sandboxing
...(process.env.CI
? {
puppeteerLaunchOptions: {
args: ["--no-sandbox", "--disable-setuid-sandbox"],
},
}
: {}),
pdfOptions: { pdfOptions: {
format: "A4", format: "A4",
printBackground: true, printBackground: true,