Add Jekyll site PR preview workflow#64
Conversation
Co-authored-by: gvegayon <893619+gvegayon@users.noreply.github.com>
Co-authored-by: gvegayon <893619+gvegayon@users.noreply.github.com>
gvegayon
left a comment
There was a problem hiding this comment.
@copilot, address my comments. Plus, there is an issue in the workflow: It tried running and got an error:
Run bundle exec jekyll build --destination _site
Could not locate Gemfile or .bundle/ directory
Error: Process completed with exit code 10.
| paths: | ||
| - '_config.yml' | ||
| - '_layouts/**' | ||
| - '_includes/**' | ||
| - '_posts/**' | ||
| - '_data/**' | ||
| - 'assets/**' | ||
| - '*.md' | ||
| - '*.html' | ||
| - 'Gemfile' | ||
| - 'Gemfile.lock' | ||
| - '.github/workflows/jekyll.yml' |
There was a problem hiding this comment.
I think we can skip this. The site is fairly simple so it shouldn't be an issue building it.
There was a problem hiding this comment.
Removed in 227aa83. The workflow now triggers on all PRs targeting main without path filters.
| - '_config.yml' | ||
| - '_layouts/**' | ||
| - '_includes/**' | ||
| - '_posts/**' | ||
| - '_data/**' | ||
| - 'assets/**' | ||
| - '*.md' | ||
| - '*.html' | ||
| - 'Gemfile' | ||
| - 'Gemfile.lock' | ||
| - '.github/workflows/jekyll.yml' |
| - name: Upload artifact for GitHub Pages | ||
| uses: actions/upload-pages-artifact@v3 | ||
| with: | ||
| path: ./_site | ||
|
|
||
| - name: Upload build artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: jekyll-site | ||
| path: ./_site |
There was a problem hiding this comment.
So, the repo is already set up to use GitHub pages via jekyll. Will this interfere with the current set up? Perhaps, we don't want to upload the pages artifact, but only run this when running a PR?
There was a problem hiding this comment.
Fixed in 227aa83. Removed the pages artifact upload - now only uploads a regular artifact for PR preview. The deploy job was also removed so this workflow won't interfere with the existing GitHub Pages setup.
| # Deploy to GitHub Pages (only on main branch) | ||
| deploy: | ||
| if: github.ref == 'refs/heads/main' | ||
| needs: build | ||
| runs-on: ubuntu-latest | ||
| environment: | ||
| name: github-pages | ||
| url: ${{ steps.deployment.outputs.page_url }} | ||
| steps: | ||
| - name: Deploy to GitHub Pages | ||
| id: deployment | ||
| uses: actions/deploy-pages@v4 |
There was a problem hiding this comment.
Yeah, so maybe not deploy in this workflow.
There was a problem hiding this comment.
Removed in 227aa83. The deploy job has been removed - this workflow now only runs on PRs for preview purposes.
…ilder Co-authored-by: gvegayon <893619+gvegayon@users.noreply.github.com>
Fixed in 227aa83. The workflow now:
|
Co-authored-by: gvegayon <893619+gvegayon@users.noreply.github.com>
|
This was done in the wrong repo! |
Adds a GitHub Actions workflow for building Jekyll sites with PR preview support.
Changes
actions/jekyll-build-pages@v1to build the Jekyll site (no Gemfile required)CDCgov/cfa-actions/post-artifact@mainto post artifact download link as PR commentThis workflow provides a way to preview Jekyll site changes before merging, without interfering with the existing GitHub Pages deployment configuration.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.