Skip to content

Fix GitHub Pages deployment by removing duplicate build step#13

Merged
Rob Bos (rajbos) merged 5 commits into
mainfrom
copilot/fix-12
Jun 17, 2025
Merged

Fix GitHub Pages deployment by removing duplicate build step#13
Rob Bos (rajbos) merged 5 commits into
mainfrom
copilot/fix-12

Conversation

Copilot AI commented Jun 17, 2025

Copy link
Copy Markdown
Contributor

The GitHub Pages deployment was showing a blank page because the GitHub Actions workflow was running two conflicting build commands that overwrote each other.

Issue

The deployed page appeared blank with no CSS or JavaScript loading, as shown in the issue screenshot. Users would see only black text on a white background with no styling.

Root Cause

The GitHub Actions workflow in .github/workflows/deploy-to-pages.yml was running two build commands:

  1. npm run build:pages - Creates correct GitHub Pages build with relative paths (base: './')
  2. npm run build - Overwrites it with regular build using absolute paths (base: '/github-copilot-usage/')

The second build would overwrite the GitHub Pages optimized build, resulting in incorrect asset paths that failed to load on GitHub Pages.

Solution

Removed the duplicate npm run build step from the GitHub Actions workflow. Now only npm run build:pages runs, which:

  • Uses vite.github-pages.config.ts with base: './' for relative paths
  • Excludes @github/spark dependencies that aren't available in GitHub Pages
  • Generates correct index.html with relative asset references like ./assets/index-XXX.js

Verification

  • ✅ Build generates correct relative asset paths
  • ✅ No absolute path references that would fail on GitHub Pages
  • ✅ CSS and JavaScript files are properly bundled and referenced
  • ✅ Minimal change (only 3 lines removed from workflow)

Fixes #12.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI and others added 2 commits June 17, 2025 17:01
…y workflow

Co-authored-by: rajbos <6085745+rajbos@users.noreply.github.com>
Co-authored-by: rajbos <6085745+rajbos@users.noreply.github.com>
Copilot AI changed the title [WIP] Output page is not using any JS or markup Fix GitHub Pages deployment by removing duplicate build step Jun 17, 2025
Copilot AI requested a review from Rob Bos (rajbos) June 17, 2025 17:10
@rajbos

Copy link
Copy Markdown
Collaborator

Duplicate deploy has been removed in #10. Branch has been updated with latest state. Issue still remains,

Source is just this:

<html>
<body>
<!--StartFragment-->
  | <!DOCTYPE html>
-- | --
  | <html lang="en">
  |  
  | <head>
  | 
  | <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  | <title>GitHub Copilot Usage Analyzer</title>
  | <link rel="icon" href="https://github.githubassets.com/favicons/favicon.svg" />
  | <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
  | <script type="module" crossorigin src="/assets/index-Bb8eoUmE.js"></script>
  | <link rel="stylesheet" crossorigin href="/assets/index-CI-iLjxc.css">
  | </head>
  |  
  | <body>
  | <div id="root"></div>
  | </body>
  |  
  | </html>

<!--EndFragment-->
</body>
</html><!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>GitHub Copilot Usage Analyzer</title>
    <link rel="icon" href="https://github.githubassets.com/favicons/favicon.svg" />
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
  <script type="module" crossorigin src="[/assets/index-Bb8eoUmE.js](https://devopsjournal.io/assets/index-Bb8eoUmE.js)"></script>
  <link rel="stylesheet" crossorigin href="[/assets/index-CI-iLjxc.css](https://devopsjournal.io/assets/index-CI-iLjxc.css)">
</head>

<body>
    <div id="root"></div>
</body>

</html>

Copilot AI commented Jun 17, 2025

Copy link
Copy Markdown
Contributor Author

Duplicate deploy has been removed in #10. Branch has been updated with latest state. Issue still remains,

Source is just this:
...

I can confirm the build configuration is working correctly locally - it generates relative paths (./assets/index-XXX.css) as expected. Since you mentioned the issue persists after merging #10, this appears to be a caching issue.

The GitHub Pages deployment may be serving a cached version. Try:

  1. Re-triggering the GitHub Actions workflow manually from the Actions tab
  2. Making a small commit to force a fresh deployment
  3. Checking if GitHub Pages is configured to deploy from the correct branch (main)

The workflow at commit 55069ca should generate the correct relative paths.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • fonts.googleapis.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@rajbos

Copy link
Copy Markdown
Collaborator

lets temporarily deploy from any branch, so we can test. Comment out the if statement that blocks the deploy from another branch then main

Co-authored-by: rajbos <6085745+rajbos@users.noreply.github.com>

Copilot AI commented Jun 17, 2025

Copy link
Copy Markdown
Contributor Author

lets temporarily deploy from any branch, so we can test. Comment out the if statement that blocks the deploy from another branch then main

Done! I've commented out the if statement that restricts deployment to main branch. The workflow will now deploy from any branch for testing purposes. See commit 4e30c94.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • fonts.googleapis.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@rajbos Rob Bos (rajbos) marked this pull request as ready for review June 17, 2025 18:05
@rajbos Rob Bos (rajbos) merged commit f73bf6b into main Jun 17, 2025
5 of 8 checks passed
@rajbos Rob Bos (rajbos) deleted the copilot/fix-12 branch June 17, 2025 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Output page is not using any JS or markup

2 participants