fix: puppeteer - pass NO_SANDBOX in github workflow, exit when failed

This commit is contained in:
Ryan Yin 2025-06-16 23:35:52 +08:00
parent 7adc16bf1d
commit 5cf7fdd1c4
2 changed files with 5 additions and 3 deletions

View File

@ -19,9 +19,11 @@ jobs:
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- name: Show nixpkgs version - name: Show nixpkgs version
run: nix-instantiate --eval -E '(import <nixpkgs> {}).lib.version' run: nix-instantiate --eval -E '(import <nixpkgs> {}).lib.version'
- name: Run a command with nix develop - name: Generate PDF
run: | run: |
nix develop .#export-pdf --ignore-environment --command bash -c ' nix develop .#export-pdf --ignore-environment --command bash -c '
set -e
export NO_SANDBOX=true
pnpm install pnpm install
pnpm export-pdf pnpm export-pdf
' '

View File

@ -28,8 +28,8 @@ 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 // When NO_SANDBOX is true, disable sandboxing
...(process.env.CI ...(process.env.NO_SANDBOX === "true"
? { ? {
puppeteerLaunchOptions: { puppeteerLaunchOptions: {
args: ["--no-sandbox", "--disable-setuid-sandbox"], args: ["--no-sandbox", "--disable-setuid-sandbox"],