Skip to content

Conversation

@paul58914080
Copy link
Member

No description provided.

@paul58914080 paul58914080 self-assigned this Jan 18, 2026
Copilot AI review requested due to automatic review settings January 18, 2026 13:15
@github-actions
Copy link

📘 Site preview available:

https://ff4j.github.io/docs/pr-1/

@paul58914080 paul58914080 merged commit 56d75c0 into feature/zensical Jan 18, 2026
9 checks passed
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a comprehensive documentation CI/CD workflow that builds documentation, deploys PR previews, publishes to GitHub Pages, and cleans up closed PR previews.

Changes:

  • Added PR preview deployment with automated preview URLs posted as comments
  • Configured separate publish job for production documentation deployment to GitHub Pages
  • Implemented cleanup job to remove preview folders from unmerged PRs

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +55 to +62
await github.rest.issues.createComment({
owner,
repo,
issue_number: pr,
body: `📘 **Site preview available**:\n\n${url}`
});
Copy link

Copilot AI Jan 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR comment step creates a new comment on every push to the PR, which will result in multiple comments cluttering the PR conversation. Consider checking if a preview comment already exists and updating it instead of creating a new one each time. You can search for existing comments and update them, or delete the old one before creating a new one.

Suggested change
await github.rest.issues.createComment({
owner,
repo,
issue_number: pr,
body: `📘 **Site preview available**:\n\n${url}`
});
const marker = '<!-- zensical-docs-preview -->';
const body = `${marker}\n📘 **Site preview available**:\n\n${url}`;
// Find existing preview comment (if any)
const comments = await github.paginate(
github.rest.issues.listComments,
{
owner,
repo,
issue_number: pr,
per_page: 100,
}
);
const existing = comments.find(
(comment) => typeof comment.body === 'string' && comment.body.includes(marker)
);
if (existing) {
await github.rest.issues.updateComment({
owner,
repo,
comment_id: existing.id,
body,
});
} else {
await github.rest.issues.createComment({
owner,
repo,
issue_number: pr,
body,
});
}

Copilot uses AI. Check for mistakes.
Comment on lines +80 to +82
if: github.event_name == 'pull_request' &&
github.event.action == 'closed' &&
github.event.pull_request.merged == false
Copy link

Copilot AI Jan 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cleanup job only runs when a PR is closed without being merged. This means preview folders for merged PRs will remain in the gh-pages branch indefinitely, accumulating over time. Consider also cleaning up preview folders for merged PRs by adjusting the condition to trigger on any PR closure.

Suggested change
if: github.event_name == 'pull_request' &&
github.event.action == 'closed' &&
github.event.pull_request.merged == false
if: github.event_name == 'pull_request' && github.event.action == 'closed'

Copilot uses AI. Check for mistakes.
steps:
- uses: actions/checkout@v6
- name: Checkout gh-pages branch
uses: actions/checkout@v4
Copy link

Copilot AI Jan 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a version mismatch in the checkout actions. Line 22 uses actions/checkout@v6 for the build job, but line 87 uses actions/checkout@v4 for the cleanup job. This inconsistency could lead to unexpected behavior. Use the same version across the workflow for consistency.

Suggested change
uses: actions/checkout@v4
uses: actions/checkout@v6

Copilot uses AI. Check for mistakes.
Comment on lines +91 to +99
- name: Remove PR preview folder
run: |
rm -rf pr-${{ github.event.pull_request.number }}
- name: Commit cleanup
run: |
git config user.name "github-actions"
git config user.email "github-actions@github.com"
git commit -am "chore: remove preview for PR #${{ github.event.pull_request.number }}" || exit 0
Copy link

Copilot AI Jan 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cleanup step removes the preview folder but doesn't check if the folder exists before attempting to commit. If the folder doesn't exist (e.g., if the workflow was run before this change was implemented), the git commit will be empty. While the "|| exit 0" handles this case, it's better practice to check if the folder exists first and only proceed if it does, to avoid unnecessary git operations.

Suggested change
- name: Remove PR preview folder
run: |
rm -rf pr-${{ github.event.pull_request.number }}
- name: Commit cleanup
run: |
git config user.name "github-actions"
git config user.email "github-actions@github.com"
git commit -am "chore: remove preview for PR #${{ github.event.pull_request.number }}" || exit 0
- name: Remove PR preview folder and commit cleanup
run: |
PR_DIR="pr-${{ github.event.pull_request.number }}"
if [ ! -d "$PR_DIR" ]; then
echo "Preview directory $PR_DIR does not exist; nothing to clean."
exit 0
fi
rm -rf "$PR_DIR"
git config user.name "github-actions"
git config user.email "github-actions@github.com"
# If there are no changes after removing the directory, skip commit and push
if git diff --quiet; then
echo "No changes to commit after removing $PR_DIR; skipping git commit and push."
exit 0
fi
git commit -am "chore: remove preview for PR #${{ github.event.pull_request.number }}"

Copilot uses AI. Check for mistakes.
Comment on lines +74 to +76
name: github-pages
steps:
- name: Deploy to GitHub Pages
Copy link

Copilot AI Jan 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The publish job should have an explicit url output to indicate where the documentation was deployed. This would improve traceability and make it easier to know where the production documentation is hosted after deployment.

Suggested change
name: github-pages
steps:
- name: Deploy to GitHub Pages
name: github-pages
outputs:
url: ${{ steps.deploy.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deploy

Copilot uses AI. Check for mistakes.
@paul58914080 paul58914080 deleted the technical/zensical-ci branch January 18, 2026 13:39
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.

2 participants